SQL Server Performance

XML Parsing error.

Discussion in 'General Developer Questions' started by Raulie, Feb 4, 2004.

  1. Raulie New Member

    After a lot of trial and error I almost got it. I am passing an xml string to a stored procedure from ASP. Everything almost works exept when it passes the sting into the stored proc it looks invalid. I captured the action in SQL Profiler and here is how is processing the xml string.<br /><br />(From Profiler SQL<img src='/community/emoticons/emotion-7.gif' alt=':S' />tmtStarting)<br />exec usp_InsertFromXml '&lt;ROOT&gt;&lt;ROWps_id="1"psid_id="1"tipPrd_id="1"/&gt;&lt;ROWps_id="1"psid_id="1"tipPrd_id="1"/&gt;&lt;/ROOT&gt;'<br /><br />For some reason it is not puting spaces inbetwean the string I copied and ran these two statements from QA<br /><br />exec usp_InsertFromXml '&lt;ROOT&gt;&lt;ROWps_id="1"psid_id="1"tipPrd_id="1"/&gt;&lt;ROWps_id="1"psid_id="1"tipPrd_id="1"/&gt;&lt;/ROOT&gt;'<br /><br />exec usp_InsertFromXml '&lt;ROOT&gt;&lt;ROW ps_id="1" psid_id="1" tipPrd_id="1"/&gt;&lt;ROW ps_id="1" psid_id="1" tipPrd_id="1"/&gt;&lt;/ROOT&gt;'<br /><br />The second one I put spaces inbetween everything and it worked fine, but the first one gave me a parsing error. for some reason when it is getting passed from ASP it is sending it invalid.
  2. Raulie New Member

    Incase anyone interested some very helpful person (Gabriel) gave me a solution.
    in Jscript I was sending the XML like this
    var sSend = "xmldoc=" + document.all("xmldoc").documentElement.xml;

    He told me to add the escape function and it worked.


    var sSend = "xmldoc=" + escape(document.all("xmldoc").documentElement.xml);

    I know this is a SQL Forum and not an ASP Forum, but thought it was worth mentioning the solution.

Share This Page