PEtALS Forum Forum Index
All you need about PEtALS !
Forum - Website - Forge - EBM Websourcing

 
    Register    

FAQ    Mailing-lists    Search    Memberlist    Usergroups    Profile    Log in
Stax has an "XPath like"?
 
Post new topic   Reply to topic    PEtALS Forum Forum Index -> Ideas & Feature request
Author Message
fgardes
Member


Joined: 27 Jun 2008
Posts: 38
Location: Tolosa

PostPosted: Mon Nov 03, 2008 6:06 pm  Reply with quote

Maybe you already know Stax, the performant (if you say how to param your parser Rolling Eyes ) xml parser.
Unfortunately (and logically int a streaming approch) it doesn't implement the XPath processor. And I need to ask to the user the complete access tree to a element (for exemple "/myroot/mylist/myelementwanted"). Do you know a xpath like tool based on Stax? Or an easily changeable factory to define an EventFilter stax with the dynamic path?
Thanks for help me!
Back to top
View user's profile Send private message Send e-mail MSN Messenger
cdeneux
Member


Joined: 30 Jul 2008
Posts: 46
Location: Capgemini Sud - Sophia-Antipolis/Nice (France)

PostPosted: Wed Nov 05, 2008 9:34 am  Reply with quote

I think that StAX and XPath are not technologies very close. XPath needs to read completely the stream to run.

If you need only few XPath expressions, perhaps can you use StAX filters.
Back to top
View user's profile Send private message Visit poster's website
fgardes
Member


Joined: 27 Jun 2008
Posts: 38
Location: Tolosa

PostPosted: Wed Nov 05, 2008 11:15 am  Reply with quote

All rights.
I think that the EIP component would be "quick-run oriented" (so SAX through JAXP or StaX, to be quick for a simple sequential treatment) and not "loud-treatment oriented" (so JDOM today, to do complex search on a xml tree). The problem is that all patterns are user fronted with XPath Expression. I need to found an easy method, understandable and standard for the newbie, such as XPath, to switch from JDOM to StAX...
Back to top
View user's profile Send private message Send e-mail MSN Messenger
cdeneux
Member


Joined: 30 Jul 2008
Posts: 46
Location: Capgemini Sud - Sophia-Antipolis/Nice (France)

PostPosted: Wed Nov 05, 2008 11:41 am  Reply with quote

Your first need is to have "an easy method, understandable and standard for the newbie", and I think that XPath is the right one.

Your performance need through StAX is a second need.

I think that you will start to implement your XPath need. As XPath needs a full representation of the XML tree in memory, StAX can be used with XMLBeans to create this tree. Saxon is a good XPath engine, moreover it is compliant with XPath 2.0.

Example (putting Saxon librairies in the classpath) :
Code:
final XMLStreamReader xsr = xifThreadLocal.get().createXMLStreamReader(...);
final XmlObject xmlRequest = XmlObject.Factory.parse(xsr);
final XmlObject[] values = xmlRequest.selectPath("xpath_expression");
Back to top
View user's profile Send private message Visit poster's website
alouis
Member


Joined: 04 Aug 2008
Posts: 15

PostPosted: Wed Nov 05, 2008 12:38 pm  Reply with quote

I think the problem of Frederic is more a sax event problem,
Fred, I think you want to catch all elements of your xml source that respect a rule, such as “I want all elements in root/list/element” for example
And you don’t want to make some xpath tests
Am I right ?
Back to top
View user's profile Send private message
fgardes
Member


Joined: 27 Jun 2008
Posts: 38
Location: Tolosa

PostPosted: Wed Nov 05, 2008 1:19 pm  Reply with quote

alouis wrote:
I think the problem of Frederic is more a sax event problem,
Fred, I think you want to catch all elements of your xml source that respect a rule, such as “I want all elements in root/list/element” for example
And you don’t want to make some xpath tests
Am I right ?


All right for my current Splitter pattern. But I would like switch all the patterns to Stax so, and it uses XPath to stipulate conditions ("element >100") moreover path ("root/list/element") Confused
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    PEtALS Forum Forum Index -> Ideas & Feature request
All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum