| Author |
Message |
fgardes Member

Joined: 27 Jun 2008 Posts: 38 Location: Tolosa
|
Posted: Mon Nov 03, 2008 6:06 pm |
|
|
Maybe you already know Stax, the performant (if you say how to param your parser ) 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 |
|
 |
cdeneux Member

Joined: 30 Jul 2008 Posts: 46 Location: Capgemini Sud - Sophia-Antipolis/Nice (France)
|
Posted: Wed Nov 05, 2008 9:34 am |
|
|
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 |
|
 |
fgardes Member

Joined: 27 Jun 2008 Posts: 38 Location: Tolosa
|
Posted: Wed Nov 05, 2008 11:15 am |
|
|
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 |
|
 |
cdeneux Member

Joined: 30 Jul 2008 Posts: 46 Location: Capgemini Sud - Sophia-Antipolis/Nice (France)
|
Posted: Wed Nov 05, 2008 11:41 am |
|
|
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 |
|
 |
alouis Member
Joined: 04 Aug 2008 Posts: 15
|
Posted: Wed Nov 05, 2008 12:38 pm |
|
|
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 |
|
 |
fgardes Member

Joined: 27 Jun 2008 Posts: 38 Location: Tolosa
|
Posted: Wed Nov 05, 2008 1:19 pm |
|
|
| 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")  |
|
| Back to top |
|
 |
|