Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP] XSD redirect
ttmdear
post
Post #1





Grupa: Zarejestrowani
Postów: 8
Pomógł: 0
Dołączył: 29.06.2016

Ostrzeżenie: (0%)
-----


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 (IMG:style_emoticons/default/smile.gif)

Temat zamknięty.

Ten post edytował ttmdear 27.09.2016, 12:02:15
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.12.2025 - 22:07