What php library should I use if I want to get the allowable attributes in a tag, or the allowable tags in a specific part of a DITA XML document, according to it's DTD or XSD?
I've tried it with the XML_DTD-0.5.2 pear lib, but it seems it parses the offical 1.1 and 1.2 DITA 开发者_JAVA百科dtds with many errors...
Use DOM or XMLReader and then use their respective methods to validate XML against a schema:
- http://de.php.net/manual/en/domdocument.schemavalidate.php
- http://de.php.net/manual/en/xmlreader.setschema.php
Or simply load the Schema directly with these libraries. Since Schema is XML too you can process it like any other XML, e.g. find out what attributes are defined for an element.
精彩评论