| 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 | <html> |
| 3 | <head> |
| 4 | <link rel="STYLESHEET" href="lib.css" type='text/css' /> |
| 5 | <link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" /> |
| 6 | <link rel='start' href='../index.html' title='Python Documentation Index' /> |
| 7 | <link rel="first" href="lib.html" title='Python Library Reference' /> |
| 8 | <link rel='contents' href='contents.html' title="Contents" /> |
| 9 | <link rel='index' href='genindex.html' title='Index' /> |
| 10 | <link rel='last' href='about.html' title='About this document...' /> |
| 11 | <link rel='help' href='about.html' title='About this document...' /> |
| 12 | <link rel="next" href="dom-element-objects.html" /> |
| 13 | <link rel="prev" href="dom-documenttype-objects.html" /> |
| 14 | <link rel="parent" href="node652.html" /> |
| 15 | <link rel="next" href="dom-element-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>13.6.2.5 Document Objects </title> |
| 18 | </head> |
| 19 | <body> |
| 20 | <DIV CLASS="navigation"> |
| 21 | <div id='top-navigation-panel' xml:id='top-navigation-panel'> |
| 22 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 23 | <tr> |
| 24 | <td class='online-navigation'><a rel="prev" title="13.6.2.4 DocumentType Objects" |
| 25 | href="dom-documenttype-objects.html"><img src='../icons/previous.png' |
| 26 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 27 | <td class='online-navigation'><a rel="parent" title="13.6.2 Objects in the" |
| 28 | href="node652.html"><img src='../icons/up.png' |
| 29 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 30 | <td class='online-navigation'><a rel="next" title="13.6.2.6 Element Objects" |
| 31 | href="dom-element-objects.html"><img src='../icons/next.png' |
| 32 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 33 | <td align="center" width="100%">Python Library Reference</td> |
| 34 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 35 | href="contents.html"><img src='../icons/contents.png' |
| 36 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 37 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 38 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 39 | <td class='online-navigation'><a rel="index" title="Index" |
| 40 | href="genindex.html"><img src='../icons/index.png' |
| 41 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 42 | </tr></table> |
| 43 | <div class='online-navigation'> |
| 44 | <b class="navlabel">Previous:</b> |
| 45 | <a class="sectref" rel="prev" href="dom-documenttype-objects.html">13.6.2.4 DocumentType Objects</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="node652.html">13.6.2 Objects in the</A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="dom-element-objects.html">13.6.2.6 Element Objects</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H3><A NAME="SECTION0015625000000000000000"></A><A NAME="dom-document-objects"></A> |
| 56 | <BR> |
| 57 | 13.6.2.5 Document Objects |
| 58 | </H3> |
| 59 | |
| 60 | <P> |
| 61 | A <tt class="class">Document</tt> represents an entire XML document, including its |
| 62 | constituent elements, attributes, processing instructions, comments |
| 63 | etc. Remeber that it inherits properties from <tt class="class">Node</tt>. |
| 64 | |
| 65 | <P> |
| 66 | <dl><dt><b><tt id='l2h-4393' xml:id='l2h-4393' class="member">documentElement</tt></b></dt> |
| 67 | <dd> |
| 68 | The one and only root element of the document. |
| 69 | </dl> |
| 70 | |
| 71 | <P> |
| 72 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 73 | <td><nobr><b><tt id='l2h-4394' xml:id='l2h-4394' class="method">createElement</tt></b>(</nobr></td> |
| 74 | <td><var>tagName</var>)</td></tr></table></dt> |
| 75 | <dd> |
| 76 | Create and return a new element node. The element is not inserted |
| 77 | into the document when it is created. You need to explicitly insert |
| 78 | it with one of the other methods such as <tt class="method">insertBefore()</tt> or |
| 79 | <tt class="method">appendChild()</tt>. |
| 80 | </dl> |
| 81 | |
| 82 | <P> |
| 83 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 84 | <td><nobr><b><tt id='l2h-4395' xml:id='l2h-4395' class="method">createElementNS</tt></b>(</nobr></td> |
| 85 | <td><var>namespaceURI, tagName</var>)</td></tr></table></dt> |
| 86 | <dd> |
| 87 | Create and return a new element with a namespace. The |
| 88 | <var>tagName</var> may have a prefix. The element is not inserted into the |
| 89 | document when it is created. You need to explicitly insert it with |
| 90 | one of the other methods such as <tt class="method">insertBefore()</tt> or |
| 91 | <tt class="method">appendChild()</tt>. |
| 92 | </dl> |
| 93 | |
| 94 | <P> |
| 95 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 96 | <td><nobr><b><tt id='l2h-4396' xml:id='l2h-4396' class="method">createTextNode</tt></b>(</nobr></td> |
| 97 | <td><var>data</var>)</td></tr></table></dt> |
| 98 | <dd> |
| 99 | Create and return a text node containing the data passed as a |
| 100 | parameter. As with the other creation methods, this one does not |
| 101 | insert the node into the tree. |
| 102 | </dl> |
| 103 | |
| 104 | <P> |
| 105 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 106 | <td><nobr><b><tt id='l2h-4397' xml:id='l2h-4397' class="method">createComment</tt></b>(</nobr></td> |
| 107 | <td><var>data</var>)</td></tr></table></dt> |
| 108 | <dd> |
| 109 | Create and return a comment node containing the data passed as a |
| 110 | parameter. As with the other creation methods, this one does not |
| 111 | insert the node into the tree. |
| 112 | </dl> |
| 113 | |
| 114 | <P> |
| 115 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 116 | <td><nobr><b><tt id='l2h-4398' xml:id='l2h-4398' class="method">createProcessingInstruction</tt></b>(</nobr></td> |
| 117 | <td><var>target, data</var>)</td></tr></table></dt> |
| 118 | <dd> |
| 119 | Create and return a processing instruction node containing the |
| 120 | <var>target</var> and <var>data</var> passed as parameters. As with the other |
| 121 | creation methods, this one does not insert the node into the tree. |
| 122 | </dl> |
| 123 | |
| 124 | <P> |
| 125 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 126 | <td><nobr><b><tt id='l2h-4399' xml:id='l2h-4399' class="method">createAttribute</tt></b>(</nobr></td> |
| 127 | <td><var>name</var>)</td></tr></table></dt> |
| 128 | <dd> |
| 129 | Create and return an attribute node. This method does not associate |
| 130 | the attribute node with any particular element. You must use |
| 131 | <tt class="method">setAttributeNode()</tt> on the appropriate <tt class="class">Element</tt> object |
| 132 | to use the newly created attribute instance. |
| 133 | </dl> |
| 134 | |
| 135 | <P> |
| 136 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 137 | <td><nobr><b><tt id='l2h-4400' xml:id='l2h-4400' class="method">createAttributeNS</tt></b>(</nobr></td> |
| 138 | <td><var>namespaceURI, qualifiedName</var>)</td></tr></table></dt> |
| 139 | <dd> |
| 140 | Create and return an attribute node with a namespace. The |
| 141 | <var>tagName</var> may have a prefix. This method does not associate the |
| 142 | attribute node with any particular element. You must use |
| 143 | <tt class="method">setAttributeNode()</tt> on the appropriate <tt class="class">Element</tt> object |
| 144 | to use the newly created attribute instance. |
| 145 | </dl> |
| 146 | |
| 147 | <P> |
| 148 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 149 | <td><nobr><b><tt id='l2h-4401' xml:id='l2h-4401' class="method">getElementsByTagName</tt></b>(</nobr></td> |
| 150 | <td><var>tagName</var>)</td></tr></table></dt> |
| 151 | <dd> |
| 152 | Search for all descendants (direct children, children's children, |
| 153 | etc.) with a particular element type name. |
| 154 | </dl> |
| 155 | |
| 156 | <P> |
| 157 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 158 | <td><nobr><b><tt id='l2h-4402' xml:id='l2h-4402' class="method">getElementsByTagNameNS</tt></b>(</nobr></td> |
| 159 | <td><var>namespaceURI, localName</var>)</td></tr></table></dt> |
| 160 | <dd> |
| 161 | Search for all descendants (direct children, children's children, |
| 162 | etc.) with a particular namespace URI and localname. The localname is |
| 163 | the part of the namespace after the prefix. |
| 164 | </dl> |
| 165 | |
| 166 | <P> |
| 167 | |
| 168 | <DIV CLASS="navigation"> |
| 169 | <div class='online-navigation'> |
| 170 | <p></p><hr /> |
| 171 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 172 | <tr> |
| 173 | <td class='online-navigation'><a rel="prev" title="13.6.2.4 DocumentType Objects" |
| 174 | href="dom-documenttype-objects.html"><img src='../icons/previous.png' |
| 175 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 176 | <td class='online-navigation'><a rel="parent" title="13.6.2 Objects in the" |
| 177 | href="node652.html"><img src='../icons/up.png' |
| 178 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 179 | <td class='online-navigation'><a rel="next" title="13.6.2.6 Element Objects" |
| 180 | href="dom-element-objects.html"><img src='../icons/next.png' |
| 181 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 182 | <td align="center" width="100%">Python Library Reference</td> |
| 183 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 184 | href="contents.html"><img src='../icons/contents.png' |
| 185 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 186 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 187 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 188 | <td class='online-navigation'><a rel="index" title="Index" |
| 189 | href="genindex.html"><img src='../icons/index.png' |
| 190 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 191 | </tr></table> |
| 192 | <div class='online-navigation'> |
| 193 | <b class="navlabel">Previous:</b> |
| 194 | <a class="sectref" rel="prev" href="dom-documenttype-objects.html">13.6.2.4 DocumentType Objects</A> |
| 195 | <b class="navlabel">Up:</b> |
| 196 | <a class="sectref" rel="parent" href="node652.html">13.6.2 Objects in the</A> |
| 197 | <b class="navlabel">Next:</b> |
| 198 | <a class="sectref" rel="next" href="dom-element-objects.html">13.6.2.6 Element Objects</A> |
| 199 | </div> |
| 200 | </div> |
| 201 | <hr /> |
| 202 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 203 | </DIV> |
| 204 | <!--End of Navigation Panel--> |
| 205 | <ADDRESS> |
| 206 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 207 | </ADDRESS> |
| 208 | </BODY> |
| 209 | </HTML> |