Solved

Does getNodeName() function exist?????

Posted on 2006-06-30
6
214 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Change to event 1 113
Scraping specific data within an XML document 19 57
Test ddwrt:UserLookup 1 65
.net and XML report from SCCM 5 25
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, …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

809 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