diff options
| author | Rob Richards <rrichards@php.net> | 2004-04-27 10:46:21 +0000 |
|---|---|---|
| committer | Rob Richards <rrichards@php.net> | 2004-04-27 10:46:21 +0000 |
| commit | 80fd6dcaa4eb5033194ef8140392d748c05c9c33 (patch) | |
| tree | 7ca368f21b8b3eff9c9fcb5fe868d211c54f75bf /ext/xmlreader/examples/xmlreader_validatedtd.php | |
| parent | 1f22d848e98e66939b8aa765892f9f9b8cd4034c (diff) | |
| download | php-git-80fd6dcaa4eb5033194ef8140392d748c05c9c33.tar.gz | |
add relaxNG support
set xml base directory so it is consistant
add validation examples
Diffstat (limited to 'ext/xmlreader/examples/xmlreader_validatedtd.php')
| -rw-r--r-- | ext/xmlreader/examples/xmlreader_validatedtd.php | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/ext/xmlreader/examples/xmlreader_validatedtd.php b/ext/xmlreader/examples/xmlreader_validatedtd.php new file mode 100644 index 0000000000..5173154f5a --- /dev/null +++ b/ext/xmlreader/examples/xmlreader_validatedtd.php @@ -0,0 +1,18 @@ +<?php +$indent = 5; /* Number of spaces to indent per level */ + +$xml = new XMLReader(); +$xml->open("dtdexample.xml"); +$xml->setParserProperty(XMLREADER_LOADDTD, TRUE); +$xml->setParserProperty(XMLREADER_VALIDATE, TRUE); +while($xml->read()) { + /* Print node name indenting it based on depth and $indent var */ + print str_repeat(" ", $xml->depth * $indent).$xml->name."\n"; + if ($xml->hasAttributes) { + $attCount = $xml->attributeCount; + print str_repeat(" ", $xml->depth * $indent)." Number of Attributes: ".$xml->attributeCount."\n"; + } +} +print "\n\nValid:\n"; +var_dump($xml->isValid()); +?>
\ No newline at end of file |
