mirror of
https://github.com/kennethreitz/python-guide.git
synced 2026-06-05 23:00:18 +00:00
Capitalization in xml.rst
replaced: * xml to XML * python to Python * json to JSON
This commit is contained in:
@@ -8,7 +8,7 @@ untangle
|
|||||||
an XML document and returns a Python object which mirrors the nodes and
|
an XML document and returns a Python object which mirrors the nodes and
|
||||||
attributes in its structure.
|
attributes in its structure.
|
||||||
|
|
||||||
For example, an xml file like this:
|
For example, an XML file like this:
|
||||||
|
|
||||||
.. code-block:: xml
|
.. code-block:: xml
|
||||||
|
|
||||||
@@ -36,9 +36,9 @@ xmltodict
|
|||||||
---------
|
---------
|
||||||
|
|
||||||
`xmltodict <http://github.com/martinblech/xmltodict>`_ is another simple
|
`xmltodict <http://github.com/martinblech/xmltodict>`_ is another simple
|
||||||
library that aims at making xml feel like working with json.
|
library that aims at making XML feel like working with JSON.
|
||||||
|
|
||||||
An xml file like this:
|
An XML file like this:
|
||||||
|
|
||||||
.. code-block:: xml
|
.. code-block:: xml
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ An xml file like this:
|
|||||||
</plus>
|
</plus>
|
||||||
</mydocument>
|
</mydocument>
|
||||||
|
|
||||||
can be loaded into a python dict like this:
|
can be loaded into a Python dict like this:
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
@@ -68,6 +68,6 @@ and then you can access elements, attributes and values like this:
|
|||||||
doc['mydocument']['plus']['@a'] # == u'complex'
|
doc['mydocument']['plus']['@a'] # == u'complex'
|
||||||
doc['mydocument']['plus']['#text'] # == u'element as well'
|
doc['mydocument']['plus']['#text'] # == u'element as well'
|
||||||
|
|
||||||
xmltodict also lets you roundtrip back to xml with the unparse function,
|
xmltodict also lets you roundtrip back to XML with the unparse function,
|
||||||
has a streaming mode suitable for handling files that don't fit in memory
|
has a streaming mode suitable for handling files that don't fit in memory
|
||||||
and supports namespaces.
|
and supports namespaces.
|
||||||
|
|||||||
Reference in New Issue
Block a user