Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


XML Posted documents fail

From: sdortch@----.---
To: NULL
Date: 11/1/2006 11:19:00 AM

I have had an application running for a few years that has been working
with no problems.  Recently I upgraded my browser to IE7 and started
experiencing problems.

I had a page with a huge textarea in which I would copy in an XML
document.  I then would push a button and the text would be loaded as
an XMLDOM object and posted to an XSQL page on the same server.  The
returned XML response would be parsed and the results shown.

My guess would be that either
  a) There are some security settings that have changed in the browser.
(If so, what are they and how can I either rewrite the code to not fail
on them?)
  b)  Some of the functionality of either the XMLDom or the
Microsoft.XMLHTTP has changed. (Again what can be done to correct?)

The core of the code is something like this:

<HTML>
  <HEAD>
    <SCRIPT src="../PostXMLDocument.js"></SCRIPT>
    <SCRIPT>
      function parseXMLinTextAreaAndPostIt(){
        StatusArea.innerText = "";
        // Create a new XML Parser Object
        var xmldoc  = new ActiveXObject ("Microsoft.XMLDOM");
        // Do the parsing synchronously
        xmldoc.async = false;
        // Parse the text in the TEXTAREA as XML
        xmldoc.loadXML(xmldocText.value);
        // check load for success
        err = xmldoc.parseError;
        if (err != 0) {
          StatusArea.innerText = "Your XML document is not
well-formed.\n" + err.srcText +
          "\n" + "Line " + err.line + ", Pos " + err.linepos + "\n" +
err.reason;
        return;
        }

        // Post the parsed XML document to the xsql Page
        var response = PostXMLDocument(xmldoc, "send_order.xsql");
        // Display the XML text of the response in the "StatusArea" DIV
        var result = response.selectSingleNode("//OK");
        if (result != null) {
          StatusArea.innerText = response.documentElement.xml;
          alert("Successfully posted: \n" + result.text);
        }
        else {
          result = response.selectSingleNode("//ERROR");
          if (result != null) {
            alert(result.text);
          }
      else {
        alert("No XML response received.");
      }
    }
}
    </SCRIPT>
  </HEAD>
  <BODY>
    <b>Paste or type in an XML Document:<b><br>
    <TEXTAREA rows="18" style="width:100%" cols="80" name="xmldocText">
</TEXTAREA>
    <INPUT TYPE="button" Value="Post XML Document"
           onclick="parseXMLinTextAreaAndPostIt()">
    <br><br>Response:<hr>
    <DIV id="StatusArea" style="font-family:monospace"></DIV>
  </BODY>
</HTML>


The PostXMLDocument.js is very simple as well and looks like this:

// Uses HTTP POST to send XML Document "xmldoc" to URL "toURL"
function PostXMLDocument (xmldoc, toURL)
{
   var oReq = new ActiveXObject("Microsoft.XMLHTTP");
   oReq.open("POST", toURL, false);
   oReq.setRequestHeader('Content-type','text/xml');
   oReq.send(xmldoc);
   return oReq.responseXML;
}



transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent