| |
| An :class:`InputSource` belongs to the application, the :class:`XMLReader` is |
| not allowed to modify :class:`InputSource` objects passed to it from the |
| application, although it may make copies and modify those. |
| |
| |
| .. class:: AttributesImpl(attrs) |
| |
n | This is an implementation of the :class:`Attributes` interface (XXX reference: |
n | This is an implementation of the :class:`Attributes` interface (see section |
| attributes-objects.html) (see section :ref:`attributes-objects`). This is a |
| :ref:`attributes-objects`). This is a dictionary-like object which |
| dictionary-like object which represents the element attributes in a |
| represents the element attributes in a :meth:`startElement` call. In addition |
| :meth:`startElement` call. In addition to the most useful dictionary operations, |
| to the most useful dictionary operations, it supports a number of other |
| it supports a number of other methods as described by the interface. Objects of |
| methods as described by the interface. Objects of this class should be |
| this class should be instantiated by readers; *attrs* must be a dictionary-like |
| instantiated by readers; *attrs* must be a dictionary-like object containing |
| object containing a mapping from attribute names to attribute values. |
| a mapping from attribute names to attribute values. |
| |
| |
| .. class:: AttributesNSImpl(attrs, qnames) |
| |
| Namespace-aware variant of :class:`AttributesImpl`, which will be passed to |
| :meth:`startElementNS`. It is derived from :class:`AttributesImpl`, but |
n | understands attribute names as two-tuples of *namespaceURI* and *localname*. In |
n | understands attribute names as two-tuples of *namespaceURI* and |
| addition, it provides a number of methods expecting qualified names as they |
| *localname*. In addition, it provides a number of methods expecting qualified |
| appear in the original document. This class implements the |
| names as they appear in the original document. This class implements the |
| :class:`AttributesNS` interface (XXX reference: attributes-ns-objects.html) (see |
| :class:`AttributesNS` interface (see section :ref:`attributes-ns-objects`). |
| section :ref:`attributes-ns-objects`). |
| |
| |
| .. _xmlreader-objects: |
| |
| XMLReader Objects |
| ----------------- |
| |
| The :class:`XMLReader` interface supports the following methods: |
| |
| .. method:: InputSource.getEncoding() |
| |
| Get the character encoding of this InputSource. |
| |
| |
| .. method:: InputSource.setByteStream(bytefile) |
| |
n | Set the byte stream (a Python file-like object which does not perform byte-to- |
n | Set the byte stream (a Python file-like object which does not perform |
| character conversion) for this input source. |
| byte-to-character conversion) for this input source. |
| |
| The SAX parser will ignore this if there is also a character stream specified, |
| but it will use a byte stream in preference to opening a URI connection itself. |
| |
| If the application knows the character encoding of the byte stream, it should |
| set it with the setEncoding method. |
| |
| |
| |
| Returns the type of the attribute *name*, which is normally ``'CDATA'``. |
| |
| |
| .. method:: Attributes.getValue(name) |
| |
| Return the value of attribute *name*. |
| |
n | .. % getValueByQName, getNameByQName, getQNameByName, getQNames available |
n | .. getValueByQName, getNameByQName, getQNameByName, getQNames available |
| .. % here already, but documented only for derived class. |
| .. here already, but documented only for derived class. |
| |
| |
| .. _attributes-ns-objects: |
| |
| The :class:`AttributesNS` Interface |
| ----------------------------------- |
| |
t | This interface is a subtype of the :class:`Attributes` interface (XXX reference: |
t | This interface is a subtype of the :class:`Attributes` interface (see section |
| attributes-objects.html) (see section :ref:`attributes-objects`). All methods |
| :ref:`attributes-objects`). All methods supported by that interface are also |
| supported by that interface are also available on :class:`AttributesNS` objects. |
| available on :class:`AttributesNS` objects. |
| |
| The following methods are also available: |
| |
| |
| .. method:: AttributesNS.getValueByQName(name) |
| |
| Return the value for a qualified name. |
| |