<span class="gmail_quote"></span><br><div><span class="gmail_quote">2006/1/27, Sbaush <<a href="mailto:sbaush@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">sbaush@gmail.com</a>>:</span>
<div><span class="e" id="q_1090c89f884f19a7_1"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<span class="gmail_quote"></span><span class="gmail_quote"></span>Hi all.<br><div><span>I attach to you a example XML file to parse and the demo of my objective.<br>The iptRequest.xml is the file to parse in one mode. I can't parse it.
<br>The demo.py is my ideal result, manually built, that should be built by parsing the XML.
<br>How can i do to do it?<br>Bye all!</span></div></blockquote></span></div><div><br>Easy, here you have the data you need, then compose your strings :)<br><br>import amara<br>doc = amara.parse('iptRequest.xml')<br>for table in
doc.xml_xpath
(u'//table'):<br> data = {}<br> data['chain'] = table.chain<br> data['poli'] = table.policy<br> for rule in table.xml_children:<br> if not isinstance(rule, unicode): <br> for at in rule.xml_attributes.keys
():<br> data[at] = eval('rule.'+at)<br> print data # now build your string<br></div></div><br><br><br>Saludos, <br><br>--<br><span class="sg"><br>Luis Miguel
</span><br clear="all"><br>