473,785 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Item List for XML Node in IE

Hi All,

I am facing a problem regarding accessing the item list of an XML node
in IE.
While using the following code:

for(test in XMLNode) {}

I received this XML Node from AJAX's responseXML. This fetches item
list in Mozilla and Opera, however it creates errors in IE.

Any help or support will be highly appreciated.
Prashant Mahajan
Interra Information Technologies (India) Pvt. Ltd.
E-21, NSEZ, NOIDA, U.P. 201305
Web-Site : http://geocities.com/mrprashantmahajan

Jan 19 '07 #1
3 2133
Prashant Mahajan wrote:
I am facing a problem regarding accessing the item list of an XML node
in IE.
While using the following code:

for(test in XMLNode) {}

I received this XML Node from AJAX's responseXML.
You can access XMLNode.childNo des, the child nodes that nodes have, as a
node list. You can then iterate over that list with a normal for loop
for (var i = 0, c = XMLNode.childNo des, l = c.length; i < l; i++) {
var child = c[i];
}

On the other hand your example does not really make sense to me if
XMLNode is really a single XML DOM node as that loop would then iterate
over the property names of that node.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 19 '07 #2

Martin Honnen wrote:
Prashant Mahajan wrote:
I am facing a problem regarding accessing the item list of an XML node
in IE.
While using the following code:

for(test in XMLNode) {}

I received this XML Node from AJAX's responseXML.

You can access XMLNode.childNo des, the child nodes that nodes have, as a
node list. You can then iterate over that list with a normal for loop
for (var i = 0, c = XMLNode.childNo des, l = c.length; i < l; i++) {
var child = c[i];
}

On the other hand your example does not really make sense to me if
XMLNode is really a single XML DOM node as that loop would then iterate
over the property names of that node.
--

Martin Honnen
http://JavaScript.FAQTs.com/
I am sorry If I stated the question in an incorrect way. I don't want
the children of the XML node. I want to iterate through the item list
of the object. Items like:
1. XMLNode.nodeNam e
2. XMLNode.getAttr ibute
3. XMLNode.childNo des
4. XMLNode.nodeVal ue
5. XMLNode.nodeTyp e
6. XMLNode.parentN ode
7. XMLNode.firstCh ild
and so on...

Jan 19 '07 #3
Prashant Mahajan wrote:
I am sorry If I stated the question in an incorrect way. I don't want
the children of the XML node. I want to iterate through the item list
of the object. Items like:
1. XMLNode.nodeNam e
2. XMLNode.getAttr ibute
3. XMLNode.childNo des
4. XMLNode.nodeVal ue
5. XMLNode.nodeTyp e
6. XMLNode.parentN ode
7. XMLNode.firstCh ild
These are the properties/members of the object. But XML nodes are host
objects and for..in enumerates the enumerable properties of an object
where host objects are free to define which properties are enumerable
and which not. Thus if for..in with a host object does not enumerate the
properties you are expecting there is nothing you can change in your code.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 19 '07 #4

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

Similar topics

25
7595
by: Matthias | last post by:
Hi, I am just reading that book by Scott Meyers. In Item 4 Meyers suggests to always use empty() instead of size() when probing for emptyness of STL containers. His reasoning is that size() might take linear time on some list implementations. That makes sense at first. However, he also says this at the very beginning: "That being the case , you might wonder why one construct should be preferred to the other, especially in view of the...
16
2711
by: forester | last post by:
lets say its common situation when object have subobjects in container and receives callbacks from contained items. and object want to move objects in containers on signal(callback). iterator is needed for container modifications, item cannot know its iterator, at least its not easy to do so and i think cannot be done type-safe avoiding virtual functions and stuff. 'this' pointer from items is a freeby :>. the problem is, std...
10
15134
by: Kent | last post by:
Hi! I want to store data (of enemys in a game) as a linked list, each node will look something like the following: struct node { double x,y; // x and y position coordinates struct enemy *enemydata; // Holds information about an enemy (in a game) // Its a double linked list node
7
2614
by: Kieran Simkin | last post by:
Hi all, I'm having some trouble with a linked list function and was wondering if anyone could shed any light on it. Basically I have a singly-linked list which stores pid numbers of a process's children - when a child is fork()ed its pid is added to the linked list. I then have a SIGCHLD handler which is supposed to remove the pid from the list when a child exits. The problem I'm having is that very very occasionally and seemingly...
3
2339
by: sugaray | last post by:
hi, i have to build a linked-list which has another sturcture _score as it's data entry, so how can i sort such linked-list based on, let say, history score into proper order (descending/ascending). thanx for your help ! struct _score { float literature; float history; float sociology; };
4
3604
by: JS | last post by:
I have a file called test.c. There I create a pointer to a pcb struct: struct pcb {   void *(*start_routine) (void *);   void *arg;   jmp_buf state;   int    stack; };   struct pcb *pcb_pointer;
13
2194
by: XXXXXX.working.in.my.blood | last post by:
hi all, i need help with linked lists... the problem is this, "reverse the contents of a singly linked list without using a temporary node"... solution with code will be appreciated...
6
3119
by: Brad Pears | last post by:
As part of my vb.net 2005 application I would like to automatically select the very first item (index 0) in a listview containing menu items. That way the the listviews "afterselect" event would fired - hence running the code pertaining to that first menu item. How can I do this in code? Thanks, Brad
0
8633
by: Atos | last post by:
SINGLE-LINKED LIST Let's start with the simplest kind of linked list : the single-linked list which only has one link per node. That node except from the data it contains, which might be anything from a short integer value to a complex struct type, also has a pointer to the next node in the single-linked list. That pointer will be NULL if the end of the single-linked list is encountered. The single-linked list travels only one...
0
9645
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
9481
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
10336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10095
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
9953
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
6741
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
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3655
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
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.