| |
- TagWrapper
-
- _nonRootTW
class TagWrapper |
|
Our own TagWrapper. We first tried the TagWrapper of pyRXP which was
damn fast and pretty simply written, but we couldn't write XML on
the fly. So here we go, you can create and parse XML like python code.
Example:
t = TagWrapper("<test/>")
will create the XML "<test/>"
t.foo = "works"
t.bar = "like"
t.fine = "a"
t.great = "charm"
will modify the precedent message and give
<test><foo>works</foo><bar>like</bar><fine>a</fine><great>charm</great>
</test>
For parsing :
for element in t:
print element
will print "works", "like", "a", "charm"
Each TagWrapper has a dynamically generated tagName attribute, so
t.tagData == "test" and t.foo.tagName == "foo"
You can call tagNewChild on any TagWrapper object to integrate a
whole XML hierarchy inside it. Example:
new = t.tagNewChild("<duh>damn</duh>") |
|
Methods defined here:
- _TagWrapper__checkValidity = __checkValidity(self)
- __getattr__(self, attr)
- __init__(self, xml)
- __iter__(self)
- __len__(self)
- __repr__(self)
- __setattr__(self, attr, value)
- __str__(self)
- tagNewChild(self, xml)
- toXml(self)
Data and non-method functions defined here:
- __doc__ = 'Our own TagWrapper. We first tried the TagWrappe... new = t.tagNewChild("<duh>damn</duh>")\n '
- __module__ = 'common.xmlutils'
|
|