473,397 Members | 2,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Loading and Persisting XMLDOM

Hello all,

I want to load an in-memory XmlDocument from the server to the client and
create an XMLDOM object using javascript.

I can do it from a url by calling this Javascript from the client.

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.load("url of the persisted file");

I am using .NET and want to fill the XMLDOM directly from an in-memory
XmlDocument object on the server.

As a workaround, I wrapped the .NET Xml control in a div ('divTest') and
called this javascript

var divTest = document.getElementById("divTest");
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(divTest.innerHTML);

this worked, but was extremely messy as innerHTML changes all node names to
uppercase -- not really an option.

My gut feeling is that this all very simple but I'm missing something. Is there
a way to read the OutputStream directly into a client-side object or some
such??

Anyone?

TIA

Robert Zurer
Jul 23 '05 #1
3 4231

Since this seems to be IE only, why not use the <xml> element?

<xml id="myxml" src="YOURFILEHERE"></xml> it'll loads all nodes in it,
then use js to access them by its ID.

Danny

On Tue, 28 Jun 2005 17:47:36 -0700, Robert Zurer <ro**********@zurer.com>
wrote:
Hello all,

I want to load an in-memory XmlDocument from the server to the client and
create an XMLDOM object using javascript.

I can do it from a url by calling this Javascript from the client.

var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.load("url of the persisted file");

I am using .NET and want to fill the XMLDOM directly from an in-memory
XmlDocument object on the server.

As a workaround, I wrapped the .NET Xml control in a div ('divTest') and
called this javascript

var divTest = document.getElementById("divTest");
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.loadXML(divTest.innerHTML);

this worked, but was extremely messy as innerHTML changes all node
names to
uppercase -- not really an option.

My gut feeling is that this all very simple but I'm missing something.
Is there
a way to read the OutputStream directly into a client-side object or some
such??

Anyone?

TIA

Robert Zurer


--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #2
VK
> I want to load an in-memory XmlDocument from the server to the client
and create an XMLDOM object using javascript.
You may want to use the built-in XML parser for this.
....
<pseudo-code - if IE>
try {
// Newest version for XP SP2 first:
var myDataIsland = new ActiveXObject("Msxml3.DOMDocument");}
catch (e1) {
// Then the older version:
var myDataIsland = new ActiveXObject("Msxml2.DOMDocument");}
}
var myInOutStream = new ActiveXObject("Microsoft.XMLHTTP");
<pseudo-code - read data>
<pseudo-code - if success>
myDataIsland.loadXML(myInOutStream.responseText);
From this point myDataIsland contains perfectly formatted and parsed

XML data.

Jul 23 '05 #3
In article <1120011629.93b3ffd4dcd55a44597afd5239594af9@teran ews>, dann90038
@bluebottle.com says...

Since this seems to be IE only, why not use the <xml> element?

<xml id="myxml" src="YOURFILEHERE"></xml> it'll loads all nodes in it,
then use js to access them by its ID.

Thanks for your response.
This was the idea but it seems that for some reason what ASP.NET XmlControl
does is put the xml on the page but with no enclosing tag that can be found by
javascript. There _is_ no <xml id="myxml" > tag, just the rest of the xml.
Very strange.

I think the intent of this control is to display the result of a transform
which it does very well. In that case it justs spits out the html, also with no
enclosing xml tag.

If I enclose the asp:Xml in a div, and give the div an id, I can access the
xml by the div's innerHTML property but that changes the node names in the xml
to uppercase. Using the div's innerText property only returns data that is
outside a tag so that doesn't work.

Robert Zurer

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Garyrek | last post by:
Hi I have an url where I have xml data POSTED and I need to parse the URL to read the data - Meanwhile here is my xml data =================================== <?xml version="1.0"...
5
by: floods | last post by:
I use Microsoft.XMLDOM load() method to load an XML file into memory and display some elements in the browser. However it apparently locks the file, since I get this error message whenever a...
1
by: Frank Drebin | last post by:
In ASP, I have something like this: Set conn = Server.CreateObject("ADODB.Connection") Set cmd = Server.CreateObject("ADODB.Command") Set adoStream = Server.CreateObject("ADODB.Stream")...
0
by: Robert Zurer | last post by:
Hello all, I want to load an in-memory XmlDocument from the server to the client and create an XMLDOM object using javascript. I can do it from a url by calling this Javascript from the...
5
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens...
2
by: nick.taylor | last post by:
Hi, I've been trying for weeks to figure out this problem. I'm developing a simple Javascript app that loads an XML file from a server, parses the contents, and displays them. But I am...
3
by: seejay1982 | last post by:
Hi, Is there any way to persist XML DOM using Javascript? The following code doesn't see to work if(window.ActiveXObject){ avXMLDoc=new ActiveXObject("Microsoft.XMLDOM"); ...
1
by: rahat09 | last post by:
I am trying to load xml file as well as xml as string input, and have written following code. This is working in IE but not in FireFox, can anyone help? ...
3
by: sandeep kumar shah | last post by:
I am facing one problem on loading the xml file The code is 1. XML file //attribute.xml <?xml version="1.0" encoding="UTF-8"?> <person> <name>sandeep</name> <address state="Goa �D;...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.