www.webdeveloper.com
Results 1 to 2 of 2

Thread: Internet Explorer/Microsoft.XMLDOM escaping quotes?

  1. #1
    Join Date
    Jun 2009
    Posts
    2

    Internet Explorer/Microsoft.XMLDOM escaping quotes?

    I'm trying to get a SOAP related script working in Firefox and IE. It works fine in Firefox, but I'm getting an error server side when I send the message. I'm still trying to figure out how to see the incoming message on the server side, but in the meantime, I noticed that when my script reads in a file over http from Firefox, it looks fine:

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">\n <soapenv:Header/>\n <soapenv:Body>\n <sch:TablexRequest xmlns:sch="http://mike.test/springws/schemas">\n <sch:String1>From HTML!</sch:String1>\n <sch:String2>YAY!?</sch:String2>\n </sch:TablexRequest>\n </soapenv:Body>\n</soapenv:Envelope>
    When I read the same file in from Internet explorer, I see:
    <?xml version=\"1.0\"?>
    <soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">
    <soapenv:Header/>
    <soapenv:Body>
    <sch:TablexRequest xmlns:sch=\"http://mike.test/springws/schemas\">
    <sch:String1>From HTML!</sch:String1>
    <sch:String2>YAY!?</sch:String2>
    </sch:TablexRequest>
    </soapenv:Body>
    </soapenv:Envelope>
    While I notice the firefox version lacks the '?xml? header, it works. On the other hand, Internet explorer has escaped out all of the double quotes. I'm guessing this is what my server side code is objecting to. Is there a way to prevent XMLDOM from doing this?

    Here is how I load my xml docs:

    Code:
    		getXmlDocObject : function() {
    			var xmlDoc = false;
    	
    			if (window.ActiveXObject)
    			{
    				xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
    			}
    			//code for Mozilla, Firefox, Opera, etc.
    			else if (document.implementation
    					&& document.implementation.createDocument)
    			{
    				xmlDoc=document.implementation.createDocument("","",null);
    			}
    			else
    			{
    				alert('Your browser cannot handle this script');
    			}
    			return  xmlDoc;
    		},
    
    		loadXmlDoc : function (url) {
    			var xmlDoc = this.getXmlDocObject();
    			
    			xmlDoc.async=false;
    			xmlDoc.load(url);
    			return xmlDoc;
    		},
    Any ideas would be appreciated.

    Thanks,
    Mike

  2. #2
    Join Date
    Jun 2009
    Posts
    2
    So it turns out the escaped-quotes are an internal representation only. My problem was that the XML transform was putting an encoding type in the xml prolog which did not reflect the encoding used in the HTTP POST of the message. I strip out the prolog before sending the message now.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles