1XML::DOM::DocumentType(U3s)er Contributed Perl DocumentatXiMoLn::DOM::DocumentType(3)
2
3
4

NAME

6       XML::DOM::DocumentType - An XML document type (DTD) in XML::DOM
7

DESCRIPTION

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
15       various XML scheme efforts on DTD representation are not clearly
16       understood as of this writing.  The DOM Level 1 doesn't support editing
17       DocumentType nodes.
18
19       Not In DOM Spec: This implementation has added a lot of extra
20       functionality to the DOM Level 1 interface.  To allow editing of the
21       DocumentType nodes, see XML::DOM::ignoreReadOnly.
22
23   METHODS
24       getName
25           Returns the name of the DTD, i.e. the name immediately following
26           the DOCTYPE keyword.
27
28       getEntities
29           A NamedNodeMap containing the general entities, both external and
30           internal, declared in the DTD. Duplicates are discarded.  For
31           example in:
32
33            <!DOCTYPE ex SYSTEM "ex.dtd" [
34             <!ENTITY foo "foo">
35             <!ENTITY bar "bar">
36             <!ENTITY % baz "baz">
37            ]>
38            <ex/>
39
40           the interface provides access to foo and bar but not baz.  Every
41           node in this map also implements the Entity interface.
42
43           The DOM Level 1 does not support editing entities, therefore
44           entities cannot be altered in any way.
45
46           Not In DOM Spec: See XML::DOM::ignoreReadOnly to edit the
47           DocumentType etc.
48
49       getNotations
50           A NamedNodeMap containing the notations declared in the DTD.
51           Duplicates are discarded. Every node in this map also implements
52           the Notation interface.
53
54           The DOM Level 1 does not support editing notations, therefore
55           notations cannot be altered in any way.
56
57           Not In DOM Spec: See XML::DOM::ignoreReadOnly to edit the
58           DocumentType etc.
59
60   Additional methods not in the DOM Spec
61       Creating and setting the DocumentType
62           A new DocumentType can be created with:
63
64                   $doctype = $doc->createDocumentType ($name, $sysId, $pubId, $internal);
65
66           To set (or replace) the DocumentType for a particular document,
67           use:
68
69                   $doc->setDocType ($doctype);
70
71       getSysId and setSysId (sysId)
72           Returns or sets the system id.
73
74       getPubId and setPubId (pudId)
75           Returns or sets the public id.
76
77       setName (name)
78           Sets the name of the DTD, i.e. the name immediately following the
79           DOCTYPE keyword. Note that this should always be the same as the
80           element tag name of the root element.
81
82       getAttlistDecl (elemName)
83           Returns the AttlistDecl for the Element with the specified name, or
84           undef.
85
86       getElementDecl (elemName)
87           Returns the ElementDecl for the Element with the specified name, or
88           undef.
89
90       getEntity (entityName)
91           Returns the Entity with the specified name, or undef.
92
93       addAttlistDecl (elemName)
94           Adds a new AttDecl node with the specified elemName if one doesn't
95           exist yet.  Returns the AttlistDecl (new or existing) node.
96
97       addElementDecl (elemName, model)
98           Adds a new ElementDecl node with the specified elemName and model
99           if one doesn't exist yet.  Returns the AttlistDecl (new or
100           existing) node. The model is ignored if one already existed.
101
102       addEntity (notationName, value, sysId, pubId, ndata, parameter)
103           Adds a new Entity node. Don't use createEntity and appendChild,
104           because it should be added to the internal NamedNodeMap containing
105           the entities.
106
107           Parameters:
108            notationName the entity name.
109            value        the entity value.
110            sysId        the system id (if any.)
111            pubId        the public id (if any.)
112            ndata        the NDATA declaration (if any, for general unparsed
113           entities.)
114            parameter      whether it is a parameter entity (%ent;) or not
115           (&ent;).
116
117           SysId, pubId and ndata may be undefined.
118
119           DOMExceptions:
120
121           •   INVALID_CHARACTER_ERR
122
123               Raised if the notationName does not conform to the XML spec.
124
125       addNotation (name, base, sysId, pubId)
126           Adds a new Notation object.
127
128           Parameters:
129            name   the notation name.
130            base   the base to be used for resolving a relative URI.
131            sysId  the system id.
132            pubId  the public id.
133
134           Base, sysId, and pubId may all be undefined.  (These parameters are
135           passed by the XML::Parser Notation handler.)
136
137           DOMExceptions:
138
139           •   INVALID_CHARACTER_ERR
140
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.34.0                      2022-01-21         XML::DOM::DocumentType(3)
Impressum