473,699 Members | 2,331 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 4272

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
4579
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
4380
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
2940
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
952
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
4835
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
2837
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
2373
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
1567
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
8700
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
8623
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,...
0
9048
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8931
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
7767
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...
1
6539
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4635
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3064
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

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.