1XML::DOM::DocumentType(U3s)er Contributed Perl DocumentatXiMoLn::DOM::DocumentType(3)
2
3
4
6 XML::DOM::DocumentType - An XML document type (DTD) in XML::DOM
7
9 XML::DOM::DocumentType extends XML::DOM::Node.
10
11 Each Document has a doctype attribute whose value is either null or a
12 DocumentType object. The DocumentType interface in the DOM Level 1 Core
13 provides an interface to the list of entities that are defined for the
14 document, and little else because the effect of namespaces and the var‐
15 ious XML scheme efforts on DTD representation are not clearly under‐
16 stood as of this writing. The DOM Level 1 doesn't support editing Doc‐
17 umentType nodes.
18
19 Not In DOM Spec: This implementation has added a lot of extra function‐
20 ality to the DOM Level 1 interface. To allow editing of the Document‐
21 Type nodes, see XML::DOM::ignoreReadOnly.
22
23 METHODS
24
25 getName
26 Returns the name of the DTD, i.e. the name immediately following
27 the DOCTYPE keyword.
28
29 getEntities
30 A NamedNodeMap containing the general entities, both external and
31 internal, declared in the DTD. Duplicates are discarded. For exam‐
32 ple in:
33
34 <!DOCTYPE ex SYSTEM "ex.dtd" [
35 <!ENTITY foo "foo">
36 <!ENTITY bar "bar">
37 <!ENTITY % baz "baz">
38 ]>
39 <ex/>
40
41 the interface provides access to foo and bar but not baz. Every
42 node in this map also implements the Entity interface.
43
44 The DOM Level 1 does not support editing entities, therefore enti‐
45 ties cannot be altered in any way.
46
47 Not In DOM Spec: See XML::DOM::ignoreReadOnly to edit the Document‐
48 Type etc.
49
50 getNotations
51 A NamedNodeMap containing the notations declared in the DTD.
52 Duplicates are discarded. Every node in this map also implements
53 the Notation interface.
54
55 The DOM Level 1 does not support editing notations, therefore nota‐
56 tions cannot be altered in any way.
57
58 Not In DOM Spec: See XML::DOM::ignoreReadOnly to edit the Document‐
59 Type etc.
60
61 Additional methods not in the DOM Spec
62
63 Creating and setting the DocumentType
64 A new DocumentType can be created with:
65
66 $doctype = $doc->createDocumentType ($name, $sysId, $pubId, $internal);
67
68 To set (or replace) the DocumentType for a particular document,
69 use:
70
71 $doc->setDocType ($doctype);
72
73 getSysId and setSysId (sysId)
74 Returns or sets the system id.
75
76 getPubId and setPubId (pudId)
77 Returns or sets the public id.
78
79 setName (name)
80 Sets the name of the DTD, i.e. the name immediately following the
81 DOCTYPE keyword. Note that this should always be the same as the
82 element tag name of the root element.
83
84 getAttlistDecl (elemName)
85 Returns the AttlistDecl for the Element with the specified name, or
86 undef.
87
88 getElementDecl (elemName)
89 Returns the ElementDecl for the Element with the specified name, or
90 undef.
91
92 getEntity (entityName)
93 Returns the Entity with the specified name, or undef.
94
95 addAttlistDecl (elemName)
96 Adds a new AttDecl node with the specified elemName if one doesn't
97 exist yet. Returns the AttlistDecl (new or existing) node.
98
99 addElementDecl (elemName, model)
100 Adds a new ElementDecl node with the specified elemName and model
101 if one doesn't exist yet. Returns the AttlistDecl (new or exist‐
102 ing) node. The model is ignored if one already existed.
103
104 addEntity (notationName, value, sysId, pubId, ndata, parameter)
105 Adds a new Entity node. Don't use createEntity and appendChild,
106 because it should be added to the internal NamedNodeMap containing
107 the entities.
108
109 Parameters:
110 notationName the entity name.
111 value the entity value.
112 sysId the system id (if any.)
113 pubId the public id (if any.)
114 ndata the NDATA declaration (if any, for general unparsed
115 entities.)
116 parameter whether it is a parameter entity (%ent;) or not
117 (&ent;).
118
119 SysId, pubId and ndata may be undefined.
120
121 DOMExceptions:
122
123 * INVALID_CHARACTER_ERR
124 Raised if the notationName does not conform to the XML spec.
125
126 addNotation (name, base, sysId, pubId)
127 Adds a new Notation object.
128
129 Parameters:
130 name the notation name.
131 base the base to be used for resolving a relative URI.
132 sysId the system id.
133 pubId the public id.
134
135 Base, sysId, and pubId may all be undefined. (These parameters are
136 passed by the XML::Parser Notation handler.)
137
138 DOMExceptions:
139
140 * INVALID_CHARACTER_ERR
141 Raised if the notationName does not conform to the XML spec.
142
143 addAttDef (elemName, attrName, type, default, fixed)
144 Adds a new attribute definition. It will add the AttDef node to the
145 AttlistDecl if it exists. If an AttDef with the specified attrName
146 already exists for the given elemName, this function only generates
147 a warning.
148
149 See XML::DOM::AttDef::new for the other parameters.
150
151 getDefaultAttrValue (elem, attr)
152 Returns the default attribute value as a string or undef, if none
153 is available.
154
155 Parameters:
156 elem The element tagName.
157 attr The attribute name.
158
159 expandEntity (entity [, parameter])
160 Expands the specified entity or parameter entity (if parameter=1)
161 and returns its value as a string, or undef if the entity does not
162 exist. (The entity name should not contain the '%', '&' or ';'
163 delimiters.)
164
165
166
167perl v5.8.8 2002-02-08 XML::DOM::DocumentType(3)