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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:28:05+00:00 2026-06-01T08:28:05+00:00

I want to parse XML in bash and xpath could do it. (To get

  • 0

I want to parse XML in bash and xpath could do it.

(To get “Description” element with subelement “em:minVersion=2.1”) query like this works well:

xpath install.rdf /RDF/Description/em:targetApplication/Description[em:minVersion=2.1]

But this won’t work:

xpath install.rdf /RDF/Description/em:targetApplication/Description[em:id={ec8030f7-c20a-464f-9b0e-13a3a9e97384}]

Output like this:

Query:
/RDF/Description/em:targetApplication/Description[em:id={{ec8030...
.......................................................^^^
Invalid query somewhere around here (I think)

I think it’s because curly brackets “{}” need escaping, so I tried ‘{{..}}’, ‘{…}’… none of them works.

I’m not familiar with xpath or perl at all…

  • 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-01T08:28:06+00:00Added an answer on June 1, 2026 at 8:28 am

    Try

    xpath install.rdf '/RDF/Description/em:targetApplication/Description[em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"]'
    

    This doesn’t actually have anything to do with Perl, other than the fact that the xpath utility is written in it. It’s all about bash and XPath.

    To prevent bash from looking at it, put the whole query in single quotes.

    In XPath, strings must be quoted (with either single or double quotes). It’s generally easiest to use double quotes inside the XPath expression, and then put single quotes around it for bash.

    Since you’re searching for

    <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
    

    the condition you want is

    em:id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
    

    You’re getting away with em:minVersion=2.1 because 2.1 looks like a number, so XPath does a numeric comparison. But that won’t work with arbitrary strings.

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

Sidebar

Related Questions

I want to parse xml files that have elements like these: <element>&amp</element> <element>&amp;</element> But
I'm developing an HTML5 application. I want to parse an XML like this one:
i want parse xml file, which does't have xml extension, like this: http://bizonek.wrzuta.pl/xml/plik/1ANdXCgTOit/unknow/undefined/643/ my
i have a xml like this I want to parse the xml, build a
I want to parse some XML that looks like this: <node> This is <child>
I want to sax-parse in nokogiri, but when it comes to parse xml element
I want parse xml by looping through it. I referred this but I am
Like the title says, I want to parse XML in my iPhone application, but
I want to use following xml webservice. www.musicbrainz.org/ws/2/artist/?query=artist:michael jackson which format is like below:
I want to parse (little critical) xml using php simplexml...But i can aither get

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.