PDA

View Full Version : How to parse xml using DomQuery?



swiji2000
4 Sep 2012, 8:31 PM
Hi,

How to parse type, name, level from the following xml using Ext.DomQuery?

<menu_item type="item" name="ABC & bros" level="3" ></menu_item>

Please help me.

Thanks

tvanzoelen
4 Sep 2012, 11:30 PM
Try it with the XMlReader.

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.reader.Xml

else you have to do parser checks on the browser like writen in this document http://www.hiteshagrawal.com/javascript/javascript-parsing-xml-in-javascript

swiji2000
5 Sep 2012, 1:40 AM
XMLReader is not use for my requirement.

I am getting response.xml file. I need to parse that file and getting the fields for dynamic menu formation.

Can u help for me?

tvanzoelen
5 Sep 2012, 3:01 AM
Isn that file on a http server? Just read it with the XMLReader.

See also,

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.XmlStore

tvanzoelen
5 Sep 2012, 3:24 AM
Or




var node = Ext.DomQuery.selectNode('nodename', xmlstring);

swiji2000
5 Sep 2012, 8:03 PM
Thats works fine.

Thanks.