1--TEST--
2DOMDocumentType: basic access to all properties.
3--CREDITS--
4Eric Lee Stewart <ericleestewart@gmail.com>
5# TestFest Atlanta 2009-05-25
6--EXTENSIONS--
7dom
8--FILE--
9<?php
10// Access publicId, systemId, name, internalSubset all with values.
11$xml  = '<?xml version="1.0" encoding="UTF-8" ?>';
12$xml .= '<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML//EN" "docbookx.dtd">';
13$xml .= '<chapter>1</chapter>';
14$doc = new DOMDocument();
15$doc->loadXML($xml);
16$doctype = $doc->doctype;
17print "publicId: ".$doctype->publicId."\n";
18print "systemId: ".$doctype->systemId."\n";
19print "name: ".$doctype->name."\n";
20print "internalSubset: ".$doctype->internalSubset."\n";
21
22
23// Access entities and notations with values.
24$xml  = '<?xml version="1.0" encoding="UTF-8" ?>';
25$xml .= '<!DOCTYPE img [';
26$xml .= '  <!ELEMENT img EMPTY>';
27$xml .= '  <!ATTLIST img src ENTITY #REQUIRED>';
28$xml .= '  <!ENTITY logo SYSTEM "http://www.xmlwriter.net/logo.gif" NDATA gif>';
29$xml .= '  <!NOTATION gif PUBLIC "gif viewer">';
30$xml .= ']>';
31$xml .= '<img src="logo"/>';
32$doc = new DOMDocument();
33$doc->loadXML($xml);
34$doctype = $doc->doctype;
35$entities = $doctype->entities;
36$entity = $entities->item(0);
37print 'entity: '.$entity->nodeName."\n";
38$notations = $doctype->notations;
39$notation = $notations->item(0);
40print 'notation: '.$notation->nodeName."\n";
41?>
42--EXPECT--
43publicId: -//OASIS//DTD DocBook XML//EN
44systemId: docbookx.dtd
45name: chapter
46internalSubset:
47entity: logo
48notation: gif
49