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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:02:33+00:00 2026-06-13T08:02:33+00:00

<?xml> <env> <body> <folderxml> <folder id=’1′> <folder id=’2′ name =’document’> <folder id=’3′ name =’Music’>

  • 0
<?xml>
<env>
<body>
<folderxml>
<folder id='1'>
 <folder id='2' name ='document'>
   <folder id='3' name ='Music'>
     <folder id= '4' name= 'album' xlink='true'>
     </folder>
   </folder>
</folder>
</folder>
</folderxml>
</body>
</env>

I need the path if the attribute ‘link’ is true. Something like xpath.evaluate(path if(link=true)). The result should be something like “/documents/music/album”

  • 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-13T08:02:34+00:00Added an answer on June 13, 2026 at 8:02 am

    After applying the following XPath expression (based on XPath tutorial):

    xmlXPathEval("//*[@xlink='true']", doc)
    

    you obtain a link to the node list. In the example it is a single node folder with id 4. Then you need to write a function that will travell all the parents and concatenate their name attributes.

    If you needed only the name of the matching folder, than you could go with

    xmlXPathEval("string(//*[@xlink='true']/@name)", doc)
    

    and read the stringval member of the result. But that matches only the first node.

    Edit: As for the function to iterate over parents I thought of direct access through xmlNodePtr->parent member and reading attributes with xmlGetProp. But as I see your comment (and also the title of the question) I think that you could make use of relative xpath queries, see What’s the most efficient way to do recursive XPath queries using libxml2?.

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

Sidebar

Related Questions

For example, In this document < ?xml version=1.0 ? > < SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ xmlns:SOAP-ENC=http://schemas.xmlsoap.org/soap/encoding/
I have the following SOAP response: <?xml version=1.0?> <env:Envelope xmlns:env=http://schemas.xmlsoap.org/soap/envelope/> <env:Header/> <env:Body> <GetSalesResponse xmlns=http://api.dgm-uk.com/Publisher/schemas>
i need to parse this response of soapserver: <?xml version=1.0 encoding=UTF-8?><SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/ xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd=http://www.w3.org/2001/XMLSchema
I have the following XML: <SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/> <SOAP-ENV:Header> </SOAP-ENV:Header> <SOAP-ENV:Body> <MessageRequest></MessageRequest> </SOAP-ENV:Envelope> I am
Is it possible to set env vars in pom.xml that junit tests uses? Netbeans
Here is my code #!usr/bin/env perl # Setup includes use strict; use XML::RSS; use
XML document: <?xml version=1.0 encoding=UTF-8?> <ProcessData> <SOAPAction>urn:echo</SOAPAction> <Content_Type>text/xml;charset=UTF-8</Content_Type> <uname>sarah_brcm</uname> <pwd>BRCM_UVLwNhjrA5fbgqkUNdxQXMfcCDJ</pwd> </ProcessData> XSLT: <?xml version=1.0
XML Code: <GridLayout android:id=@+id/grid android:layout_width=fill_parent android:layout_height=fill_parent android:layout_above=@+id/step android:layout_alignParentLeft=true android:layout_alignParentRight=true android:layout_below=@+id/menu > </GridLayout> The above
XML Data: <configs> <config> <name>XP</name> <browser>IE</browser> <browser>FF</browser> <browser>Chrome</browser> </config> </configs> I'm new to Ruby,
I'm trying to remove SOAP and ns2 nodes from this XML : <SOAP-ENV:Envelope xmlns:SOAP-ENV=http://schemas.xmlsoap.org/soap/envelope/

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.