Strip out <network> subtrees corresponding to other aggregates.
[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 &lt;&lt; ('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         &lt;root a="1"&gt;\r
26         &lt;data&gt;\r
27         &lt;node val="0" /&gt;\r
28         &lt;node val="1" /&gt;\r
29         &lt;node val="2" /&gt;\r
30         &lt;node val="3" /&gt;\r
31         &lt;node val="4" /&gt;\r
32         &lt;node val="5" /&gt;\r
33         &lt;node val="6" /&gt;\r
34         &lt;node val="7" /&gt;\r
35         &lt;node val="8" /&gt;\r
36         &lt;node val="9" /&gt;\r
37         &lt;/data&gt;\r
38         &lt;/root&gt;\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 `&lt;&lt;` 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 &lt;&lt; "Some textual data"\r
69         #here tag 'one-more-sub-tag' are closed\r
70         #Tags without children can be created using `&lt;&lt;` operator\r
71         for val in range(15):\r
72         xml &lt;&lt; ('message',"python rocks!"[:i])\r
73         #create 15 child tag like &lt;message&gt; python r&lt;/message&gt;\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