Xml Conversion "Type mismatch" Error

Posted by prema on Stack Overflow See other posts from Stack Overflow or by prema
Published on 2012-03-30T10:50:52Z Indexed on 2012/03/30 11:30 UTC
Read the original article Hit count: 203

Filed under:
|

I am selecting a query in sql server 2005

SELECT 'Region' AS ELEMENT,(SELECT GeographyName,GeoID from @tmpTable FOR XML RAW, TYPE) FOR XML RAW('Root')

This will give the output in xml as

 <Root ELEMENT="Region">
  <row GeographyName="East" GeoID="2" />
  <row GeographyName="West" GeoID="3" />
  <row GeographyName="North" GeoID="4" />
  <row GeographyName="South" GeoID="5" />
</Root>

In aspx page, i want to get this

 function Populatedata(obj, val) {
    var xmlDom = new JXmlDom(obj, false);  --> at this point i am getting error
    var nodeHeader = xmlDom.selectNodes("//row");

   // my code goes here
}

function JXmlDom (xml,isFile) {
    this.load=load;
    this.loadXML=loadXML;
    this.selectNodes=selectNodes;
    this.text=text;
    this.selectSingleNode=selectSingleNode;
    this.documentElement=documentElement;
    this.transformNode=transformNode;
    if (isFile) {
        this.dom=this.load (xml);

    }else {

        this.dom=this.loadXML (xml);

    }
function loadXML (xml) {
         if (window.ActiveXObject) {
            var dom=new ActiveXObject("Microsoft.XMLDOm");
            dom.async=false;
            dom.loadXML (xml);
        }
        if (document.implementation && document.implementation.createDocument) {
            var domParser=new DOMParser();
            var dom=domParser.parseFromString (xml,"text/xml");
        }
        return dom;
    }

But when i am calling this i am getting an error as Type mismatch.Can anyone help me

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql-server-2005