Thanks guys for helping me to write xml parsing in python..I will use ElementTree Or cElementTree to extract data from xml and let you people know about the outcome.
@Anthony: My mistatke :( , I manually written the xml so did mistake on matching opening and closing tags. Thanks once again Amit On Thu, Aug 23, 2012 at 8:48 PM, villas <[email protected]> wrote: > If the XML is not well-formed, take a look at beautiful soup. I have > never found a parser so tolerant and forgiving. > > > On Thursday, August 23, 2012 2:59:25 PM UTC+1, Anthony wrote: >> >> For simple parsing, you can also use the built-in TAG() helper -- see >> http://web2py.com/books/**default/chapter/29/5#Parsing<http://web2py.com/books/default/chapter/29/5#Parsing> >> . >> >> FYI, in your example, some of the closing tags do not match their >> associated opening tags. >> >> Anthony >> >> On Thursday, August 23, 2012 5:53:32 AM UTC-4, Amit wrote: >>> >>> Hi, >>> I have web service method in my application which will receive xml file >>> from the request, i need to parse it and save the extracted data to the >>> database. Please suggest me the best way to parse xml in web2py. >>> >>> xml format would be like below: >>> >>> <?xml version='1.0' encoding='utf-8'?> >>> <macaddress value="00:00:00:00:00:00" > >>> <devicetype value="abc"> >>> <deviceserialno>123456</**sensorserialno> >>> <mfgdate>2012-06-30</mngdate> >>> <mfgsiteid>1</mngsiteid> >>> <secretkey>**adadafdfdgfgfhggjghjjj</**secretkey> >>> </sensortype> >>> </macaddress> >>> >> -- > > > > --

