Solved

Does getNodeName() function exist?????

Posted on 2006-06-30
6
217 Views
Last Modified: 2006-11-18
Hi, I 'm working with XML and XPATH

var nodes = xmlDoc.selectNodes( "//"+oNodeName );              
for(var i=0;i<nodes.length;i++)
{
alert("---> "  + nodes[i].getAttribute("ExternalKey")); // THIS FIRST STATEMENT GOES WELL
alert("---> "  + nodes[i].getNodeName());                 // THIS SECOND STATEMENT GOES BAD.....
}  

The message in browser is:
     <<<<<<< The object does not support this method >>>>>>>

1. I NEED TO GETTHE NODE CHILD NAME.
2. CAN I CREATE A NEW ATTRIBUTE TO THIS NODE CHILD? CAN YOU GIVE ME A SAMPLE?

Help me, please!!!!
0
Comment
Question by:jorgeani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 17017369
you could try something like that:

if (node.HasChildNodes) {
 string childname = node.FirstChild.FirstChild.Name();
}
0
 
LVL 35

Expert Comment

by:YZlat
ID: 17017385
sorry, my bad:

if (node.HasChildNodes) {
 string childname = node.FirstChild.Name();
}
0
 

Author Comment

by:jorgeani
ID: 17017412
I´m using XPATH in Javascript
0
Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

 
LVL 52

Expert Comment

by:Carl Tawn
ID: 17017416
Assuming this is javascript, try:

    alert("---> " + nodes[i].nodeName);
0
 
LVL 35

Accepted Solution

by:
YZlat earned 125 total points
ID: 17017429
if (node.HasChildNodes) {
 string childname = node.FirstChild.Name;
 child = node.FirstChild;
 XmlAttribute attr;
 attr = doc.CreateAttribute("test");
 attr.Value = "3";
 child.Attributes.Append(attr);
}
0
 

Author Comment

by:jorgeani
ID: 17017439
THANKS!!!!!!!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question