2008-08-16 23:26:59 +08:00
|
|
|
|
2010-07-27 03:15:15 +08:00
|
|
|
import py
|
|
|
|
class ns(py.xml.Namespace):
|
|
|
|
pass
|
2008-08-16 23:26:59 +08:00
|
|
|
|
|
|
|
doc = ns.books(
|
|
|
|
ns.book(
|
2010-07-27 03:15:15 +08:00
|
|
|
ns.author("May Day"),
|
|
|
|
ns.title("python for java programmers"),),
|
|
|
|
ns.book(
|
|
|
|
ns.author("why", class_="somecssclass"),
|
2008-08-16 23:26:59 +08:00
|
|
|
ns.title("Java for Python programmers"),),
|
2010-07-27 03:15:15 +08:00
|
|
|
publisher="N.N",
|
2008-08-16 23:26:59 +08:00
|
|
|
)
|
|
|
|
print doc.unicode(indent=2).encode('utf8')
|
|
|
|
|
|
|
|
|