Can someone please help me with parsing below XML in javascript or JQuery? I am not able to parse or not able to find relevant examples.
<?xml version="1.0" encoding="utf-8" ?>
- <DataSet xmlns="http://abcd.com/WebServices/">
- <xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
- <xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
- <xs:complexType>
- <xs:choice minOccurs="0" maxOccurs="unbounded">
- <xs:element name="ResultSet">
- <xs:complexType>
- <xs:sequence>
<xs:element name="mdescnum1" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
- <diffgr:diffgram xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
- <NewDataSet xmlns="">
- <ResultSet diffgr:id="ResultSet1" msdata:rowOrder="0">
<mdescnum1>aaaaaaaa</mdescnum1>
</ResultSet>
- <ResultSet diffgr:id="ResultSet2" msdata:rowOrder="1">
<mdescnum1>bbbbbb</mdescnum1>
</ResultSet>
</NewDataSet>
</diffgr:diffgram>
</DataSet>
Thanks in advance.
Maybe this one help you out.
var xml = $.parseXML(yourfile.xml),
$xml = $( xml ),
$test = $xml.find('test');
console.log($test.text());
use your tag name on behalf of 'test'.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.