mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
Remove PHP code examples from xmlreader
The PHP documentation can present the xmlreader extension better with code snippets.
This commit is contained in:
parent
55625dd9c9
commit
842ba86c34
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!ELEMENT LIST (MOVIE+)>
|
||||
<!ELEMENT MOVIE (TITLE, ORGTITLE, LOC, INFO)>
|
||||
<!ATTLIST MOVIE ID ID #REQUIRED>
|
||||
<!ELEMENT TITLE (#PCDATA)>
|
||||
<!ELEMENT ORGTITLE (#PCDATA)>
|
||||
<!ELEMENT LOC (#PCDATA)>
|
||||
<!ELEMENT INFO (#PCDATA)>
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE LIST SYSTEM "dtdexample.dtd">
|
||||
<LIST>
|
||||
<MOVIE ID="x200338360">
|
||||
<TITLE>Move Title 1</TITLE>
|
||||
<ORGTITLE/><LOC>Location 1</LOC>
|
||||
<INFO/>
|
||||
</MOVIE>
|
||||
<MOVIE ID="m200338361">
|
||||
<TITLE>Move Title 2</TITLE>
|
||||
<ORGTITLE/>
|
||||
<LOC>Location 2</LOC>
|
||||
<INFO/>
|
||||
</MOVIE>
|
||||
</LIST>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
|
||||
datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
|
||||
<include href="relaxNG2.rng">
|
||||
<define name="TEI.prose"><ref name="INCLUDE"/></define>
|
||||
</include>
|
||||
</grammar>
|
||||
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
<TEI.2>hello</TEI.2>
|
@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:t="http://www.thaiopensource.com/ns/annotations" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
|
||||
<start>
|
||||
<ref name="TEI.2"/>
|
||||
</start>
|
||||
<define name="IGNORE">
|
||||
<notAllowed/>
|
||||
</define>
|
||||
<define name="INCLUDE">
|
||||
<empty/>
|
||||
</define>
|
||||
|
||||
|
||||
<include href="relaxNG3.rng"/>
|
||||
|
||||
<define name="TEI.2">
|
||||
<element name="TEI.2">
|
||||
<text/>
|
||||
</element>
|
||||
</define>
|
||||
|
||||
</grammar>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<grammar xmlns="http://relaxng.org/ns/structure/1.0" xmlns:t="http://www.thaiopensource.com/ns/annotations" xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
||||
|
||||
<define name="TEI.prose" combine="interleave">
|
||||
<ref name="IGNORE"/>
|
||||
</define>
|
||||
|
||||
</grammar>
|
@ -1,10 +0,0 @@
|
||||
<books>
|
||||
<book num="1">
|
||||
<title>The Grapes of Wrath</title>
|
||||
<author>John Steinbeck</author>
|
||||
</book>
|
||||
<book num="2">
|
||||
<title>The Pearl</title>
|
||||
<author>John Steinbeck</author>
|
||||
</book>
|
||||
</books>
|
@ -1,20 +0,0 @@
|
||||
<?php
|
||||
$reader = new XMLReader();
|
||||
$reader->open('xmlreader.xml');
|
||||
while ($reader->read()) {
|
||||
if ($reader->nodeType != XMLREADER::END_ELEMENT) {
|
||||
print "Node Name: ".$reader->name."\n";
|
||||
print "Node Value: ".$reader->value."\n";
|
||||
print "Node Depth: ".$reader->depth."\n";
|
||||
if ($reader->nodeType==XMLREADER::ELEMENT && $reader->hasAttributes) {
|
||||
$attr = $reader->moveToFirstAttribute();
|
||||
while ($attr) {
|
||||
print " Attribute Name: ".$reader->name."\n";
|
||||
print " Attribute Value: ".$reader->value."\n";
|
||||
$attr = $reader->moveToNextAttribute();
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,25 +0,0 @@
|
||||
<?php
|
||||
$indent = 5; /* Number of spaces to indent per level */
|
||||
|
||||
$reader = new XMLReader();
|
||||
$reader->open('relaxNG.xml');
|
||||
/*
|
||||
Example setting relaxNG using string:
|
||||
$reader->setRelaxNGSchemaSource(file_get_contents('relaxNG.rng'));
|
||||
*/
|
||||
if ($reader->setRelaxNGSchema('relaxNG.rng')) {
|
||||
while ($reader->read()) {
|
||||
/* Print node name indenting it based on depth and $indent var */
|
||||
print str_repeat(" ", $reader->depth * $indent).$reader->name."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print "\n";
|
||||
|
||||
if (! $reader->isValid()) {
|
||||
print "Document is not valid\n";
|
||||
} else {
|
||||
print "Document is valid\n";
|
||||
}
|
||||
|
||||
?>
|
@ -1,31 +0,0 @@
|
||||
<?php
|
||||
$xmlstring = '<books>
|
||||
<book num="1">
|
||||
<title>The Grapes of Wrath</title>
|
||||
<author>John Steinbeck</author>
|
||||
</book>
|
||||
<book num="2">
|
||||
<title>The Pearl</title>
|
||||
<author>John Steinbeck</author>
|
||||
</book>
|
||||
</books>';
|
||||
|
||||
$reader = new XMLReader();
|
||||
$reader->XML($xmlstring);
|
||||
while ($reader->read()) {
|
||||
if ($reader->nodeType != XMLREADER::END_ELEMENT) {
|
||||
print "Node Name: ".$reader->name."\n";
|
||||
print "Node Value: ".$reader->value."\n";
|
||||
print "Node Depth: ".$reader->depth."\n";
|
||||
if ($reader->nodeType==XMLREADER::ELEMENT && $reader->hasAttributes) {
|
||||
$attr = $reader->moveToFirstAttribute();
|
||||
while ($attr) {
|
||||
print " Attribute Name: ".$reader->name."\n";
|
||||
print " Attribute Value: ".$reader->value."\n";
|
||||
$attr = $reader->moveToNextAttribute();
|
||||
}
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
?>
|
@ -1,18 +0,0 @@
|
||||
<?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());
|
||||
?>
|
Loading…
Reference in New Issue
Block a user