XML XPath support in J2SE 1.4.2?

X

xarax

I've tried reading the JavaDocs until my
eyes glaze over. I cannot figure out how
to do the XPath stuff after building an
XML DOM tree. There is a default parser
provided (I think it's the apache crimson
thing).

I need to generate a NodeList of nodes
that match an XPath expression, but there's
no documentation on how to do that with
the standard J2SE 1.4.2 stuff. All of the
references in the JavaDoc just provide a
link to the w3c.org XML website (just the
specifications documentation).

I have some other jar files provided by
fujitsu and jclark that handle the XPath
stuff, but they are non-standard and
unsupported. So, I can distribute those
with my application. I want to convert
to the "standard" supported XPath, but
what is it?


--
----------------------------
Jeffrey D. Smith
Farsight Systems Corporation
24 BURLINGTON DRIVE
LONGMONT, CO 80501-6906
http://www.farsight-systems.com
z/Debug debugs your Systems/C programs running on IBM z/OS for FREE!
 
M

Martin Honnen

xarax said:
I've tried reading the JavaDocs until my
eyes glaze over. I cannot figure out how
to do the XPath stuff after building an
XML DOM tree. There is a default parser
provided (I think it's the apache crimson
thing).

I need to generate a NodeList of nodes
that match an XPath expression, but there's
no documentation on how to do that with
the standard J2SE 1.4.2 stuff. All of the
references in the JavaDoc just provide a
link to the w3c.org XML website (just the
specifications documentation).

You can do XSLT 1.0 with Java 1.4 using the JAXP interfaces e.g.
javax.xml.transform
with
TransformerFactory
An XSLT 1.0 stylesheet can contain XPath 1.0 expressions so that way you
can apply XPath expressions but besides that I don't think there is a
way to apply XPath expressions in Java 1.4 using the included classes.
 
X

xarax

Martin Honnen said:
You can do XSLT 1.0 with Java 1.4 using the JAXP interfaces e.g.
javax.xml.transform
with
TransformerFactory
An XSLT 1.0 stylesheet can contain XPath 1.0 expressions so that way you
can apply XPath expressions but besides that I don't think there is a
way to apply XPath expressions in Java 1.4 using the included classes.

Yes, that's what I feared. The XPath stuff is encapsulated
in the XSLT transform thingy, and not as a separate
interface for selecting nodes from the DOM tree. There
are apache interfaces defined for the XPath over at their
website, but that stuff is not included in J2SE 1.4 product.

:(
 
W

Waxolunist

Yes, that's what I feared. The XPath stuff is encapsulated
in the XSLT transform thingy, and not as a separate
interface for selecting nodes from the DOM tree. There
are apache interfaces defined for the XPath over at their
website, but that stuff is not included in J2SE 1.4 product.

:(


But with jdom, jaxen and saxpath it is very easy to use xpath.

Download the jdom.jar, saxpath.jar, jaxen-core.jar and jaxen-jdom.jar.

You can find them with google very easy. Just search for it.
 

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,772
Messages
2,569,593
Members
45,108
Latest member
AlbertEste
Top