[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: More on taming SAX (was Re: ANN: Amara XMLToolki


xmltoolkit ibm
Karl Waclawek wrote:

>
> Jeff Rafter wrote:
>
>> Karl Waclawek has done some work in this area in both Delphi and C# 
>> in his toolkit XPEA. But I am sure he will take some ideas from this 
>> thread as well... it is all very interesting.
>
>
> Well, XPEA really is a very low level way of building
> some pattern matching on top of SAX (or other push APIs).
> Predicate processing as well as attribute matching is done
> through call-backs.


Pleased to meet someone as intent on bending their brain as I am.

> I am not a big believer in inventing
> new languages - my ambitions are a lot more modest.


Just to be sure there's no misunderstanding, no one on this thread has 
aid anything about inventing a new language, right?  As I clarified, 
"XPattern" is merely the older name for XSLT patterns, defined in XSLT 1.0.

> Example (C# 2.0 syntax):
>
>   IXmlReader reader;
>   ...
>   SaxPathDispatcher<EventStatus> disp = new 
> SaxPathDispatcher<EventStatus>();
>   disp.AttachTo(reader);
>   /* Path related set-up */
>   Div1Handler div1 = new Div1Handler(...);
>   Div2Handler div2 = new Div2Handler(...);
>   BasicPathFactory pathFactory = new BasicPathFactory(...);
>   // Add path with call-back arguments: "/spec/*//div1[div1]/div2[div2]"
>   BasicPath path = pathFactory.Create("/spec/*//div1[0]/div2[1]", 
> div1, div2);
>   path.AddTo(disp.Paths);
>   ...
>   reader.Parse(input);
>
> Div1Handler and Div2Handler are implementations of the IElementHandler
> interface and their events are called when they match the path above.


I suspect you mean "match the XSLT pattern" as well, and just don't know 
it :-)

It's not all that meaningful to "match" an "XPath".

> Really just one step more than SAX. I use it for writing SAX-based
> transformations.


Seems very similar to amara.saxtools.xpattern_sax_state_machine, but 
rather than call-backs to the handler, the state machine object just 
maintains a list of patterns matched in the current node.  The SAX 
handler can check this list at its leisure.  I find this is a bit more 
flexible.


-- 
Uche Ogbuji                                    Fourthought, Inc.
http://uche.ogbuji.net    http://4Suite.org    http://fourthought.com
Use CSS to display XML - http://www.ibm.com/developerworks/edu/x-dw-x-xmlcss-i.html
Full XML Indexes with Gnosis - http://www.xml.com/pub/a/2004/12/08/py-xml.html
Be humble, not imperial (in design) - http://www.adtmag.com/article.asp?id=10286
UBL 1.0 - http://www-106.ibm.com/developerworks/xml/library/x-think28.html
Use Universal Feed Parser to tame RSS - http://www.ibm.com/developerworks/xml/library/x-tipufp.html
Default and error handling in XSLT lookup tables - http://www.ibm.com/developerworks/xml/library/x-tiplook.html
A survey of XML standards - http://www-106.ibm.com/developerworks/xml/library/x-stand4/
The State of Python-XML in 2004 - http://www.xml.com/pub/a/2004/10/13/py-xml.html


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.