473,604 Members | 2,667 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.XMLDO M");
xmlDoc.async = "false";
xmlDoc.load("ur l 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.getEle mentById("divTe st");
var xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.async = "false";
xmlDoc.loadXML( divTest.innerHT ML);

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 4264

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

<xml id="myxml" src="YOURFILEHE RE"></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**********@z urer.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.XMLDO M");
xmlDoc.async = "false";
xmlDoc.load("ur l 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.getEle mentById("divTe st");
var xmlDoc = new ActiveXObject(" Microsoft.XMLDO M");
xmlDoc.async = "false";
xmlDoc.loadXML( divTest.innerHT ML);

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.DOMDocum ent");}
catch (e1) {
// Then the older version:
var myDataIsland = new ActiveXObject(" Msxml2.DOMDocum ent");}
}
var myInOutStream = new ActiveXObject(" Microsoft.XMLHT TP");
<pseudo-code - read data>
<pseudo-code - if success>
myDataIsland.lo adXML(myInOutSt ream.responseTe xt);
From this point myDataIsland contains perfectly formatted and parsed

XML data.

Jul 23 '05 #3
In article <1120011629.93b 3ffd4dcd55a4459 7afd5239594af9@ teranews>, dann90038
@bluebottle.com says...

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

<xml id="myxml" src="YOURFILEHE RE"></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
4577
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" encoding="utf-16"?> <?adf version="1.0"?> <!DOCTYPE adf SYSTEM "http://whoscalling.com/dtd/adfdtd.dtd"> <adf> <prospect status="new">
5
4378
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 Visual Basic application concurrently tries to add an element to the same XML file: The process cannot access the file because it is being used by another process.
1
2935
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") conn.Open strConnString Set cmd.ActiveConnection = conn cmd.CommandText = strSQL adoStream.Open cmd.Properties("Output Stream").Value = adoStream
0
947
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 client. var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.load(url);
5
4828
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 automatically if the data doesn't change. But if records have been added or deleted then it looks as if some code is necessary: I've done this by using GridView.SelectedValue to get the key value of the currently selected Row and then by itterating...
2
2834
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 encountering a very mysterious bug that I can't seem to get rid of. When loading the page in Internet Explorer, everything works, and in Firefox it works except for one problem: the page never stops loading. The script runs and everything parses but it...
3
2371
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"); avXMLDoc.async="false"; avXMLDoc.load("Formats.xml"); getData();
1
1557
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? ------------------------------------------------------------------------------------------------------- function MyXML() { try{ this._xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); this._flag = 1; }
3
2837
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; Panjim" distt="madgaon"/>
0
7997
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7929
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8065
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8274
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6737
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3954
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2433
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1262
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.