Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Does getNodeName() function exist?????

Posted on 2006-06-30
6
Medium Priority
?
220 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
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!

 
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 500 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

596 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