deeper pass on xmlrpclib vs xmlrpc.client as well as configparser
[sfa.git] / xmlbuilder-0.9 / PKG-INFO
1 Metadata-Version: 1.0\r
2 Name: xmlbuilder\r
3 Version: 0.9\r
4 Summary: Pythonic way to create xml files\r
5 Home-page: http://pypi.python.org/pypi/xmlbuilder\r
6 Author: koder\r
7 Author-email: koder_dot_mail@gmail_dot_com\r
8 License: MIT\r
9 Download-URL: http://pypi.python.org/pypi/xmlbuilder\r
10 Description: Example of usage:\r
11         -----------------\r
12         \r
13         \r
14         from __future__ import with_statement\r
15         from xmlbuilder import XMLBuilder\r
16         x = XMLBuilder(format=True)\r
17         with x.root(a = 1):\r
18         with x.data:\r
19         [x << ('node',{'val':i}) for i in range(10)]\r
20         \r
21         print str(x)\r
22         \r
23         will print\r
24         \r
25         <root a="1">\r
26         <data>\r
27         <node val="0" />\r
28         <node val="1" />\r
29         <node val="2" />\r
30         <node val="3" />\r
31         <node val="4" />\r
32         <node val="5" />\r
33         <node val="6" />\r
34         <node val="7" />\r
35         <node val="8" />\r
36         <node val="9" />\r
37         </data>\r
38         </root>\r
39         \r
40         Mercurial repo:http://hg.assembla.com/MyPackages/\r
41         \r
42         Documentations\r
43         --------------\r
44         `XMLBuilder` is simple library build on top of `ElementTree.TreeBuilder` to\r
45         simplify xml files creation as much as possible. Althow it can produce\r
46         structured result with identated child tags. `XMLBuilder` use python `with`\r
47         statement to define xml tag levels and `<<` operator for simple cases -\r
48         text and tag without childs.\r
49         \r
50         First we need to create xmlbuilder\r
51         \r
52         from xmlbuilder import XMLBuilder\r
53         # params - encoding = 'utf8',\r
54         # builder = None, - ElementTree.TreeBuilder\r
55         # tab_level = None, - current tab l;evel - for formatted output only\r
56         # format = False, - create formatted output\r
57         # tab_step = " " * 4 - indentation step\r
58         xml = XMLBuilder()\r
59         \r
60         \r
61         Use `with` statement to make document structure\r
62         #create and open tag 'root_tag' with text 'text' and attributes\r
63         with xml.root_tag(text,attr1=val1,attr2=val2):\r
64         #create and open tag 'sub_tag'\r
65         with xml.sub_tag(text,attr3=val3):\r
66         #create tag which are not valid python identificator\r
67         with xml('one-more-sub-tag',attr7=val37):\r
68         xml << "Some textual data"\r
69         #here tag 'one-more-sub-tag' are closed\r
70         #Tags without children can be created using `<<` operator\r
71         for val in range(15):\r
72         xml << ('message',"python rocks!"[:i])\r
73         #create 15 child tag like <message> python r</message>\r
74         #all tags closed\r
75         node = ~x # get etree.ElementTree object\r
76         xml_data = str(x)\r
77         unicode_xml_data = unicode(x)\r
78         \r
79 Keywords: xml\r
80 Platform: UNKNOWN\r