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 8311481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:49:49+00:00 2026-06-08T19:49:49+00:00

Hi I am trying to access a node’s elements with childNodes. Here is a

  • 0

Hi I am trying to access a node’s elements with childNodes. Here is a sample XML

<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node>
 <nodeid>28</nodeid> 
 <account_no xsi:nil="true" /> 
 <address1>15 CANCUN CT</address1> 
 <serial_no>112199543</serial_no> 
 <x_lat>25.95513358000</x_lat> 
 <y_lon>-97.49027147000</y_lon> 
 <alarm>
  <alarmid>Outage</alarmid> 
  <alarmtime>2012-07-30T14:46:29</alarmtime> 
 </alarm>
 <alarm>
  <alarmid>Restore</alarmid> 
  <alarmtime>2012-07-30T14:48:37</alarmtime> 
 </alarm>
 </node>
</ROOT>

I’m trying to get the second childNodes but can’t using javascript. I can however get the nodevalues from the first by this js code.

var alarmId = xmlDocOut.getElementsByTagName('alarmid')[i].childNodes[0].nodeValue;
var alarmTime = xmlDocOut.getElementsByTagName('alarmtime')[i].childNodes[0].nodeValue;

If i try to use …[i].childNodes[1].nodeValue the js will throw an error saying ‘Object Required’ on that line.
I’ve tried

...[i].childNodes[1...4].nodeValue 

and

...[i].childNodes[0].childNodes[0].nodeValue.  

And still nothing!

  • 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-06-08T19:49:50+00:00Added an answer on June 8, 2026 at 7:49 pm

    i got it, i just had to add an …[i+1].childNodes[0].nodeValue to the subscript to get the second alarm elements.

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

Sidebar

Related Questions

Given the following XML: <?xml version=1.0?> <soap:Envelope xmlns:soap=http://www.w3.org/2003/05/soap-envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema> <soap:Body> <GetMsisdnResponse xmlns=http://my.domain.com/> <GetMsisdnResult>
Here is the xml I am trying to access: <resourceStrings> <globalStrings> <string> <key>RptTitle1</key> <value>Title1</value>
I'm trying to access an XML file using DOM. One node is already commented
I'm trying to access node node for this JSON message: { nodes: [ {
I am trying to access a file for xml parsing with this: InputStream inputStream
What is the best practice for coordinating access to files in node.js? I'm trying
I´m trying to sign some text or XML node using my certificates, installed on
I'm trying to access a particular native Windows API call from within a node.js
I'm trying to access cookies using client-side javascript. On the server I'm using node.js
I am trying to parse the following xml. I can access the WeekNumber easily

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.