You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Voytenko, Dimitry" <dv...@sectordata.com> on 2002/12/19 03:36:56 UTC
RE: Extracting information from XML files
Hi Dima,
You can try using org.apache.xpath.XPathAPI:
http://xml.apache.org/xalan-j/apidocs/org/apache/xpath/XPathAPI.html
<http://xml.apache.org/xalan-j/apidocs/org/apache/xpath/XPathAPI.html>
It goes with Xalan 2 distribution, but as you can see it's in separate
package.
It's fairly easy to use and sounds like exactly what you want.
You can check out Xalan's sample ApplyXPath, which uses this class:
http://xml.apache.org/xalan-j/samples.html#applyxpath
<http://xml.apache.org/xalan-j/samples.html#applyxpath>
Thanks,
Dmitry
-----Original Message-----
From: Dima Gutzeit [mailto:dima@mailvision.net]
Sent: Tuesday, December 17, 2002 20:15
To: xerces-j-user@xml.apache.org
Subject: Extracting information from XML files
Hi ,
What is the most elegant way of extracting information from XML files ?
I have XML file which is a help file with a list of topics and etc... I am
writing aplication that recieves topic as a parameter and outputs a portion
of the XML file with the desired topic. How can I traverse XML files (using
X-Path preferably) and search for the desired elements? (in Java ofcourse).
Thanks in advance.
Regards ,
Dima Gutzeit.
---------------------------------
MailVision LTD.
R&D Team.
Phone: 972 - 4 - 8508020
Fax: 972 - 3 - 9285149
http://www.mailvision.com
--------------------------------------------------------------------- To
unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org For additional
commands, e-mail: xerces-j-user-help@xml.apache.org
_____________________________________________________
Sector Data, LLC, is not affiliated with Sector, Inc., or SIAC
RE: Extracting information from XML files
Posted by Joseph Kesselman <ke...@us.ibm.com>.
On Thursday, 12/19/2002 at 09:10 EST, "Rick Bullotta"
<ri...@lighthammer.com> wrote:
> I is simple as long as there aren't default namespaces in the XML
> document...<g>. Then it gets UGGGLY! ;>
>
> Hopefully the W3C will come through with something in XSLT 2.X.
I forgot to add: XPath 2.0 *does* currently plan to add the ability to set
a default namespace for the XPath. Unfortunately that still doesn't deal
with the situation where someone redefines the default partway through the
document, so it doesn't handle all the cases. And as far as I know it
still doesn't have a syntax for defining the namespaces in the XPath
string itself., which I'd really like to see.
______________________________________
Joe Kesselman / IBM Research
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
RE: Extracting information from XML files
Posted by Joseph Kesselman <ke...@us.ibm.com>.
On Thursday, 12/19/2002 at 09:10 EST, "Rick Bullotta"
<ri...@lighthammer.com> wrote:
> I is simple as long as there aren't default namespaces in the XML
> document...<g>. Then it gets UGGGLY! ;>
Not horribly ugly -- you just have to remember to map the _namespaces_ in
your XPath, not just to use corresponding prefixes. The same complication
arises if the XML document redeclared a prefix; you need to use separate
prefixes for the two different namespace URIs when writing your XPath.
For an overview of how to deal with this, see
http://xml.apache.org/xalan-j/faq.html#faq-N101B9
(I do wish XPath had a non-prefix-based version of its syntax. It'd be
extremely wordy, but it'd be a lot more robust and easier to generate. I'm
considering proposing that they add that alternative in XPath 2.0...)
______________________________________
Joe Kesselman / IBM Research
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org
RE: Extracting information from XML files
Posted by Rick Bullotta <ri...@lighthammer.com>.
I is simple as long as there aren't default namespaces in the XML
document...<g>. Then it gets UGGGLY! ;>
Hopefully the W3C will come through with something in XSLT 2.X.
Rick Bullotta
CTO
Lighthammer Software (www.lighthammer.com)
-----Original Message-----
From: Voytenko, Dimitry [mailto:dvoytenko@sectordata.com]
Sent: Wednesday, December 18, 2002 9:37 PM
To: 'xerces-j-user@xml.apache.org'
Subject: RE: Extracting information from XML files
Hi Dima,
You can try using org.apache.xpath.XPathAPI:
http://xml.apache.org/xalan-j/apidocs/org/apache/xpath/XPathAPI.html
It goes with Xalan 2 distribution, but as you can see it's in separate
package.
It's fairly easy to use and sounds like exactly what you want.
You can check out Xalan's sample ApplyXPath, which uses this class:
http://xml.apache.org/xalan-j/samples.html#applyxpath
Thanks,
Dmitry
-----Original Message-----
From: Dima Gutzeit [mailto:dima@mailvision.net]
Sent: Tuesday, December 17, 2002 20:15
To: xerces-j-user@xml.apache.org
Subject: Extracting information from XML files
Hi ,
What is the most elegant way of extracting information from XML files ?
I have XML file which is a help file with a list of topics and etc... I
am writing aplication that recieves topic as a parameter and outputs a
portion of the XML file with the desired topic. How can I traverse XML files
(using X-Path preferably) and search for the desired elements? (in Java
ofcourse).
Thanks in advance.
Regards ,
Dima Gutzeit.
---------------------------------
MailVision LTD.
R&D Team.
Phone: 972 - 4 - 8508020
Fax: 972 - 3 - 9285149
http://www.mailvision.com
--------------------------------------------------------------------- To
unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org For additional
commands, e-mail: xerces-j-user-help@xml.apache.org
_____________________________________________________
Sector Data, LLC, is not affiliated with Sector, Inc., or SIAC