Solved

Does getNodeName() function exist?????

Posted on 2006-06-30
6
200 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
  • 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now