<?php $txt =<<<EOT <?xml version="1.0"?> <Article xmlns='http://www.example.com/xml'> <Item>ItemText</Item> </Article> EOT; $dom = new DOMDocument(); $dom->loadXML($txt); if ($dom->schemaValidate("Article.xsd")) { print $dom->saveXML(); } ?>
The schema I am trying to validate against is:
<?xml version="1.0" ?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" > <xs:element name="Article"> <xs:complexType> <xs:sequence> <xs:element name="Item" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
This produces the following output:
Warning: Element Article not declared in E:\PHPTest\testXML.php on line 10
Warning: Element Article not declared in E:\PHPTest\testXML.php on line 10
If I remove the default namespace from the article tag, the XML validates correctly. I seem to recollect that namespace support is not fully implemented, so my question is, is this a bug, or just something not yet implemented, or is there an obvious blunder in what I am trying to do, which I cannot see.
Best regards. . . Dusty
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php