Cześć,

  1. $tmp = new Tmpfile($this->getXml());
  2.  
  3. $reader = new XMLReader();
  4. $reader->open($tmp->getPath());
  5. $reader->setSchema($schemat->getPathToFile());
  6.  
  7. libxml_use_internal_errors(true);
  8.  
  9. // read xml structure
  10. while($reader->read());
  11.  
  12. // close xml
  13. $reader->close();
  14. $tmp->delete();
  15.  
  16. $errors = array();
  17. $schemaValidate = array();
  18.  
  19. foreach (libxml_get_errors() as $error) {
  20. $schemaValidate[] = trim($error->message);
  21. }
  22.  
  23. if (!empty($schemaValidate)) {
  24. return $this->error('schema', $schemaValidate, 'invalidFormat');
  25. }else{
  26. return null;
  27. }


Powyższy fragment waliduje mi plik XML na postawie pliku XSD.
Plik XSD ma dodatkowe zewnętrzne definicje które są pobierane w czasie walidacji.

Problem w tym że gdy pobierane są te definicje to zwracany jest błąd :

"failed to load external entity "http:"

Ponieważ zwracany jest Redirect dla tych zewnętrznych definicji.

Dla potomnych, opcja "allow_url_fopen"

Musi być włączona smile.gif

Temat zamknięty.