Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: data island creation using reponseText

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 7/6/2007 9:29:00 AM


<clockemail@a...> wrote in message
news:1183653614.908936.37170@n......
> I welcome all suggestions as to how to solve the following problem,
> and I am fully prepared for mountains of criticism!.
>
> I am now prohibited from using XMLHttpRequest and template queries to
> return data from an SQL database as I had previously done. Therefore,
> I have been using an XMLHttpRequest to return the responseText of an
> aspx page that adds the returned data to a blank page using
> Response.Write. The blank aspx page has the following XML added to it
> by code.
> <xml>
>    <loaninfo>
>        <borrower>
>            <firstname>John</firstname>
>            <middlename>Fred</middlename>
>            <lastname>Harris</lastname>
>        </borrower>
>        <borrower>
>            <firstname>Frank</firstname>
>            <middlename>Bob</middlename>
>            <lastname>Smith</lastname>
>        </borrower>
>    </loaninfo>
> </xml>
>
> I use the following JavaScript code to return this xml to the aspx
> page where it is needed. The aspx page has the following data island
> included within the html.
>
> <xml id="xmlDataIsland">
> </xml>
>
> The http variable below has been properly set elsewhere in the code. I
> am just trying to minimize the necessary code inclusion.
>
> var url = "CreateXMLFile.aspx?strSearch=" + strSearchTerm;
> http.open("GET", url, true);
> http.onreadystatechange = handleHttpManualSearch;
> http.send(null);
>
> function handleHttpManualSearch() {
> if (http.readyState == 4)
> {
>    var strXML = http.responseText;
>    document.getElementById("xmlDataIsland").InnerXml = strXML;
>    alert("strXML = " +
> document.getElementById("xmlDataIsland").InnerXml);
> }
>
> The alert displays the xml exactly as it appears on the aspx page from
> which it was taken, including the <xml> tags. However, I have failed
> to find a way to refer to elements within the data island (I have also
> removed the <xml> tags from the responseText, which did not solve the
> problem). Is there a way in which I can step through the borrower
> nodes to obtain the data contained within, and make use of it in
> JavaScript? I was looking for something similar to the way that I
> would handle a responseXML in the following manner.
>
> var xmlDocument = http.responseXML;
> var root = xmlDocument.documentElement;
> if(root.getElementsByTagName('Message').length > 0)
> {
>    var strMessage =
> root.getElementsByTagName('borrower').item(0).firstChild.data;
> }
>

I'm a bit confused why you need to use data islands?
XMLHttpRequest has a ResponseXML property which will return an XML DOM when
the response content type is "text/xml".




transparent
Print
Mail
Like It
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