1DOM(3)                User Contributed Perl Documentation               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

CONSTRUCTOR

41       These configuration options are accepted but have no effect on the
42       semantics of the returned object: escape, pretty, conformance and
43       empty.
44

TAG METHODS

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

SPECIAL TAGS

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