XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] [RefleX] Once Upon A Tag...

Manos Batsis wrote:
> Quoting Philippe Poulard <Philippe.Poulard@sophia.inria.fr>:
> 
>>-One of the most outstanding new feature is the ability to *filter
>>SAX
>>streams with XPath patterns* ; you'll find in the tutorial section a
>>runnable example where a 15Mo file is connected to a SAX pipeline
>>with a
>>rule-based filter...
> 
> 
> Does this work for any XPath axis maybe by creating buffers driven by
> expressions etc? Reminds me of STX:
> 
> http://stx.sourceforge.net/
> 

The strategy is simple : if you read forward, you'll have the nodes, if 
you read backward, you won't have them, so you should anticipate and 
"cast" that part of the subtree from a SAX document to a DOM document, 
as shown in the tutorials.

Almost everything available in XPath patterns à la XSLT will be 
available in that filters, but the memory will be freed as one goes along.

Moreover, when a pattern matches, XPath expressions can be applied on 
the node that matches, and using an XPath expression that requires 
further reading is transparent.
However, the engine doesn't prevent silly things : if you apply an XPath 
expression when the root matched that consist on counting all the 
children, then all the tree will be kept in memory and you rather use a 
DOM document instead...

I wrote an article that explains how it works :
http://reflex.gforge.inria.fr/saxPatterns.html

Unlike STX, it deals with real XPath patterns, and it can also use XPath 
functions such as last() or count()

There are very few elements dedicated to XCL filters : 
<xcl:parse-filter>, <xcl:filter>, <xcl:rule>, <xcl:forward> and 
<xcl:apply-rules/> ; other elements such as those that can create an 
element or update an attribute are not specific to XCL filters and were 
designed before for another purpose ; you can also use foreign elements 
from other modules, and of course litterals elements like with XSLT

Here are some use cases :
http://reflex.gforge.inria.fr/tests/xunit/reflex/xcl-filters/use-cases-filter.xcl
(sorry, it is not well-indented)
The input :
http://reflex.gforge.inria.fr/tests/xunit/reflex/xcl-filters/use-cases-in.xml
The output :
http://reflex.gforge.inria.fr/tests/xunit/reflex/xcl-filters/use-cases-out.xml

Additionally, some built-in filters are available :
-one that fires SAX character() events for each line read in a plain 
text input
-one that tokenize a plain text input with a regular expression
-one that process XInclusion

-- 
Cordialement,

               ///
              (. .)
  --------ooO--(_)--Ooo--------
|      Philippe Poulard       |
  -----------------------------
  http://reflex.gforge.inria.fr/
        Have the RefleX !


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS