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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T13:05:13+00:00 2026-06-17T13:05:13+00:00

From the below xml how to find a node exists with value docx and

  • 0

From the below xml how to find a node exists with value docx and attribute indexed = 1?
I don’t want to use loop and this need to be done in JavaScript

<docs>
  <doc>
    <name indexed='1'>doc</name>
  </doc>
  <doc>
    <name indexed='1'>xls</name>
  </doc>
  <doc>
    <name indexed='0'>xlsx</name>
  </doc>
  <doc>
    <name indexed='1'>docx</name>
  </doc>
  ..
  ..
</docs>
  • 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-17T13:05:14+00:00Added an answer on June 17, 2026 at 1:05 pm

    Assuming your platform is a web browser you can use jQuery:

    var xml = '<docs>\n<doc>\n<name indexed="1">doc</name>...</docs>';
    var docxIndexed1 = $(':contains("docx")', xml).find('[indexed=1]');
    
    docxIndexed1; // => [ <name indexed=​"1">​docx​</name>​ ]
    

    Or if you do not want to use jQuery and only the built in DOMParser:

    var xml = '<docs>\n<doc>\n<name indexed="1">doc</name>...</docs>'
      , parser = new DOMParser()
      , doc = parser.parseFromString(xml, 'application/xml')
      , elements = [].slice.apply(doc.getElementsByTagName('*'));
    var docxIndexed1 = elements.filter(function(x) {
      return (x.textContent === 'docx') && (x.getAttribute('indexed') === '1')
    });
    
    docxIndexed1; // => [ <name indexed=​"1">​docx​</name>​ ]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I m using the code below to get value of node from a XML
From below array i want the value of _sql to be displayed or we
I have an xml file as below and I want to read data from
From the XML below I'm trying to retrieve the second element in the sequence.
I am trying to parse data from the XML below (I shortened the data
I'm trying to extract the StateLongName and StateShortName values from the xml below. I
Given the XML/RDF example below taken from the W3C website, how can I access
The code below correctly returns the XML from the soap sever that I'm accessing.
Below is an excerpt from an .svg file (which is xml): <text xml:space=preserve style=font-size:14.19380379px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu
i need Enumarable value from below class but give error public static Enumerable LoadDataByName(string

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.