MCPcopy Index your code
hub / github.com/python/cpython / InputSource

Class InputSource

Lib/xml/sax/xmlreader.py:187–272  ·  view source on GitHub ↗

Encapsulation of the information needed by the XMLReader to read entities. This class may include information about the public identifier, system identifier, byte stream (possibly with character encoding information) and/or the character stream of an entity. Applications will c

Source from the content-addressed store, hash-verified

185# ===== INPUTSOURCE =====
186
187class InputSource:
188 """Encapsulation of the information needed by the XMLReader to
189 read entities.
190
191 This class may include information about the public identifier,
192 system identifier, byte stream (possibly with character encoding
193 information) and/or the character stream of an entity.
194
195 Applications will create objects of this class for use in the
196 XMLReader.parse method and for returning from
197 EntityResolver.resolveEntity.
198
199 An InputSource belongs to the application, the XMLReader is not
200 allowed to modify InputSource objects passed to it from the
201 application, although it may make copies and modify those."""
202
203 def __init__(self, system_id = None):
204 self.__system_id = system_id
205 self.__public_id = None
206 self.__encoding = None
207 self.__bytefile = None
208 self.__charfile = None
209
210 def setPublicId(self, public_id):
211 "Sets the public identifier of this InputSource."
212 self.__public_id = public_id
213
214 def getPublicId(self):
215 "Returns the public identifier of this InputSource."
216 return self.__public_id
217
218 def setSystemId(self, system_id):
219 "Sets the system identifier of this InputSource."
220 self.__system_id = system_id
221
222 def getSystemId(self):
223 "Returns the system identifier of this InputSource."
224 return self.__system_id
225
226 def setEncoding(self, encoding):
227 """Sets the character encoding of this InputSource.
228
229 The encoding must be a string acceptable for an XML encoding
230 declaration (see section 4.3.3 of the XML recommendation).
231
232 The encoding attribute of the InputSource is ignored if the
233 InputSource also contains a character stream."""
234 self.__encoding = encoding
235
236 def getEncoding(self):
237 "Get the character encoding of this InputSource."
238 return self.__encoding
239
240 def setByteStream(self, bytefile):
241 """Set the byte stream (a Python file-like object which does
242 not perform byte-to-character conversion) for this input
243 source.
244

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…