[XML-SIG] Howto create this XML string?
Sbaush
sbaush at gmail.com
Fri Jan 20 11:09:53 CET 2006
Thanks all, i've perfectly undestand the way. Thanks again.
2006/1/19, Luis Miguel Morillas <morillas at gmail.com>:
>
>
>
> 2006/1/19, Sbaush <sbaush at gmail.com>:
> >
> > Hi all.
> > I've this XML:
> >
> > <manager>
> > <request>
> > <append mode="INPUT">
> > <method type="GOOD"/>
> > <source address=" 127.0.0.1"/>
> > <action option="OK"/>
> > </append>
> > </request>
> > </manager>
> >
> > How can i write this in a Python String? I would like use a xml.domimplementation and not a banal print...print...
> > I can't do it... Is there anyone that can explain me what is the way?
> > Thank you!
>
>
>
> Another taste with amara:
>
> import amara
> doc = amara.create_document (u"manager")
> doc.manager.xml_append(doc.xml_create_element(u'request'))
> doc.manager.request.xml_append(doc.xml_create_element(
> u'append',
> attributes={u'mode':u'INPUT'}))
> doc.manager.request.append.xml_append (doc.xml_create_element(
> u'method',
> attributes={u'type':u'GOOD'}))
> doc.manager.request.append.xml_append(doc.xml_create_element(
> u'source',
> attributes={u'source':u' 127.0.0.1'}))
> doc.manager.request.append.xml_append(doc.xml_create_element(
> u'action',
> attributes={u'option':u'OK'}))
> print doc.xml(indent='yes')
>
>
>
>
> --
>
> Luis Miguel
> _______________________________________________
> XML-SIG maillist - XML-SIG at python.org
> http://mail.python.org/mailman/listinfo/xml-sig
>
>
>
--
Sbaush
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/xml-sig/attachments/20060120/afad4b6e/attachment.htm
More information about the XML-SIG
mailing list