diff options
Diffstat (limited to 'ext/dom/examples')
| -rw-r--r-- | ext/dom/examples/relaxNG.php | 11 | ||||
| -rw-r--r-- | ext/dom/examples/relaxNG.rng | 11 | ||||
| -rw-r--r-- | ext/dom/examples/relaxNG.xml | 1 | ||||
| -rw-r--r-- | ext/dom/examples/relaxNG2.rng | 23 | ||||
| -rw-r--r-- | ext/dom/examples/relaxNG3.rng | 8 | ||||
| -rw-r--r-- | ext/dom/examples/shipping.php | 11 | ||||
| -rw-r--r-- | ext/dom/examples/shipping.xml | 21 | ||||
| -rw-r--r-- | ext/dom/examples/shipping.xsd | 36 |
8 files changed, 122 insertions, 0 deletions
diff --git a/ext/dom/examples/relaxNG.php b/ext/dom/examples/relaxNG.php new file mode 100644 index 0000000000..d265fd988e --- /dev/null +++ b/ext/dom/examples/relaxNG.php @@ -0,0 +1,11 @@ +<?php + +$dom = new domDocument; +$dom->load('relaxNG.xml'); +if (!$dom->relaxNGValidate('relaxNG.rng')) { + print "Document is not valid"; +} else { + print "Document is valid"; +} + +?>
\ No newline at end of file diff --git a/ext/dom/examples/relaxNG.rng b/ext/dom/examples/relaxNG.rng new file mode 100644 index 0000000000..f4357e04ef --- /dev/null +++ b/ext/dom/examples/relaxNG.rng @@ -0,0 +1,11 @@ +<?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> + + + diff --git a/ext/dom/examples/relaxNG.xml b/ext/dom/examples/relaxNG.xml new file mode 100644 index 0000000000..6b0cac1225 --- /dev/null +++ b/ext/dom/examples/relaxNG.xml @@ -0,0 +1 @@ +<TEI.2>hello</TEI.2>
\ No newline at end of file diff --git a/ext/dom/examples/relaxNG2.rng b/ext/dom/examples/relaxNG2.rng new file mode 100644 index 0000000000..4adae7b151 --- /dev/null +++ b/ext/dom/examples/relaxNG2.rng @@ -0,0 +1,23 @@ +<?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>
\ No newline at end of file diff --git a/ext/dom/examples/relaxNG3.rng b/ext/dom/examples/relaxNG3.rng new file mode 100644 index 0000000000..73e1eb6165 --- /dev/null +++ b/ext/dom/examples/relaxNG3.rng @@ -0,0 +1,8 @@ +<?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>
\ No newline at end of file diff --git a/ext/dom/examples/shipping.php b/ext/dom/examples/shipping.php new file mode 100644 index 0000000000..5205fd2014 --- /dev/null +++ b/ext/dom/examples/shipping.php @@ -0,0 +1,11 @@ +<?php + +$dom = new domDocument; +$dom->load('shipping.xml'); +if (!$dom->schemaValidate('shipping.xsd')) { + print "Document is not valid"; +} else { + print "Document is valid"; +} + +?>
\ No newline at end of file diff --git a/ext/dom/examples/shipping.xml b/ext/dom/examples/shipping.xml new file mode 100644 index 0000000000..dc8a09e301 --- /dev/null +++ b/ext/dom/examples/shipping.xml @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<shipOrder> + <shipTo> + <name>Tove Svendson</name> + <street>Ragnhildvei 2</street> + <address>4000 Stavanger</address> + <country>Norway</country> + </shipTo> + <items> + <item> + <title>Empire Burlesque</title> + <quantity>1</quantity> + <price>10.90</price> + </item> + <item> + <title>Hide your heart</title> + <quantity>1</quantity> + <price>9.90</price> + </item> + </items> +</shipOrder>
\ No newline at end of file diff --git a/ext/dom/examples/shipping.xsd b/ext/dom/examples/shipping.xsd new file mode 100644 index 0000000000..8b16b7c03a --- /dev/null +++ b/ext/dom/examples/shipping.xsd @@ -0,0 +1,36 @@ +<?xml version="1.0"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <xsd:element name="shipOrder" type="order"/> + + <xsd:complexType name="order"> + <xsd:all> + <xsd:element name="shipTo" type="shipAddress"/> + <xsd:element name="items" type="cdItems"/> + </xsd:all> + </xsd:complexType> + + <xsd:complexType name="shipAddress"> + <xsd:all> + <xsd:element name="name" type="xsd:string"/> + <xsd:element name="street" type="xsd:string"/> + <xsd:element name="address" type="xsd:string"/> + <xsd:element name="country" type="xsd:string"/> + </xsd:all> + </xsd:complexType> + + <xsd:complexType name="cdItems"> + <xsd:sequence> + <xsd:element name="item" type="cdItem" maxOccurs="unbounded" minOccurs="1"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="cdItem"> + <xsd:all> + <xsd:element name="title" type="xsd:string"/> + <xsd:element name="quantity" type="xsd:positiveInteger"/> + <xsd:element name="price" type="xsd:decimal"/> + </xsd:all> + </xsd:complexType> + +</xsd:schema>
\ No newline at end of file |
