1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<STYLE TYPE="text/css">@import "style.css";</STYLE>
</HEAD>
<BODY>
<H1>class Document</H1>
<B>Extends </B>Element<HR>
Represents a full XML document, including PIs, a doctype, etc. A Document has a single child that can be accessed by root(). Note that if you want to have an XML declaration written for a document you create, you must add one; REXML documents do not write a default declaration for you. See |DECLARATION| and |write|.
<H2>Methods</H2>
<UL>
<LI>
<A HREF="#NE">add</A>
</LI>
<LI>
<A HREF="#N17">add_element</A>
</LI>
<LI>
<A HREF="#NA">clone</A>
</LI>
<LI>
<A HREF="#N21">doc_type</A>
</LI>
<LI>
<A HREF="#N48">Document</A>
</LI>
<LI>
<A HREF="#N36">encoding</A>
</LI>
<LI>
<A HREF="#N6">initialize</A>
</LI>
<LI>
<A HREF="#N4C">parse</A>
</LI>
<LI>
<A HREF="#N1A">root</A>
</LI>
<LI>
<A HREF="#N3D">stand_alone</A>
</LI>
<LI>
<A HREF="#N2F">version</A>
</LI>
<LI>
<A HREF="#N44">write</A>
</LI>
<LI>
<A HREF="#N28">xml_decl</A>
</LI>
</UL>
<HR>
<H2>Aliases</H2>
<DIV CLASS="alias">
<H3><<</H3>
is a synonym for
<H3>add</H3>
</DIV>
<H2>Methods</H2>
<DIV CLASS="method">
<A NAME="NE">
<H3>add</H3>
</A>
<HR>
We override this, because XMLDecls and DocTypes must go at the start of the document
</DIV>
<DIV CLASS="method">
<A NAME="N17">
<H3>add_element</H3>
</A>
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="NA">
<H3>clone</H3>
</A>
<HR>
Should be obvious
</DIV>
<DIV CLASS="method">
<A NAME="N21">
<H3>doc_type</H3>
</A><B style="padding-right: 1em;">Returns</B>
the DocType child of the document, if one exists, and nil otherwise.
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N48">
<H3>Document</H3>
</A>
<HR>
Stream parser. The source will be parsed as a Stream. If a block is supplied, yield will be called for tag starts, ends, and text. If a listener is supplied, the listener will also be notified, by calling the appropriate methods on events. The arguments to the block will be: IF TAG START: "tag name", { attributes } (possibly empty) IF TEXT: "text" IF TAG END: "/tag name" The listener must supply the following methods: tag_start( "name", { attributes } ) tag_end( "name" ) text( "text" ) instruction( "name", "instruction" ) comment( "comment" ) doctype( "name", *contents )
</DIV>
<DIV CLASS="method">
<A NAME="N36">
<H3>encoding</H3>
</A><B style="padding-right: 1em;">Returns</B>
the XMLDecl encoding of this document as a String. If no XMLDecl has been set, returns the default encoding.
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N6">
<H3>initialize</H3>
</A>
<HR>
Constructor
</DIV>
<DIV CLASS="method">
<A NAME="N4C">
<H3>parse</H3>
</A>
<HR>
This and parse_stream could have been combined, but separating them improves the speed of REXML
</DIV>
<DIV CLASS="method">
<A NAME="N1A">
<H3>root</H3>
</A><B style="padding-right: 1em;">Returns</B>
the root Element of the document, or nil if this document has no children.
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N3D">
<H3>stand_alone</H3>
</A><B style="padding-right: 1em;">Returns</B>
the XMLDecl standalone value of this document as a String. If no XMLDecl has been set, returns the default setting.
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N2F">
<H3>version</H3>
</A><B style="padding-right: 1em;">Returns</B>
the XMLDecl version of this document as a String. If no XMLDecl has been set, returns the default version.
<HR>
</DIV>
<DIV CLASS="method">
<A NAME="N44">
<H3>write</H3>
</A>
<HR>
Write the XML tree out, optionally with indent. This writes out the entire XML document, including XML declarations, doctype declarations, and processing instructions (if any are given). A controversial point is whether Document should always write the XML declaration (<?xml version='1.0'?>) whether or not one is given by the user (or source document). REXML does not write one if one was not specified, because it adds unneccessary bandwidth to applications such as XML-RPC.
</DIV>
<DIV CLASS="method">
<A NAME="N28">
<H3>xml_decl</H3>
</A><B style="padding-right: 1em;">Returns</B>
the XMLDecl of this document; if no XMLDecl has been set, the default declaration is returned.
<HR>
</DIV>
<DIV CLASS="footer">
API documentation generated by <A HREF="http://www.germane-software.com/~ser/Software/api2xml">API2XML</A>
</DIV>
</BODY>
</HTML>
|