| 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="attributes-objects.html" /> |
| 13 | <link rel="prev" href="locator-objects.html" /> |
| 14 | <link rel="parent" href="module-xml.sax.xmlreader.html" /> |
| 15 | <link rel="next" href="attributes-objects.html" /> |
| 16 | <meta name='aesop' content='information' /> |
| 17 | <title>13.12.4 InputSource 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.12.3 Locator Objects" |
| 25 | href="locator-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.12 xml.sax.xmlreader " |
| 28 | href="module-xml.sax.xmlreader.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.12.5 The Attributes Interface" |
| 31 | href="attributes-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="locator-objects.html">13.12.3 Locator Objects</A> |
| 46 | <b class="navlabel">Up:</b> |
| 47 | <a class="sectref" rel="parent" href="module-xml.sax.xmlreader.html">13.12 xml.sax.xmlreader </A> |
| 48 | <b class="navlabel">Next:</b> |
| 49 | <a class="sectref" rel="next" href="attributes-objects.html">13.12.5 The Attributes Interface</A> |
| 50 | </div> |
| 51 | <hr /></div> |
| 52 | </DIV> |
| 53 | <!--End of Navigation Panel--> |
| 54 | |
| 55 | <H2><A NAME="SECTION00151240000000000000000"></A><A NAME="input-source-objects"></A> |
| 56 | <BR> |
| 57 | 13.12.4 InputSource Objects |
| 58 | </H2> |
| 59 | |
| 60 | <P> |
| 61 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 62 | <td><nobr><b><tt id='l2h-4543' xml:id='l2h-4543' class="method">setPublicId</tt></b>(</nobr></td> |
| 63 | <td><var>id</var>)</td></tr></table></dt> |
| 64 | <dd> |
| 65 | Sets the public identifier of this <tt class="class">InputSource</tt>. |
| 66 | </dl> |
| 67 | |
| 68 | <P> |
| 69 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 70 | <td><nobr><b><tt id='l2h-4544' xml:id='l2h-4544' class="method">getPublicId</tt></b>(</nobr></td> |
| 71 | <td><var></var>)</td></tr></table></dt> |
| 72 | <dd> |
| 73 | Returns the public identifier of this <tt class="class">InputSource</tt>. |
| 74 | </dl> |
| 75 | |
| 76 | <P> |
| 77 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 78 | <td><nobr><b><tt id='l2h-4545' xml:id='l2h-4545' class="method">setSystemId</tt></b>(</nobr></td> |
| 79 | <td><var>id</var>)</td></tr></table></dt> |
| 80 | <dd> |
| 81 | Sets the system identifier of this <tt class="class">InputSource</tt>. |
| 82 | </dl> |
| 83 | |
| 84 | <P> |
| 85 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 86 | <td><nobr><b><tt id='l2h-4546' xml:id='l2h-4546' class="method">getSystemId</tt></b>(</nobr></td> |
| 87 | <td><var></var>)</td></tr></table></dt> |
| 88 | <dd> |
| 89 | Returns the system identifier of this <tt class="class">InputSource</tt>. |
| 90 | </dl> |
| 91 | |
| 92 | <P> |
| 93 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 94 | <td><nobr><b><tt id='l2h-4547' xml:id='l2h-4547' class="method">setEncoding</tt></b>(</nobr></td> |
| 95 | <td><var>encoding</var>)</td></tr></table></dt> |
| 96 | <dd> |
| 97 | Sets the character encoding of this <tt class="class">InputSource</tt>. |
| 98 | |
| 99 | <P> |
| 100 | The encoding must be a string acceptable for an XML encoding |
| 101 | declaration (see section 4.3.3 of the XML recommendation). |
| 102 | |
| 103 | <P> |
| 104 | The encoding attribute of the <tt class="class">InputSource</tt> is ignored if the |
| 105 | <tt class="class">InputSource</tt> also contains a character stream. |
| 106 | </dl> |
| 107 | |
| 108 | <P> |
| 109 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 110 | <td><nobr><b><tt id='l2h-4548' xml:id='l2h-4548' class="method">getEncoding</tt></b>(</nobr></td> |
| 111 | <td><var></var>)</td></tr></table></dt> |
| 112 | <dd> |
| 113 | Get the character encoding of this InputSource. |
| 114 | </dl> |
| 115 | |
| 116 | <P> |
| 117 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 118 | <td><nobr><b><tt id='l2h-4549' xml:id='l2h-4549' class="method">setByteStream</tt></b>(</nobr></td> |
| 119 | <td><var>bytefile</var>)</td></tr></table></dt> |
| 120 | <dd> |
| 121 | Set the byte stream (a Python file-like object which does not |
| 122 | perform byte-to-character conversion) for this input source. |
| 123 | |
| 124 | <P> |
| 125 | The SAX parser will ignore this if there is also a character stream |
| 126 | specified, but it will use a byte stream in preference to opening a |
| 127 | URI connection itself. |
| 128 | |
| 129 | <P> |
| 130 | If the application knows the character encoding of the byte stream, |
| 131 | it should set it with the setEncoding method. |
| 132 | </dl> |
| 133 | |
| 134 | <P> |
| 135 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 136 | <td><nobr><b><tt id='l2h-4550' xml:id='l2h-4550' class="method">getByteStream</tt></b>(</nobr></td> |
| 137 | <td><var></var>)</td></tr></table></dt> |
| 138 | <dd> |
| 139 | Get the byte stream for this input source. |
| 140 | |
| 141 | <P> |
| 142 | The getEncoding method will return the character encoding for this |
| 143 | byte stream, or None if unknown. |
| 144 | </dl> |
| 145 | |
| 146 | <P> |
| 147 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 148 | <td><nobr><b><tt id='l2h-4551' xml:id='l2h-4551' class="method">setCharacterStream</tt></b>(</nobr></td> |
| 149 | <td><var>charfile</var>)</td></tr></table></dt> |
| 150 | <dd> |
| 151 | Set the character stream for this input source. (The stream must be |
| 152 | a Python 1.6 Unicode-wrapped file-like that performs conversion to |
| 153 | Unicode strings.) |
| 154 | |
| 155 | <P> |
| 156 | If there is a character stream specified, the SAX parser will ignore |
| 157 | any byte stream and will not attempt to open a URI connection to the |
| 158 | system identifier. |
| 159 | </dl> |
| 160 | |
| 161 | <P> |
| 162 | <dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline"> |
| 163 | <td><nobr><b><tt id='l2h-4552' xml:id='l2h-4552' class="method">getCharacterStream</tt></b>(</nobr></td> |
| 164 | <td><var></var>)</td></tr></table></dt> |
| 165 | <dd> |
| 166 | Get the character stream for this input source. |
| 167 | </dl> |
| 168 | |
| 169 | <P> |
| 170 | |
| 171 | <DIV CLASS="navigation"> |
| 172 | <div class='online-navigation'> |
| 173 | <p></p><hr /> |
| 174 | <table align="center" width="100%" cellpadding="0" cellspacing="2"> |
| 175 | <tr> |
| 176 | <td class='online-navigation'><a rel="prev" title="13.12.3 Locator Objects" |
| 177 | href="locator-objects.html"><img src='../icons/previous.png' |
| 178 | border='0' height='32' alt='Previous Page' width='32' /></A></td> |
| 179 | <td class='online-navigation'><a rel="parent" title="13.12 xml.sax.xmlreader " |
| 180 | href="module-xml.sax.xmlreader.html"><img src='../icons/up.png' |
| 181 | border='0' height='32' alt='Up One Level' width='32' /></A></td> |
| 182 | <td class='online-navigation'><a rel="next" title="13.12.5 The Attributes Interface" |
| 183 | href="attributes-objects.html"><img src='../icons/next.png' |
| 184 | border='0' height='32' alt='Next Page' width='32' /></A></td> |
| 185 | <td align="center" width="100%">Python Library Reference</td> |
| 186 | <td class='online-navigation'><a rel="contents" title="Table of Contents" |
| 187 | href="contents.html"><img src='../icons/contents.png' |
| 188 | border='0' height='32' alt='Contents' width='32' /></A></td> |
| 189 | <td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png' |
| 190 | border='0' height='32' alt='Module Index' width='32' /></a></td> |
| 191 | <td class='online-navigation'><a rel="index" title="Index" |
| 192 | href="genindex.html"><img src='../icons/index.png' |
| 193 | border='0' height='32' alt='Index' width='32' /></A></td> |
| 194 | </tr></table> |
| 195 | <div class='online-navigation'> |
| 196 | <b class="navlabel">Previous:</b> |
| 197 | <a class="sectref" rel="prev" href="locator-objects.html">13.12.3 Locator Objects</A> |
| 198 | <b class="navlabel">Up:</b> |
| 199 | <a class="sectref" rel="parent" href="module-xml.sax.xmlreader.html">13.12 xml.sax.xmlreader </A> |
| 200 | <b class="navlabel">Next:</b> |
| 201 | <a class="sectref" rel="next" href="attributes-objects.html">13.12.5 The Attributes Interface</A> |
| 202 | </div> |
| 203 | </div> |
| 204 | <hr /> |
| 205 | <span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span> |
| 206 | </DIV> |
| 207 | <!--End of Navigation Panel--> |
| 208 | <ADDRESS> |
| 209 | See <i><a href="about.html">About this document...</a></i> for information on suggesting changes. |
| 210 | </ADDRESS> |
| 211 | </BODY> |
| 212 | </HTML> |