|
|
@ -48,7 +48,7 @@ that=new one |
|
|
|
once=anything |
|
|
|
twice=goes |
|
|
|
[Number 3] |
|
|
|
... |
|
|
|
<BLANKLINE> |
|
|
|
|
|
|
|
pyPEG contains an XML backend, too: |
|
|
|
|
|
|
@ -63,14 +63,13 @@ pyPEG contains an XML backend, too: |
|
|
|
<Key name="once">anything</Key> |
|
|
|
<Key name="twice">goes</Key> |
|
|
|
</Section> |
|
|
|
<Section name="Number 3"/> |
|
|
|
<Section name="Number 3" /> |
|
|
|
</IniFile> |
|
|
|
... |
|
|
|
|
|
|
|
In this sample the tree contains named objects only. Then we can output object |
|
|
|
names as tag names. Spaces in names will be translated into underscores. |
|
|
|
|
|
|
|
>>> print(thing2xml(ini_file, pretty=True, object_names=True).decode()) # doctest: +SKIP |
|
|
|
>>> print(thing2xml(ini_file, pretty=True, object_names=True).decode()) |
|
|
|
<IniFile> |
|
|
|
<Number_1> |
|
|
|
<this>something</this> |
|
|
@ -80,9 +79,8 @@ names as tag names. Spaces in names will be translated into underscores. |
|
|
|
<once>anything</once> |
|
|
|
<twice>goes</twice> |
|
|
|
</Number_2> |
|
|
|
<Number_3/> |
|
|
|
<Number_3 /> |
|
|
|
</IniFile> |
|
|
|
... |
|
|
|
""" |
|
|
|
|
|
|
|
from __future__ import unicode_literals, print_function |
|
|
|