Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET jQuery
here iam using jquery graph, for that i need to convert xml to json. so for that iam using xml2json.js
 
 success: function (msg) {
                    var json = $.xml2json(msg.d);
                 }
 
Here i am getting xml code as below. But it is not converting it. Can anyone help to solve it.
 

<NewDataSet>
  <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="Table">
            <xs:complexType>
              <xs:attribute name="Createddate" msdata:ReadOnly="true">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="100" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:attribute>
              <xs:attribute name="ReferralCount" msdata:ReadOnly="true" type="xs:int" />
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  <Table Createddate="01/10/2013" ReferralCount="3" />
  <Table Createddate="01/18/2013" ReferralCount="11" />
  <Table Createddate="01/19/2013" ReferralCount="5" />
  <Table Createddate="06/13/2011" ReferralCount="2" />
  <Table Createddate="07/04/2012" ReferralCount="1" />
  <Table Createddate="07/05/2012" ReferralCount="3" />
  <Table Createddate="07/06/2012" ReferralCount="18" />
  <Table Createddate="07/09/2012" ReferralCount="48" />
  <Table Createddate="07/10/2012" ReferralCount="23" />
  <Table Createddate="07/11/2012" ReferralCount="2" />
  <Table Createddate="07/12/2012" ReferralCount="28" />
  <Table Createddate="07/13/2012" ReferralCount="25" />
  <Table Createddate="07/16/2012" ReferralCount="35" />
  <Table Createddate="07/17/2012" ReferralCount="99" />
  <Table Createddate="07/18/2012" ReferralCount="71" />
  <Table Createddate="07/19/2012" ReferralCount="40" />
  <Table Createddate="07/20/2012" ReferralCount="52" />
  <Table Createddate="07/23/2012" ReferralCount="107" />
  <Table Createddate="07/24/2012" ReferralCount="26" />
  <Table Createddate="07/25/2012" ReferralCount="77" />
  <Table Createddate="07/26/2012" ReferralCount="43" />
  <Table Createddate="07/27/2012" ReferralCount="13" />
  <Table Createddate="07/30/2012" ReferralCount="61" />
  <Table Createddate="07/31/2012" ReferralCount="31" />
  <Table Createddate="08/01/2012" ReferralCount="101" />
  <Table Createddate="08/02/2012" ReferralCount="21" />
  <Table Createddate="08/03/2012" ReferralCount="37" />
  <Table Createddate="08/06/2012" ReferralCount="58" />
  <Table Createddate="08/07/2012" ReferralCount="30" />
  <Table Createddate="08/08/2012" ReferralCount="10" />
  <Table Createddate="08/09/2012" ReferralCount="50" />
  <Table Createddate="08/10/2012" ReferralCount="10" />
  <Table Createddate="08/13/2012" ReferralCount="52" />
  <Table Createddate="08/14/2012" ReferralCount="39" />
  <Table Createddate="08/16/2012" ReferralCount="65" />
  <Table Createddate="08/17/2012" ReferralCount="17" />
  <Table Createddate="08/21/2012" ReferralCount="31" />
  <Table Createddate="08/22/2012" ReferralCount="8" />
  <Table Createddate="08/23/2012" ReferralCount="39" />
  <Table Createddate="08/24/2012" ReferralCount="81" />
  <Table Createddate="08/27/2012" ReferralCount="17" />
  <Table Createddate="08/28/2012" ReferralCount="24" />
  <Table Createddate="08/29/2012" ReferralCount="10" />
  <Table Createddate="08/30/2012" ReferralCount="43" />
  <Table Createddate="08/31/2012" ReferralCount="16" />
  <Table Createddate="09/03/2012" ReferralCount="12" />
  <Table Createddate="09/04/2012" ReferralCount="15" />
  <Table Createddate="09/05/2012" ReferralCount="33" />
  <Table Createddate="09/06/2012" ReferralCount="18" />
  <Table Createddate="09/07/2012" ReferralCount="3" />
  <Table Createddate="09/26/2012" ReferralCount="2" />
  <Table Createddate="10/20/2012" ReferralCount="21" />
  <Table Createddate="10/22/2012" ReferralCount="33" />
  <Table Createddate="10/29/2012" ReferralCount="1" />
  <Table Createddate="12/10/2012" ReferralCount="13" />
  <Table Createddate="12/11/2012" ReferralCount="5" />
  <Table Createddate="12/13/2012" ReferralCount="1" />
  <Table Createddate="12/14/2012" ReferralCount="4" />
  <Table Createddate="12/17/2012" ReferralCount="13" />
  <Table Createddate="12/18/2012" ReferralCount="5" />
  <Table Createddate="12/19/2012" ReferralCount="2" />
</NewDataSet>
Posted 19-Jan-13 0:41am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
Have a look here:
http://stackoverflow.com/questions/1773550/xml-json-conversion-in-javascript[^]
Or, you can try to remove this XML:
 <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="Table">
            <xs:complexType>
              <xs:attribute name="Createddate" msdata:ReadOnly="true">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="100" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:attribute>
              <xs:attribute name="ReferralCount" msdata:ReadOnly="true" type="xs:int" />
            </xs:complexType>
          </xs:element>
        </xs:choice>
      </xs:complexType>
    </xs:element>
  </xs:schema>
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 414
1 Maciej Los 180
2 Richard MacCutchan 140
3 DamithSL 129
4 Kornfeld Eliyahu Peter 119


Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 19 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid