minor update

This commit is contained in:
Miroslav Stampar 2010-10-11 14:38:04 +00:00
parent e2bbfbe650
commit 6dcd05c39c
2 changed files with 22 additions and 21 deletions

View File

@ -25,37 +25,37 @@ Example XML file::
Example usage::
>>> from xmlobject import XMLFile
>> from xmlobject import XMLFile
>>> x = XMLFile(path="sample.xml)
>> x = XMLFile(path="sample.xml")
>>> print x
>> print x
<xmlobj.XMLFile instance at 0xb7ccc52c>
>>> print x.root
>> print x.root
<XMLNode: rapsheets>
>>> print x.root._children
>> print x.root._children
[<XMLNode: text>, <XMLNode: person>, <XMLNode: text>,
<XMLNode: person>, <XMLNode: text>]
>>> print x.root.person
>> print x.root.person
[<XMLNode: person>, <XMLNode: person>]
>>> print x.root.person[0].name
>> print x.root.person[0].name
John Smith
>>> john = x.root.person[0]
>> john = x.root.person[0]
>>> john.height = 184
>> john.height = 184
>>> c = john._addNode("crime")
>> c = john._addNode("crime")
>>> c.name = "Grand Theft Auto"
>> c.name = "Grand Theft Auto"
>>> c.date = "4 May, 2005"
>> c.date = "4 May, 2005"
>>> print x.toxml()
>> print x.toxml()
<?xml version="1.0" ?>
<rapsheets>
<person age="42" height="184" name="John Smith">
@ -70,7 +70,7 @@ Example usage::
</person>
</rapsheets>
>>>
>>
"""
@ -360,18 +360,18 @@ class XMLNode:
<child>foo</child>
</somenode>
>>> somenode
>> somenode
<XMLNODE: somenode>
>>> somenode.child
>> somenode.child
<XMLNODE: child>
>>> somenode.child._text
>> somenode.child._text
'foo'
>>> somenode._toxml()
>> somenode._toxml()
u'<somenode><child>foo</child></somenode>'
>>> somenode.child._text = 'bar'
>>> somenode.child._text
>> somenode.child._text = 'bar'
>> somenode.child._text
'bar'
>>> somenode.child._toxml()
>> somenode.child._toxml()
u'<somenode><child>bar/child></somenode>'
"""

View File

@ -25,6 +25,7 @@ import codecs
import os
import cProfile
from lib.core.common import getUnicode
from lib.core.data import conf
from lib.core.data import logger
from lib.core.data import paths