473,772 Members | 3,603 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XML DOM in IE using Javascript

I am tryint to view a xml document in Internet Exploer as a ActiveX
object using Javascript but it does not work. I only see the button
but nothing happens when i click it. I am trying to view the
'firstChild' of the xml document.

here is the code;
----------------------------------------------------------------
<html>
<head>
<script language="javas cript">
<!--
function alert()
{

var xmldoc, meetingsNode, meetingNode;
xmldoc = new ActiveXObject(" Microsoft.XMLDO M");
xmldoc.load("me mbers.xml");
document.write( "works so far");

meetingsNode = xmldoc.document Element;
document.write( "works so far");
meetingNode = meetingsNode.fi rstChild;
//does not process after this line

document.writel n(meetingNode);

}
//-->
</script>

<title>Read Members.xml</title>
</head>

<body>

<input type="button" name="submit" onclick="alert( )" />

</body>
</html>
Jul 23 '05 #1
2 2757
On Sat, 23 Apr 2005 14:51:50 -0700, in comp.lang.javas cript Kenneth
<ja********@hot mail.com> wrote:
| I am tryint to view a xml document in Internet Exploer as a ActiveX
| object using Javascript but it does not work. I only see the button
| but nothing happens when i click it. I am trying to view the
| 'firstChild' of the xml document.
|
| here is the code;
| ----------------------------------------------------------------
| <html>
| <head>
| <script language="javas cript">
| <!--
| function alert()
| {
| var xmldoc, meetingsNode, meetingNode;
| xmldoc = new ActiveXObject(" Microsoft.XMLDO M");
| xmldoc.load("me mbers.xml");
| document.write( "works so far");
| meetingsNode = xmldoc.document Element;
| document.write( "works so far");
| meetingNode = meetingsNode.fi rstChild;
| //does not process after this line
| document.writel n(meetingNode);
| }
| //-->
| </script>
|
| <title>Read Members.xml</title>
| </head>
| <body>
| <input type="button" name="submit" onclick="alert( )" />
| </body>
| </html>


alert is a predefined javascript function. You might give your
function another name i.e. xalert() and see what happens.
---------------------------------------------------------------
jn******@yourpa ntsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #2


Kenneth wrote:
I am tryint to view a xml document in Internet Exploer as a ActiveX
object using Javascript but it does not work. I only see the button
but nothing happens when i click it. I am trying to view the
'firstChild' of the xml document. var xmldoc, meetingsNode, meetingNode;
xmldoc = new ActiveXObject(" Microsoft.XMLDO M");
xmldoc.load("me mbers.xml");
document.write( "works so far");


Loading happens asynchronously by default so you either need an
onreadystatecha nge handler e.g.

var xmlDocument = new ActiveXObject(' Microsoft.XMLDO M');
xmlDocument.onr eadystatechange = function () {
if (xmlDocument.re adyState == 4) {
alert(xmlDocume nt.xml);
}
};
xmlDocument.loa d('test20050423 01.xml');

or you need to load synchronously

var xmlDocument = new ActiveXObject(' Microsoft.XMLDO M');
xmlDocument.asy nc = false;
var wellFormed = xmlDocument.loa d('test20050423 01.xml');
if (wellFormed) {
alert(xmlDocume nt.xml);
}

but inside the browser synchronous loading blocks the user agent so that
you would better use asynchronous loading as described above.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #3

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

Similar topics

15
3703
by: Mel | last post by:
if you know of dynamic expandable folder using CSS and display function, please drop me a note Yours, Mel
13
9650
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be assigned to a variable and output using document.write. (Note, there is no submit button or other form elements. Basically
7
21317
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of someone (client) that visits a web site through an anonymous proxy if this person ONLY has JavaScript enabled in their browser? This is NOT a question about PHP, perl, VBScript, Java(.class), or ActiveX. Let us _only_ deal with JavaScript for...
0
6437
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to be modified: if(e.CommandName =="Print") { string parsedreceipt = null; parsedreceipt = DecodeReceipt (e.Item.Cells.Text); Session = parsedreceipt;
2
4064
by: Jeronimo Bertran | last post by:
A couple of questions I am having problems with converting my JavaScript to C#. I have the following code using JavaScript for the mouseover handler that works fine: <SCRIPT language=JavaScript> function MyMouseOver() {
2
3059
by: Jake Barnes | last post by:
Using javascript closures to create singletons to ensure the survival of a reference to an HTML block when removeChild() may remove the last reference to the block and thus destory the block is what I'm hoping to achieve. I've never before had to use Javascript closures, but now I do, so I'm making an effort to understand them. I've been giving this essay a re-read: http://jibbering.com/faq/faq_notes/closures.html
8
2818
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);" TextBox2.Attributes.Add("onKeyPress", jscode) You will notice that jscode contains the JavaScript Logical And operator (&&). However, ASP.NET renders this as &amp;&amp; in the code that is
0
4925
AnuSumesh
by: AnuSumesh | last post by:
Hi All, I want to call RDP on Page load and it is working fine.My code is in C#. But I am unable to perform following functions 1. when i disconnected from RDP, i want to go back to previous page 2. If RDP is opened in fullscreen mode, then onconnected, i want to go back to previous page.
7
2024
by: JDOMPer | last post by:
Don’t misunderstand me – I use AJAX, but I think there is a far simpler, elegant alternative that just uses Javascript, the DOM and Php ( hence - JDOMP) for data transfers, and is cross-browser without the need for work arounds. JDOMP works in recent versions of Explorer, Mozilla, Safari and Opera. Please note I will not deal with security issues which are always an issue whenever there is access to a database. You can simply change text on...
6
3555
Frinavale
by: Frinavale | last post by:
Apparently I have a lot of questions today regarding JavaScript security. I've implemented a JavaScript Object that intercepts page submits (postbacks) and then displays a UI prompting the user to confirm(yes)/deny(no)/cancel(close UI/cancel submit) their action. There may be additional JavaScript methods to execute before displaying the UI and may be additional JavaScript methods to execute upon closing the UI. I'm thinking about...
0
9454
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
10104
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
10038
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
9912
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
8934
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
6715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
3
2850
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.