Xerces only supports the simplest XPath queries?

  • Thread starter Ramon F Herrera
  • Start date
R

Ramon F Herrera

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
 
M

Martin Honnen

Ramon said:
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.
 
J

Joe Kesselman

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."
 
R

Ramon F Herrera

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
 
R

Ramon F Herrera

Ramon said:
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
 
R

Ramon F Herrera

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
 
R

Ramon F Herrera

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

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
 
J

Joe Kesselman

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."
 
R

Ramon F Herrera

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
 
J

John W Kennedy

"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.
 
R

Ramon F Herrera

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
 
J

John W Kennedy

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.
 
J

Joe Kesselman

"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."
 
J

Joe Kesselman

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."
 
P

Peter Flynn

Ramon said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top