Validating empty data from xml files
) DOMDocument against an existing XML Schema, I ran into a warning like the one below.Validation fails, even though the document IS valid and the command line tool xmllint confirms this (even with libxml 2.6.32, so this must be a problem with DOM). Warning: DOMDocument::schema Validate() [domdocument.schemavalidate]: Element 'Your Root Element Name': No matching global declaration available for the validation root.What i misunderstood is that, there's no way with the DOM api to specify a "default namespace" for each children of the root element.
Initial situation:- Debian Lenny- Apache 2 with PHP 5.2.6- libxml 2.6.32Problem: While trying to validate a manually created (!
in /var/www/Your on line XSolution: As libxml 2.7.3 is not provided for Debian Lenny yet and this problem seems to be caused by DOM (s.o.), I currently use the following workaround on my machines.
DOM obviously has some namespace problems with documents, that have been created manually (i.e. So my workaround is saving the DOMDocument temporarily, re-loading it and then validating the temporary DOMDocument.
Strangely enough the validation of the same document (= same content) now works.
Old error message: Warning: DOMDocument::schema Validate() [function.schema Validate]: Element 'child_integer': 'Error condition.' is not a valid value of the atomic type 'xs:integer'.
in on line 40New error message: DOMDocument::schema Validate() Generated Errors!