Debian Codegraph @

example/test.html

raw symbols SCIP
1 <HTML>
2 <HEAD>
3 <TITLE>XML::LibXML::Document - DOM Document Class</TITLE>
4 <LINK REV="made" HREF="mailto:[email protected]">
5 </HEAD>
6
7 <BODY>
8
9 <!-- INDEX BEGIN -->
10
11 <UL>
12
13 <LI><A HREF="#NAME">NAME</A>
14 <LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
15 <LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
16 <UL>
17
18 <LI><A HREF="#Methods">Methods</A>
19 </UL>
20
21 <LI><A HREF="#SEE_ALSO">SEE ALSO</A>
22 <LI><A HREF="#VERSION">VERSION</A>
23 </UL>
24 <!-- INDEX END -->
25
26 <HR>
27 <P>
28 <H1><A NAME="NAME">NAME</A></H1>
29 <P>
30 XML::LibXML::Document - DOM Document Class
31
32 <P>
33 <HR>
34 <H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
35 <P>
36 <PRE> use XML::LibXML::Document;
37 </PRE>
38 <P>
39 <PRE> $dom = XML::LibXML::Document-&gt;new( $version, $encoding );
40 $dom = XML::LibXML::Document-&gt;createDocument( $version, $encoding );
41 $strEncoding = $doc-&gt;getEncoding();
42 $strVersion = $doc-&gt;getVersion();
43 $docstring = $dom-&gt;toString([$format]);
44 $bool = $dom-&gt;is_valid();
45 $root = $dom-&gt;getDocumentElement($name, $namespace );
46 $dom-&gt;setDocumentElement( $root );
47 $element = $dom-&gt;createElement( $nodename );
48 $element = $dom-&gt;createElementNS( $namespaceURI, $qname );
49 $text = $dom-&gt;createTextNode( $content_text );
50 $comment = $dom-&gt;createComment( $comment_text );
51 $attrnode = $doc-&gt;createAttribute($name [,$value]);
52 $attrnode = $doc-&gt;createAttributeNS( namespaceURI, $name [,$value] );
53 $cdata = $dom-&gt;create( $cdata_content );
54 $document-&gt;importNode( $node [, $move] );
55 </PRE>
56 <P>
57 <HR>
58 <H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
59 <P>
60 The Document Class is the result of a parsing process. But sometimes it is
61 necessary to create a Document from scratch. The DOM Document Class
62 provides functions that are conform to the DOM Core naming style. It
63 inherits all functions from <EM>XML::LibXML::Node</EM> as specified in DOM Level2. This enables to access the nodes beside the
64 root element on document level - a <EM>DTD</EM> for example. The support for these nodes is limited at the moment, so I
65 would recommend, not to use <EM>node</EM> functions on <EM>documents</EM>. It is suggested that one should always create a node not bound to any
66 document. There is no need of really including the node to the document,
67 but once the node is bound to a document, it is quite safe that all strings
68 have the correct encoding. If an unbound textnode with an iso encoded
69 string is created (e.g. with $CLASS-&gt;new()), the <EM>toString</EM> function may not return the expected result. This seems like a limitation
70 as long UTF8 encoding is assured. If iso encoded strings come into play it
71 is much safer to use the node creation functions of <STRONG>XML::LibXML::Document</STRONG>.
72
73 <P>
74 <HR>
75 <H2><A NAME="Methods">Methods</A></H2>
76 <DL>
77 <DT><STRONG><A NAME="item_new">new</A></STRONG><DD>
78 <P>
79 alias for <CODE>createDocument()</CODE>
80
81 <DT><STRONG><A NAME="item_createDocument">createDocument</A></STRONG><DD>
82 <P>
83 The constructor for the document class. As Parameter it takes the version
84 string and (optionally) the ecoding string. Simply calling <STRONG>createDocument</STRONG> will create the document:
85
86 <P>
87 <PRE>
88 &lt;?xml version=&quot;your version&quot; encoding=&quot;your encoding&quot;?&gt;
89 </PRE>
90 <P>
91 Both parameter are optional. The default value for <STRONG>$version</STRONG> is <EM>1.0</EM> , of course. If the <STRONG>$encoding</STRONG> parameter is not set, the encoding will be left unset, which means UTF8 is
92 implied (and set). The call of <STRONG>createDocument</STRONG> without any parameter will result the following code:
93
94 <P>
95 <PRE>
96 &lt;?xml version=&quot;1.0&quot;?&gt;
97 </PRE>
98 <DT><STRONG><A NAME="item_getEncoding">getEncoding</A></STRONG><DD>
99 <P>
100 returns the encoding string of the document
101
102 <DT><STRONG><A NAME="item_getVersion">getVersion</A></STRONG><DD>
103 <P>
104 returns the version string of the document
105
106 <DT><STRONG><A NAME="item_toString">toString</A></STRONG><DD>
107 <P>
108 <STRONG>toString</STRONG> is a deparsing function, so the DOM Tree can be translated into a string,
109 ready for output. The optional <STRONG>$format</STRONG> parameter sets the indenting of the output. This parameter is expected to
110 be an <EM>integer</EM> value, that specifies the number of linebreaks for each node. For more
111 information about the formatted output check the documentation of <EM>xmlDocDumpFormatMemory</EM> in <EM>libxml2/tree.h</EM> .
112
113 <DT><STRONG><A NAME="item_is_valid">is_valid</A></STRONG><DD>
114 <P>
115 Returns either TRUE or FALSE depending on the DOM Tree is a valid Document
116 or not.
117
118 <DT><STRONG><A NAME="item_getDocumentElement">getDocumentElement</A></STRONG><DD>
119 <P>
120 Returns the root element of the Document. A document can have just one root
121 element to contain the documents data.
122
123 <DT><STRONG><A NAME="item_setDocumentElement">setDocumentElement</A></STRONG><DD>
124 <P>
125 This function enables you to set the root element for a document. The
126 function supports the import of a node from a different document tree.
127
128 <DT><STRONG><A NAME="item_createElement">createElement</A></STRONG><DD>
129 <P>
130 This function creates a new Element Node bound to the DOM with the name <EM>$nodename</EM> .
131
132 <DT><STRONG><A NAME="item_createElementNS">createElementNS</A></STRONG><DD>
133 <P>
134 This function creates a new Element Node bound to the DOM with the name <EM>$nodename</EM> and placed in the given namespace.
135
136 <DT><STRONG><A NAME="item_createTextNode">createTextNode</A></STRONG><DD>
137 <P>
138 As an equivalent of <STRONG>createElement</STRONG> , but it creates a <STRONG>Text Node</STRONG> bound to the DOM.
139
140 <DT><STRONG><A NAME="item_createComment">createComment</A></STRONG><DD>
141 <P>
142 As an equivalent of <STRONG>createElement</STRONG> , but it creates a <STRONG>Comment Node</STRONG> bound to the DOM.
143
144 <DT><STRONG><A NAME="item_createAttribute">createAttribute</A></STRONG><DD>
145 <P>
146 Creates a new Attribute node. This function is rather useless at the
147 moment, since there is no setAttributeNode function defined in <EM>XML::LibXML::Element</EM> , yet.
148
149 <DT><STRONG><A NAME="item_createAttributeNS">createAttributeNS</A></STRONG><DD>
150 <P>
151 Creates an Attribute bound to a namespace.
152
153 <DT><STRONG><A NAME="item_createCDATASection">createCDATASection</A></STRONG><DD>
154 <P>
155 Similar to createTextNode and createComment, this function creates a
156 CDataSection bound to the current DOM.
157
158 <DT><STRONG><A NAME="item_importNode">importNode</A></STRONG><DD>
159 <P>
160 If a node is not part of a document, it can be imported to another
161 document. As specified in DOM Level 2 Specification the Node will not be
162 altered or removed from its original document by default. ( <EM>$node-</EM><CODE>cloneNode(1)&gt;</CODE> will get called implicitly). Sometimes it is
163 necessary to <EM>move</EM> a node between documents. In such a case the node will not be copied, but
164 removed from the original document.
165
166 </DL>
167 <P>
168 <HR>
169 <H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
170 <P>
171 XML::LibXML, XML::LibXML::Element, XML::LibXML::Text, XML::LibXML::Attr,
172 XML::LibXML::Comment
173
174 <P>
175 <HR>
176 <H1><A NAME="VERSION">VERSION</A></H1>
177 <P>
178 0.90_a
179
180 </BODY>
181
182 </HTML>