-Metadata-Version: 1.0\r
-Name: xmlbuilder\r
-Version: 0.9\r
-Summary: Pythonic way to create xml files\r
-Home-page: http://pypi.python.org/pypi/xmlbuilder\r
-Author: koder\r
-Author-email: koder_dot_mail@gmail_dot_com\r
-License: MIT\r
-Download-URL: http://pypi.python.org/pypi/xmlbuilder\r
+Metadata-Version: 1.1
+Name: xmlbuilder
+Version: 0.9
+Summary: Pythonic way to create xml files
+Home-page: http://pypi.python.org/pypi/xmlbuilder
+Author: koder
+Author-email: koder_dot_mail@gmail_dot_com
+License: MIT
+Download-URL: http://pypi.python.org/pypi/xmlbuilder
Description: Example of usage:\r
-----------------\r
\r
from xmlbuilder import XMLBuilder\r
x = XMLBuilder(format=True)\r
with x.root(a = 1):\r
- with x.data:\r
- [x << ('node',{'val':i}) for i in range(10)]\r
+ with x.data:\r
+ [x << ('node',{'val':i}) for i in range(10)]\r
\r
print str(x)\r
\r
will print\r
\r
<root a="1">\r
- <data>\r
- <node val="0" />\r
- <node val="1" />\r
- <node val="2" />\r
- <node val="3" />\r
- <node val="4" />\r
- <node val="5" />\r
- <node val="6" />\r
- <node val="7" />\r
- <node val="8" />\r
- <node val="9" />\r
- </data>\r
+ <data>\r
+ <node val="0" />\r
+ <node val="1" />\r
+ <node val="2" />\r
+ <node val="3" />\r
+ <node val="4" />\r
+ <node val="5" />\r
+ <node val="6" />\r
+ <node val="7" />\r
+ <node val="8" />\r
+ <node val="9" />\r
+ </data>\r
</root>\r
\r
Mercurial repo:http://hg.assembla.com/MyPackages/\r
\r
First we need to create xmlbuilder\r
\r
- from xmlbuilder import XMLBuilder\r
- # params - encoding = 'utf8',\r
- # builder = None, - ElementTree.TreeBuilder\r
- # tab_level = None, - current tab l;evel - for formatted output only\r
- # format = False, - create formatted output\r
- # tab_step = " " * 4 - indentation step\r
- xml = XMLBuilder()\r
+ from xmlbuilder import XMLBuilder\r
+ # params - encoding = 'utf8',\r
+ # builder = None, - ElementTree.TreeBuilder \r
+ # tab_level = None, - current tab l;evel - for formatted output only\r
+ # format = False, - create formatted output\r
+ # tab_step = " " * 4 - indentation step\r
+ xml = XMLBuilder()\r
\r
\r
Use `with` statement to make document structure\r
- #create and open tag 'root_tag' with text 'text' and attributes\r
- with xml.root_tag(text,attr1=val1,attr2=val2):\r
- #create and open tag 'sub_tag'\r
- with xml.sub_tag(text,attr3=val3):\r
- #create tag which are not valid python identificator\r
- with xml('one-more-sub-tag',attr7=val37):\r
- xml << "Some textual data"\r
- #here tag 'one-more-sub-tag' are closed\r
- #Tags without children can be created using `<<` operator\r
- for val in range(15):\r
- xml << ('message',"python rocks!"[:i])\r
- #create 15 child tag like <message> python r</message>\r
- #all tags closed\r
- node = ~x # get etree.ElementTree object\r
- xml_data = str(x)\r
- unicode_xml_data = unicode(x)\r
- \r
-Keywords: xml\r
-Platform: UNKNOWN\r
+ #create and open tag 'root_tag' with text 'text' and attributes\r
+ with xml.root_tag(text,attr1=val1,attr2=val2):\r
+ #create and open tag 'sub_tag'\r
+ with xml.sub_tag(text,attr3=val3):\r
+ #create tag which are not valid python identificator\r
+ with xml('one-more-sub-tag',attr7=val37):\r
+ xml << "Some textual data"\r
+ #here tag 'one-more-sub-tag' are closed\r
+ #Tags without children can be created using `<<` operator\r
+ for val in range(15):\r
+ xml << ('message',"python rocks!"[:i])\r
+ #create 15 child tag like <message> python r</message>\r
+ #all tags closed\r
+ node = ~x # get etree.ElementTree object\r
+ xml_data = str(x)\r
+ unicode_xml_data = unicode(x)\r
+
+Keywords: xml
+Platform: UNKNOWN