1XML::Generator::DOM(3)User Contributed Perl DocumentationXML::Generator::DOM(3)
2
3
4

NAME

6       XML::Generator::DOM - XML::Generator subclass for producing DOM trees
7       instead of strings.
8

SYNOPSIS

10               use XML::Generator::DOM;
11
12               my $dg  = XML::Generator::DOM->new();
13               my $doc = $dg->xml($dg->xmlcmnt("Test document."),
14                                  $dg->foo({'baz' => 'bam'}, 42));
15               print $doc->toString;
16
17       yields:
18
19               <?xml version="1.0" standalone="yes"?>
20               <!--Test document-->
21               <foo baz="bam">42</foo>
22

DESCRIPTION

24       XML::Generator::DOM subclasses XML::Generator in order to produce DOM
25       trees instead of strings (see XML::Generator and XML::DOM).  This
26       module is still experimental and its semantics might change.
27
28       Essentially, tag methods return XML::DOM::DocumentFragment objects,
29       constructed either from a DOM document passed into the constructor or a
30       default document that XML::Generator::DOM will automatically construct.
31
32       Calling the xml() method will return this automatically constructed
33       document and cause a fresh one to be constructed for future tag method
34       calls.  If you passed in your own document, you may not call the xml()
35       method.
36
37       Below, we just note the remaining differences in semantics between
38       XML::Generator methods and XML::Generator::DOM methods.
39

LICENSE

41       This library is free software, you can redistribute it and/or modify it
42       under the same terms as Perl itself.
43

CONSTRUCTOR

45       These configuration options are accepted but have no effect on the
46       semantics of the returned object: escape, pretty, conformance and
47       empty.
48

TAG METHODS

50       Subsequently, tag method semantics are somewhat different for this
51       module compared to XML::Generator.  The primary difference is that tag
52       method return XML::DOM::DocumentFragment objects.  Namespace and
53       attribute processing remains the same, but remaining arguments to tag
54       methods must either be text or other XML::DOM::DocumentFragment
55       objects.  No escape processing, syntax checking, or output control is
56       done; this is all left up to XML::DOM.
57

SPECIAL TAGS

59       All special tags are available by default with XML::Generator::DOM; you
60       don't need to use 'conformance' => 'strict'.
61
62   xmlpi(@args)
63       Arguments will simply be concatenated and passed as the data to the
64       XML::DOM::ProcessingInstruction object that is returned.
65
66   xmlcmnt
67       Escaping of '--' is done by XML::DOM::Comment, which replaces both
68       hyphens with '&#45;'.  An XML::DOM::Comment object is returned.
69
70   xmldecl
71       Returns an XML::DOM::XMLDecl object.  Respects 'version', 'encoding'
72       and 'dtd' settings in the object.
73
74   xmldecl
75       Returns an XML::DOM::DocumentType object.
76
77   xmlcdata
78       Returns an XML::DOM::CDATASection object.
79
80   xml
81       As described above, xml() can only be used when dom_document was not
82       set in the object.  The automatically created document will have its
83       XML Declaration set and the arguments to xml() will be appended to it.
84       Then a new DOM document is automatically generated and the old one is
85       returned.  This is the only way to get a DOM document from this module.
86
87
88
89perl v5.34.0                      2022-02-21            XML::Generator::DOM(3)
Impressum