How to retrieve data from this XML using JQuery OR any other java scripting method
I just come across with some strange situation. I want to traverse this strange XML using jQuery.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CategorySearch id="132801">
<Category id="132801" name="开发者_StackOverflow社区ABC">
<Category id="100327623" name="DEF">
<Category id="133101" name="GHI" />
<Category id="133501" name="KLM" />
</Category>
<Category id="100327523" name="NOP">
<Category id="133401" name="QRS"/>
</Category>
<Category id="100291623">
<Category id="132701" />
<Category id="147501" />
<Category id="133901" />
</Category>
<Category id="134201">
<Category id="100250023" />
<Category id="100477023" />
</Category>
<Category id="133601">
<Category id="100046513" />
<Category id="100532023" />
<Category id="133001" />
</Category>
</Category>
</CategorySearch>
For Example,
If i give name attribute to the above XML. So output should be like,
ABC
DEF
GHI
KLM
NOP
QRS
Thanks
If you'd Googled it, you would have happily come accross .parseXML()
:
jQuery.parseXML uses the native parsing function of the browser to create a valid XML Document. This document can then be passed to jQuery to create a typical jQuery object that can be traversed and manipulated.
精彩评论