.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::DOM::DocumentType 3pm" .TH XML::DOM::DocumentType 3pm "2022-10-14" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" XML::DOM::DocumentType \- An XML document type (DTD) in XML::DOM .SH "DESCRIPTION" .IX Header "DESCRIPTION" XML::DOM::DocumentType extends XML::DOM::Node. .PP Each Document has a doctype attribute whose value is either null or a DocumentType object. The DocumentType interface in the \s-1DOM\s0 Level 1 Core provides an interface to the list of entities that are defined for the document, and little else because the effect of namespaces and the various \s-1XML\s0 scheme efforts on \s-1DTD\s0 representation are not clearly understood as of this writing. The \s-1DOM\s0 Level 1 doesn't support editing DocumentType nodes. .PP \&\fBNot In \s-1DOM\s0 Spec\fR: This implementation has added a lot of extra functionality to the \s-1DOM\s0 Level 1 interface. To allow editing of the DocumentType nodes, see XML::DOM::ignoreReadOnly. .SS "\s-1METHODS\s0" .IX Subsection "METHODS" .IP "getName" 4 .IX Item "getName" Returns the name of the \s-1DTD,\s0 i.e. the name immediately following the \&\s-1DOCTYPE\s0 keyword. .IP "getEntities" 4 .IX Item "getEntities" A NamedNodeMap containing the general entities, both external and internal, declared in the \s-1DTD.\s0 Duplicates are discarded. For example in: .Sp .Vb 6 \& \& \& \& ]> \& .Ve .Sp the interface provides access to foo and bar but not baz. Every node in this map also implements the Entity interface. .Sp The \s-1DOM\s0 Level 1 does not support editing entities, therefore entities cannot be altered in any way. .Sp \&\fBNot In \s-1DOM\s0 Spec\fR: See XML::DOM::ignoreReadOnly to edit the DocumentType etc. .IP "getNotations" 4 .IX Item "getNotations" A NamedNodeMap containing the notations declared in the \s-1DTD.\s0 Duplicates are discarded. Every node in this map also implements the Notation interface. .Sp The \s-1DOM\s0 Level 1 does not support editing notations, therefore notations cannot be altered in any way. .Sp \&\fBNot In \s-1DOM\s0 Spec\fR: See XML::DOM::ignoreReadOnly to edit the DocumentType etc. .SS "Additional methods not in the \s-1DOM\s0 Spec" .IX Subsection "Additional methods not in the DOM Spec" .IP "Creating and setting the DocumentType" 4 .IX Item "Creating and setting the DocumentType" A new DocumentType can be created with: .Sp .Vb 1 \& $doctype = $doc\->createDocumentType ($name, $sysId, $pubId, $internal); .Ve .Sp To set (or replace) the DocumentType for a particular document, use: .Sp .Vb 1 \& $doc\->setDocType ($doctype); .Ve .IP "getSysId and setSysId (sysId)" 4 .IX Item "getSysId and setSysId (sysId)" Returns or sets the system id. .IP "getPubId and setPubId (pudId)" 4 .IX Item "getPubId and setPubId (pudId)" Returns or sets the public id. .IP "setName (name)" 4 .IX Item "setName (name)" Sets the name of the \s-1DTD,\s0 i.e. the name immediately following the \&\s-1DOCTYPE\s0 keyword. Note that this should always be the same as the element tag name of the root element. .IP "getAttlistDecl (elemName)" 4 .IX Item "getAttlistDecl (elemName)" Returns the AttlistDecl for the Element with the specified name, or undef. .IP "getElementDecl (elemName)" 4 .IX Item "getElementDecl (elemName)" Returns the ElementDecl for the Element with the specified name, or undef. .IP "getEntity (entityName)" 4 .IX Item "getEntity (entityName)" Returns the Entity with the specified name, or undef. .IP "addAttlistDecl (elemName)" 4 .IX Item "addAttlistDecl (elemName)" Adds a new AttDecl node with the specified elemName if one doesn't exist yet. Returns the AttlistDecl (new or existing) node. .IP "addElementDecl (elemName, model)" 4 .IX Item "addElementDecl (elemName, model)" Adds a new ElementDecl node with the specified elemName and model if one doesn't exist yet. Returns the AttlistDecl (new or existing) node. The model is ignored if one already existed. .IP "addEntity (notationName, value, sysId, pubId, ndata, parameter)" 4 .IX Item "addEntity (notationName, value, sysId, pubId, ndata, parameter)" Adds a new Entity node. Don't use createEntity and appendChild, because it should be added to the internal NamedNodeMap containing the entities. .Sp Parameters: \fInotationName\fR the entity name. \fIvalue\fR the entity value. \fIsysId\fR the system id (if any.) \fIpubId\fR the public id (if any.) \fIndata\fR the \s-1NDATA\s0 declaration (if any, for general unparsed entities.) \fIparameter\fR whether it is a parameter entity (%ent;) or not (&ent;). .Sp SysId, pubId and ndata may be undefined. .Sp DOMExceptions: .RS 4 .IP "\(bu" 4 \&\s-1INVALID_CHARACTER_ERR\s0 .Sp Raised if the notationName does not conform to the \s-1XML\s0 spec. .RE .RS 4 .RE .IP "addNotation (name, base, sysId, pubId)" 4 .IX Item "addNotation (name, base, sysId, pubId)" Adds a new Notation object. .Sp Parameters: \fIname\fR the notation name. \fIbase\fR the base to be used for resolving a relative \s-1URI.\s0 \fIsysId\fR the system id. \fIpubId\fR the public id. .Sp Base, sysId, and pubId may all be undefined. (These parameters are passed by the XML::Parser Notation handler.) .Sp DOMExceptions: .RS 4 .IP "\(bu" 4 \&\s-1INVALID_CHARACTER_ERR\s0 .Sp Raised if the notationName does not conform to the \s-1XML\s0 spec. .RE .RS 4 .RE .IP "addAttDef (elemName, attrName, type, default, fixed)" 4 .IX Item "addAttDef (elemName, attrName, type, default, fixed)" Adds a new attribute definition. It will add the AttDef node to the AttlistDecl if it exists. If an AttDef with the specified attrName already exists for the given elemName, this function only generates a warning. .Sp See XML::DOM::AttDef::new for the other parameters. .IP "getDefaultAttrValue (elem, attr)" 4 .IX Item "getDefaultAttrValue (elem, attr)" Returns the default attribute value as a string or undef, if none is available. .Sp Parameters: \fIelem\fR The element tagName. \fIattr\fR The attribute name. .IP "expandEntity (entity [, parameter])" 4 .IX Item "expandEntity (entity [, parameter])" Expands the specified entity or parameter entity (if parameter=1) and returns its value as a string, or undef if the entity does not exist. (The entity name should not contain the '%', '&' or ';' delimiters.)