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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:50:05+00:00 2026-06-07T03:50:05+00:00

I am trying to extract data from xml file that looks like this (see

  • 0

I am trying to extract data from xml file that looks like this (see below). I need to extract id inside nodes for node where type=0. I have to find solution for R only.
For now I can extract type by xmlToList(“test.xml”)[[3]][[1]] and id by xmlToList(“test.xml”)[[3]][[4]]. Changing 3 to 6,9,etc – I can retrieve all of needed type’s and id’s. But I am not sure that this correct because it is based on numbering that can be changed (in case of xml structure change). Can you please propose another more simple way of extracting data from xml ? or any modifications on my nonideal solution? Thank’s!

<?xml version="1.0" encoding="UTF-8"?>
<image name="test1" id="367432589" width="952" height="1024" create_date="Mar 2, 2009" >
  <nodes>
    <node type="16" name="Target532" url="/cgi/im?id=5657" id="5657" x="67" y="45" width="153" height="69">
      <alt>Synthesis1</alt>
      <Appearance TextArea="Rectangle: 550"  Comlex="Boolean: true" />
    </node>
    <node type="0" name="Target1" url="/cgi/im?id=680" id="680" x="193" y="535" width="70" height="70">
      <alt>Object &lt;b&gt;Target1&lt;TestingCond32</alt>
      <Appearance TextArea="Rectangle: 210"  Comlex="Boolean: false" />
    </node>
  </nodes>
  <edges>
    <edge type="-100" id="234523">
      <alt />
      <Appearance Visualization="String: Hexa" HexagonIndex="Integer: 0" />
    </edge>
    <edge type="-100" id="23">
      <alt />
      <Appearance Visualization="String: Hexa" HexagonIndex="Integer: 0" />
    </edge>
  </edges>
</image>

I am new to xml and have basic knowledge of R. Thank you!

  • 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-07T03:50:06+00:00Added an answer on June 7, 2026 at 3:50 am

    You can try the following

    xpathSApply(xdata,"//*/node[@type=\"0\"]/@id")
    
    > xpathSApply(xdata,"//*/node[@type=\"0\"]/@id")
       id 
    "680" 
    

    This looks for a node that is named “node” with attribute “type” with a value of 0. It then returns the attribute value of id associated with this node

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

Sidebar

Related Questions

I'm trying to create a C# application that extracts data from pages like this
I'm trying to extract data from an xml file. A sample of my code
I've got a xml that I'm parsing and trying to extract some data from.
I'm trying to get data from a webpage that serves a XML file periodically
I'm trying to extract data from an xml file. The problem is I know
I am trying to extract data from a xml file, get rid of the
I am trying to extract data from XML file and save it my C#
I'm trying to import a csv (that is a data extract from a SQL
I am trying to extract an XML node from a URI reference. This URI
I'm trying to extract some information from an xml file using xslt. I've used

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.