开发者

Validate DITA in php

开发者 https://www.devze.com 2023-01-15 16:58 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消