Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5985771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:34:40+00:00 2026-05-22T22:34:40+00:00

I am parsing XML with Javascript. My XML looks like this: <?ml version=1.0 encoding=UTF-8>

  • 0

I am parsing XML with Javascript. My XML looks like this:

<?ml version="1.0" encoding="UTF-8">
<IPC_XML>
<dfr>
<dfr>
<data>
<analog>
    <channel index="0">
        <label>Channel 1</label>
    </channel>
    <channel index="1">
        <label>Channel 2</label>
    </channel>
</analog>
</data>
</dfr>
</dfr>
</IPC_XML>

Ignore the strange structure (out of my control). I am running this JS code:

function updateAnalogCfgValues (xmlDoc) {
var analogCfgs = xmlDoc.selectNodes ("//channel");
var cfg = analogCfgs.nextNode ();
var cnt = 1;

while (cfg !== null) {
    var node = document.getElementById ("aChan"+cnt);
    var tmp = document.createElement ("b");
    tmp.innerText = cfg.selectSingleNode ("//label").text;
    node.appendChild (tmp);

    cfg = analogCfgs.nextNode (); cnt++;
}
}

When I look at stuff in the debugger, things seem fine. I can see the cfg variable changing and I can see that its first child is the <label> element whose value is also changing. The problem is, when I look at the HTML, all I see is ‘Channel 1’ repeated over and over. That text never changes. Any ideas?

EDIT: Any chance my selectSingleNode call is now ‘refreshing’ (for lack of a better term)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:34:41+00:00Added an answer on May 22, 2026 at 10:34 pm

    Looking at an XPath tutorial and getting some help from a co-worker led to the answer. I needed my search string to be .//Label. This selects my current channel node and then looks for the label node. Before, it was just searching the whole document for the first label node, which is why things didn’t change.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for a good JavaScript library for parsing XML data. It should
I am parsing some XML something like this: <root> <some_gunk/> <dupe_node> ... stuff I
I have an XML document with some sample content like this: <someTag> <![CDATA[Hello World]]>
I am parsing an XML document. I have done this thousands of times before,
I know it is used for parsing xml data and converting them into objects.Does
I am newbie in javascript xml data handling. Currently, my ajax call to a
I'm parsing XML results from an API call using PHP and xpath. $dom =
I am parsing XML with an XMLReader using a XMLReaderSettings object with the event
Is there a simple method of parsing XML files in C#? If so, what?
Following on from my recent question regarding parsing XML files in Java I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.