Thanks all, i've perfectly undestand the way. Thanks again.


2006/1/19, Luis Miguel Morillas <[EMAIL PROTECTED]>:


2006/1/19, Sbaush <[EMAIL PROTECTED]>:
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.dom implementation 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@python.org
http://mail.python.org/mailman/listinfo/xml-sig





--
Sbaush
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to