.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man v6.0.2 (Pod::Simple 3.48) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 .\" .\" Required to disable full justification in groff 1.23.0. .if n .ds AD l .\" ======================================================================== .\" .IX Title "XML::Generator::DOM 3" .TH XML::Generator::DOM 3 2026-08-20 "perl v5.44.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::Generator::DOM \- XML::Generator subclass for producing DOM trees instead of strings. .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use XML::Generator::DOM; \& \& my $dg = XML::Generator::DOM\->new(); \& my $doc = $dg\->xml($dg\->xmlcmnt("Test document."), \& $dg\->foo({\*(Aqbaz\*(Aq => \*(Aqbam\*(Aq}, 42)); \& print $doc\->toString; .Ve .PP yields: .PP .Vb 3 \& \& \& 42 .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" XML::Generator::DOM subclasses XML::Generator in order to produce DOM trees instead of strings (see XML::Generator and XML::DOM). This module is still experimental and its semantics might change. .PP Essentially, tag methods return XML::DOM::DocumentFragment objects, constructed either from a DOM document passed into the constructor or a default document that XML::Generator::DOM will automatically construct. .PP Calling the \fBxml()\fR method will return this automatically constructed document and cause a fresh one to be constructed for future tag method calls. If you passed in your own document, you may not call the \fBxml()\fR method. .PP Below, we just note the remaining differences in semantics between XML::Generator methods and XML::Generator::DOM methods. .SH LICENSE .IX Header "LICENSE" This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. .SH CONSTRUCTOR .IX Header "CONSTRUCTOR" These configuration options are accepted but have no effect on the semantics of the returned object: escape, pretty, conformance and empty. .SH "TAG METHODS" .IX Header "TAG METHODS" Subsequently, tag method semantics are somewhat different for this module compared to XML::Generator. The primary difference is that tag method return XML::DOM::DocumentFragment objects. Namespace and attribute processing remains the same, but remaining arguments to tag methods must either be text or other XML::DOM::DocumentFragment objects. No escape processing, syntax checking, or output control is done; this is all left up to XML::DOM. .SH "SPECIAL TAGS" .IX Header "SPECIAL TAGS" All special tags are available by default with XML::Generator::DOM; you don\*(Aqt need to use \*(Aqconformance\*(Aq => \*(Aqstrict\*(Aq. .SS xmlpi(@args) .IX Subsection "xmlpi(@args)" Arguments will simply be concatenated and passed as the data to the XML::DOM::ProcessingInstruction object that is returned. .SS xmlcmnt .IX Subsection "xmlcmnt" Escaping of \*(Aq\-\-\*(Aq is done by XML::DOM::Comment, which replaces both hyphens with \*(Aq-\*(Aq. An XML::DOM::Comment object is returned. .SS xmldecl .IX Subsection "xmldecl" Returns an XML::DOM::XMLDecl object. Respects \*(Aqversion\*(Aq, \*(Aqencoding\*(Aq and \*(Aqdtd\*(Aq settings in the object. .SS xmldecl .IX Subsection "xmldecl" Returns an XML::DOM::DocumentType object. .SS xmlcdata .IX Subsection "xmlcdata" Returns an XML::DOM::CDATASection object. .SS xml .IX Subsection "xml" As described above, \fBxml()\fR can only be used when dom_document was not set in the object. The automatically created document will have its XML Declaration set and the arguments to \fBxml()\fR will be appended to it. Then a new DOM document is automatically generated and the old one is returned. This is the only way to get a DOM document from this module.