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

  • Home
  • SEARCH
  • 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 3420900
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:03:24+00:00 2026-05-18T06:03:24+00:00

Here is my .XML: <table> <report field=FROZEN_BY /> <user name=Peter O’Toole count=16> <row> <QTY

  • 0

Here is my .XML:

<table>
  <report field="FROZEN_BY" />
  <user name="Peter O'Toole" count="16">
    <row>
      <QTY value="2" />
      <EXTENSION value="SLDASM" />
    </row>
    <row>
      <QTY value="3" />
      <EXTENSION value="SLDDRW" />
    </row>
    <row>
      <QTY value="3" />
      <EXTENSION value="SLDPRT" />
    </row>
    <row>
      <QTY value="8" />
      <EXTENSION value="ZIP" />
    </row>
  </user>
</table>

the problem I am having comes from this line of xcode:

NSString* xPath = @"/table/user[@name='Peter O'Toole']/row";

when the username contains any .XML special characters I get an error:

XPath error : Invalid predicate
/table/user[@name='Peter O'Toole']/row
                          ^
xmlXPathEval: evaluation failed

I expected this, but when I change the line to:

NSString* xPath = @"/table/user[@name='Peter O&amp;Toole']/row";

I no longer get the error, but I also don’t get any results.

Any thoughts on this?

  • 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-05-18T06:03:25+00:00Added an answer on May 18, 2026 at 6:03 am

    You’re in an XPath expression in a string literal, not in XML, so &amp; isn’t an escape at all (and even if it were, it would be & rather than '). You’re literally matching name attributes with the value Peter O&amp;Toole, ie attributes that would be written in the XML as name="Peter O&amp;amp;Toole".

    XPath string literals can use either type of quote, so this expression would work:

    /table/user[@name="Peter O'Toole"]/row
    

    Which, for inclusion in an Obj-C string literal would need the double-quotes escaping again:

    NSString* xPath = @"/table/user[@name=\"Peter O'Toole\"]/row";
    

    If you have both kinds of quote in a string you want to match, you’ve got more of an issue. XPath string literals do not have an escaping scheme so it’s impossible to state a value with both " and ' in it. You have to do it by concatenating strings that have only one type of quote in. So for arbitrary strings it may be easier to manually iterate-and-compare than to use an XPath.

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

Sidebar

Related Questions

I am trying to get the count of nodes in an XML field. but
Here's the XML file i'm working on: <list> <activity>swimming</activity> <activity>running</activity> <activity>soccer</activity> </list> The index.php,
Here's the XML code I'm working with: <inventory> <drink> <lemonade supplier=mother id=1> <price>$2.50</price> <amount>20</amount>
Here is my sample code: from xml.dom.minidom import * def make_xml(): doc = Document()
Here is the input (html, not xml): ... html content ... <tag1> content for
Here's the deal. I have an XML document with a lot of records. Something
Here's my problem.I have 2 xmlfiles with identical structure, with the second xml containing
Here's what I'm trying to do. I'm querying an XML file using LINQ to
In my environment here I use Java to serialize the result set to XML.
At work here, we have a box serving XML feeds to business partners. Requests

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.