Xerces only supports the simplest XPath queries?

Discussion in 'XML' started by Ramon F Herrera, Jun 1, 2012.

  1. I have been using Xerces to perform XPath retrievals. So far, I have
    only dealt with the simplest path syntax. Much to my dismay, when I
    tried something a little fancier (a path with a subscript), it failed:

    /root/table/detailed_steel_pole_usages[1]/joint_label

    I guess I need some layer on top of Xerces-C?

    TIA,

    -Ramon
    Ramon F Herrera, Jun 1, 2012
    #1
    1. Advertising

  2. Ramon F Herrera wrote:
    >
    > I have been using Xerces to perform XPath retrievals. So far, I have
    > only dealt with the simplest path syntax. Much to my dismay, when I
    > tried something a little fancier (a path with a subscript), it failed:
    >
    > /root/table/detailed_steel_pole_usages[1]/joint_label
    >
    > I guess I need some layer on top of Xerces-C?



    I am not familiar with details of Xerces-C, I think it has a user
    mailing list where you are more likely to find other users than here. As
    for the failure, which error do you get?
    As far as I am aware in the Apache XML tool set Xerces does the XML
    parsing and validation whilst Xalan does XSLT and XPath 1.0.


    --

    Martin Honnen --- MVP Data Platform Development
    http://msmvps.com/blogs/martin_honnen/
    Martin Honnen, Jun 1, 2012
    #2
    1. Advertising

  3. On 6/1/2012 5:16 AM, Ramon F Herrera wrote:
    > I have been using Xerces to perform XPath retrievals. So far, I have
    > only dealt with the simplest path syntax. Much to my dismay, when I
    > tried something a little fancier (a path with a subscript), it failed:
    >
    > /root/table/detailed_steel_pole_usages[1]/joint_label
    >
    > I guess I need some layer on top of Xerces-C?


    I'm not sure what the limits are on the Xerces-C builtin XPath support,
    but I know they exist.

    If you want a full XPath implementation, use the one provided by Apache
    Xalan-C (which runs on top of Xerces-C to implement XPath 1.0 and XSLT 1.0).

    (Or Xerces-J and Xalan-J, if you're using Java rather than C or C++.)

    --
    Joe Kesselman,
    http://www.love-song-productions.com/people/keshlam/index.html

    {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
    /\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
    Joe Kesselman, Jun 2, 2012
    #3
  4. On Jun 1, 7:28 pm, Joe Kesselman <>
    wrote:
    > On 6/1/2012 5:16 AM, Ramon F Herrera wrote:
    >
    > > I have been using Xerces to perform XPath retrievals. So far, I have
    > > only dealt with the simplest path syntax. Much to my dismay, when I
    > > tried something a little fancier (a path with a subscript), it failed:

    >
    > > /root/table/detailed_steel_pole_usages[1]/joint_label

    >
    > > I guess I need some layer on top of Xerces-C?

    >


    > I'm not sure what the limits are on the Xerces-C builtin XPath
    > support, but I know they exist.


    The limit is quite simple to describe. The XPath support is the
    minimum possible:

    /this/is/some/path

    IOW: There is no way to have less support than that.

    I have been trying Xalan-C and it seems to have been abandoned years
    ago: it won't compile, and folks on the net recommend installing from
    binaries, which are 7 years old.

    At this point I am ready to look for another C++ XPath implementation
    and dump Xalan-C and Xerces-C. I REALLY tried, for years.

    -Ramon
    Ramon F Herrera, Jun 2, 2012
    #4
  5. On Jun 1, 5:56 am, Martin Honnen <> wrote:
    > Ramon F Herrera wrote:
    >
    > > I have been using Xerces to perform XPath retrievals. So far, I have
    > > only dealt with the simplest path syntax. Much to my dismay, when I
    > > tried something a little fancier (a path with a subscript), it failed:

    >
    > > /root/table/detailed_steel_pole_usages[1]/joint_label

    >
    > > I guess I need some layer on top of Xerces-C?

    >


    > I am not familiar with details of Xerces-C, I think it has
    > a user mailing list where you are more likely to find other
    > users than here.


    I have used the mailing list/newsgroup, but EVERY time I ask a
    question, the answer is the same: somebody offers me a "better"
    alternative to Xerces. This is easily the most frustrating software I
    have used in my long life as programmer.

    -Ramon
    Ramon F Herrera, Jun 2, 2012
    #5
  6. On Jun 2, 2:32 pm, Ramon F Herrera <> wrote:
    > On Jun 1, 7:28 pm, Joe Kesselman <>
    > wrote:
    >
    > > On 6/1/2012 5:16 AM, Ramon F Herrera wrote:

    >
    > > > I have been using Xerces to perform XPath retrievals. So far, I have
    > > > only dealt with the simplest path syntax. Much to my dismay, when I
    > > > tried something a little fancier (a path with a subscript), it failed:

    >
    > > > /root/table/detailed_steel_pole_usages[1]/joint_label

    >
    > > > I guess I need some layer on top of Xerces-C?

    >
    >  > I'm not sure what the limits are on the Xerces-C builtin XPath
    >  > support, but I know they exist.
    >
    > The limit is quite simple to describe. The XPath support is the
    > minimum possible:
    >
    > /this/is/some/path
    >
    > IOW: There is no way to have less support than that.
    >
    > I have been trying Xalan-C and it seems to have been abandoned years
    > ago: it won't compile, and folks on the net recommend installing from
    > binaries, which are 7 years old.
    >
    > At this point I am ready to look for another C++ XPath implementation
    > and dump Xalan-C and Xerces-C. I REALLY tried, for years.
    >
    > -Ramon


    Xalan-C has been pretty much abandoned, in favor of XQuilla.

    -RFH
    Ramon F Herrera, Jun 2, 2012
    #6
  7. Ramon F Herrera <> writes:

    [...]
    > The limit is quite simple to describe. The XPath support is the
    > minimum possible:
    >
    > /this/is/some/path


    Have you checked libxml2 (http://www.xmlsoft.org/)? It has full XPath
    support. Very good code base, last I tried. Doesn't support DOM
    though.

    -- Alain.
    Alain Ketterlin, Jun 2, 2012
    #7
  8. On Jun 2, 3:13 pm, Alain Ketterlin <-strasbg.fr>
    wrote:
    > Ramon F Herrera <> writes:
    >
    > [...]
    >
    > > The limit is quite simple to describe. The XPath support is the
    > > minimum possible:

    >
    > > /this/is/some/path

    >


    > Have you checked libxml2 (http://www.xmlsoft.org/)
    > It has full XPath support. Very good code base, last I tried.
    > Doesn't support DOM though.


    Thanks for that suggestion, Alain. I have been looking at libxml2 with
    interest.

    I downloaded and installed Xqilla and so far am very satisfied: it
    installs readily and comes with a nice CLI utility that works as
    expected. In addition to the full-blown API functionality (which I
    claim is not needed by a large/huge percentage of users) it has a
    simple API subset.

    http://xqilla.sourceforge.net/Documentation

    I should have mentioned a couple of requirements:

    - I develop under Linux, but my final product is ported to Windows.
    Hence, multi-platform is a must.

    - I prefer C++ over C.

    Thanks!

    -Ramon
    Ramon F Herrera, Jun 2, 2012
    #8
  9. On 6/2/2012 3:32 PM, Ramon F Herrera wrote:
    > I have been trying Xalan-C and it seems to have been abandoned years
    > ago: it won't compile, and folks on the net recommend installing from
    > binaries, which are 7 years old.


    Sorry to hear that. IBM's internal fork of that code does still compile
    and run, but isn't generally available so that doesn't help you. (Dave
    Bertoni had been maintaining Apache Xalan-C on a volunteer basis for
    many years, but I don't think he was getting much assistance and there's
    only so long you can keep a one-man project running on your own time.)

    But if you want full XPath support in C++ through Apache code, I'm
    afraid Xalan-C really is the best answer.

    I honestly don't know what alternatives exist in the C/C++ world; most
    of my own attention in the past decade as been on Java.

    --
    Joe Kesselman,
    http://www.love-song-productions.com/people/keshlam/index.html

    {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
    /\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
    Joe Kesselman, Jun 3, 2012
    #9
  10. On Jun 2, 11:12 pm, Joe Kesselman <>
    wrote:

    > IBM's internal fork of that code does still compile and run,
    > but isn't generally available so that doesn't help you.


    "internal fork"?

    That sounds like a violation of the OS license...

    In any event, XQilla works great BUT you take a performance hit
    (compared with the minimum implementation XPath performed by Xerces-
    C). The factor is 4x.

    -Ramon
    Ramon F Herrera, Jun 4, 2012
    #10
  11. On 2012-06-04 12:25:02 +0000, Ramon F Herrera said:

    > On Jun 2, 11:12 pm, Joe Kesselman <>
    > wrote:
    >
    > > IBM's internal fork of that code does still compile and run,
    > > but isn't generally available so that doesn't help you.

    >
    > "internal fork"?
    >
    > That sounds like a violation of the OS license...


    I don't offhand recall ever hearing of any OS license that doesn't
    allow an internal fork, so long as source and object are both internal.

    --
    John W Kennedy
    "The blind rulers of Logres
    Nourished the land on a fallacy of rational virtue."
    -- Charles Williams. "Taliessin through Logres: Prelude"
    John W Kennedy, Jun 4, 2012
    #11
  12. On Jun 4, 9:36 am, John W Kennedy <> wrote:
    > On 2012-06-04 12:25:02 +0000, Ramon F Herrera said:
    >
    > > On Jun 2, 11:12 pm, Joe Kesselman <>
    > > wrote:

    >
    > >  > IBM's internal fork of that code does still compile and run,
    > >  > but isn't generally available so that doesn't help you.

    >
    > > "internal fork"?

    >
    > > That sounds like a violation of the OS license...

    >


    > I don't offhand recall ever hearing of any OS license that doesn't
    > allow an internal fork, so long as source and object are both

    internal.

    That's a very good point - and now that I think about it, I do it all
    the time!

    Still, I thought that when it comes to OSS contributions, IBM was one
    of the good guys. Take for instance the fact that Big Blue invested
    more money and resources into Java than Sun itself, and now Oracle
    wants to steal all that. (The judge deserves standing ovations).

    -Ramon
    Ramon F Herrera, Jun 4, 2012
    #12
  13. On 2012-06-04 14:49:03 +0000, Ramon F Herrera said:

    > On Jun 4, 9:36 am, John W Kennedy <> wrote:
    >> On 2012-06-04 12:25:02 +0000, Ramon F Herrera said:
    >>
    >>> On Jun 2, 11:12 pm, Joe Kesselman <>
    >>> wrote:

    >>
    >>>  > IBM's internal fork of that code does still compile and run,
    >>>  > but isn't generally available so that doesn't help you.

    >>
    >>> "internal fork"?

    >>
    >>> That sounds like a violation of the OS license...

    >>

    >
    > > I don't offhand recall ever hearing of any OS license that doesn't
    > > allow an internal fork, so long as source and object are both

    > internal.
    >
    > That's a very good point - and now that I think about it, I do it all
    > the time!
    >
    > Still, I thought that when it comes to OSS contributions, IBM was one
    > of the good guys. Take for instance the fact that Big Blue invested
    > more money and resources into Java than Sun itself, and now Oracle
    > wants to steal all that. (The judge deserves standing ovations).


    Without knowing what this internal fork is about, it's impossible to
    say. It might just be a case of modifying it to meet internal IBM
    standards, or to deal with an existing IBM database.

    --
    John W Kennedy
    "Compact is becoming contract,
    Man only earns and pays."
    -- Charles Williams. "Bors to Elayne: On the King's Coins"
    John W Kennedy, Jun 4, 2012
    #13
  14. On 6/4/2012 8:25 AM, Ramon F Herrera wrote:
    > "internal fork"?
    > That sounds like a violation of the OS license...


    Nope. The Apache license explicitly permits commercializing their code,
    as long as they are given appropriate credit for the contribution, and
    encourates but does not require that changes be contributed back to Apache.

    > In any event, XQilla works great BUT you take a performance hit
    > (compared with the minimum implementation XPath performed by Xerces-
    > C). The factor is 4x.


    Going beyond the minimal subset may require building an in-memory data
    model of the document, since full XPath can bounce around the document
    both forward and backward. That does impose some costs. Beyond that,
    it's a question of how clever and well-optimized the code is.

    --
    Joe Kesselman,
    http://www.love-song-productions.com/people/keshlam/index.html

    {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
    /\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
    Joe Kesselman, Jun 4, 2012
    #14
  15. On 6/4/2012 10:49 AM, Ramon F Herrera wrote:
    > Still, I thought that when it comes to OSS contributions, IBM was one
    > of the good guys.


    IBM contributed Xerces and Xalan (both Java and C++) to Apache in the
    first place, and provided a LOT of man-hours (including supporting Sun's
    contributions to Xalan after Sun lost interest). IBM is no longer
    officially involved in these two projects but continues to be involved
    with open source in other areas. I think the dues have been paid...

    --
    Joe Kesselman,
    http://www.love-song-productions.com/people/keshlam/index.html

    {} ASCII Ribbon Campaign | "may'ron DaroQbe'chugh vaj bIrIQbej" --
    /\ Stamp out HTML mail! | "Put down the squeezebox & nobody gets hurt."
    Joe Kesselman, Jun 4, 2012
    #15
  16. Ramon F Herrera

    Peter Flynn Guest

    On 02/06/12 20:35, Ramon F Herrera wrote:
    > On Jun 1, 5:56 am, Martin Honnen <> wrote:
    >> Ramon F Herrera wrote:
    >>
    >>> I have been using Xerces to perform XPath retrievals. So far, I have
    >>> only dealt with the simplest path syntax. Much to my dismay, when I
    >>> tried something a little fancier (a path with a subscript), it failed:

    >>
    >>> /root/table/detailed_steel_pole_usages[1]/joint_label

    >>
    >>> I guess I need some layer on top of Xerces-C?

    >>

    >
    > > I am not familiar with details of Xerces-C, I think it has
    > > a user mailing list where you are more likely to find other
    > > users than here.

    >
    > I have used the mailing list/newsgroup, but EVERY time I ask a
    > question, the answer is the same: somebody offers me a "better"
    > alternative to Xerces. This is easily the most frustrating software I
    > have used in my long life as programmer.


    What are these "retrievals", exactly? Are you coding this inside some
    other program in Java or C++ or something (ie using the Xerces and Xalan
    libraries), or is this a shell script, or a web page, or ad-hoc
    command-line queries, or what?

    There are lots of tools out there; perhaps evaluating them is a good start.

    ///Peter
    Peter Flynn, Jun 4, 2012
    #16
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. thedebugger
    Replies:
    0
    Views:
    339
    thedebugger
    Nov 4, 2004
  2. Andre Charbonneau

    XPath queries getting slower and slower...

    Andre Charbonneau, Feb 15, 2005, in forum: Java
    Replies:
    0
    Views:
    534
    Andre Charbonneau
    Feb 15, 2005
  3. cvissy
    Replies:
    0
    Views:
    601
    cvissy
    Nov 16, 2004
  4. Ian Roddis

    xslt queries in xml to SQL queries

    Ian Roddis, Feb 26, 2006, in forum: Python
    Replies:
    3
    Views:
    1,470
    Crutcher
    Feb 26, 2006
  5. Abby Lee

    so many queries within queries I'm confused

    Abby Lee, Aug 4, 2004, in forum: ASP General
    Replies:
    11
    Views:
    340
    Aaron [SQL Server MVP]
    Aug 6, 2004
Loading...

Share This Page