Hello,
I'm trying to validate my XML files against a DTD with PHP 5 and it spits out element order errors (see below). the files validate in FF (once I set the used entities in the local DTD part, but that's a FF issue not applying to PHP). From a simpler DTD I know that element order must be the same in DTD and XML but I don't know what the cause is for error 1 (once you leave out the optional elements, it looks the same to me, even the order).
the other issue is that the nested construct seems not to be recognized by libxml somehow.
can anyone help me here?
thanks
Error messages:
and
PHP code:
XML code (snippet, line numbers preserved)
I'm trying to validate my XML files against a DTD with PHP 5 and it spits out element order errors (see below). the files validate in FF (once I set the used entities in the local DTD part, but that's a FF issue not applying to PHP). From a simpler DTD I know that element order must be the same in DTD and XML but I don't know what the cause is for error 1 (once you leave out the optional elements, it looks the same to me, even the order).
the other issue is that the nested construct seems not to be recognized by libxml somehow.
can anyone help me here?
thanks
Error messages:
Code:
Warning: DOMDocument::load() [function.DOMDocument-load]: Element seite content does not follow the DTD, expecting (titel , datei? , subsection? , preview? , verzeichnis? , bild* , link:author? , link:appendix* , […shortened for readability…] , dcterms:subject? , dcterms:title? , dcterms:type?), got (titel datei dcterms:date dcterms:modified dcterms:title ) in /var/www/kbl/system/xml/main.struktur.xml, line: 17 in /var/www/kbl/test.php on line 5
Code:
Warning: DOMDocument::load() [function.DOMDocument-load]: Content model of datei is not determinist: (file | (file? , xsl , xml? , par?)) in /var/www/kbl/system/xml/main.struktur.xml, line: 13 in /var/www/kbl/test.php on line 5
Code:
$xml = new DOMDocument("1.0", "iso-8859-1"); $xml->validatOnParse = true; $options = LIBXML_DTDLOAD|LIBXML_DTDATTR|LIBXML_DTDVALID; $test = $xml->load("system/xml/main.struktur.xml", $options);
Code:
<?xml version="1.0" encoding="iso-8859-1" ?> <!-- project control file --> <!DOCTYPE kbl SYSTEM "../dtd/struktur.dtd"> <kbl xmlns="http://www.kulturbeutel-leipzig.net/XML/struktur" xmlns:link="http://www.kulturbeutel-leipzig.net/XML/link" xmlns:dcterms="http://purl.org/dc/terms/"> <seite id="home" title="Startseite"> <titel>Startseite</titel> <datei> <file>home.php</file> </datei> <dcterms:date dc="yes">2008-04-15T08:45+02:00</dcterms:date> <dcterms:modified>2008-09-18T10:55+02:00</dcterms:modified> <dcterms:title dc="yes">Startseite</dcterms:title> </seite> <seite id="spielplan" title="Spielplan" cssid="spielplan"> <titel>Auftrittstermine</titel> <datei> <xml>spielplan.xml</xml> <xsl>main.spielplan.xsl</xsl> <par>jahr</par> </datei> <dcterms:title dc="yes">Auftrittstermine</dcterms:title> <dcterms:modified>2008-09-18T10:55+02:00</dcterms:modified> <dcterms:date dc="yes">2008-04-15T08:45+02:00</dcterms:date> </seite> […] </kbl>
Comment