OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] More on taming SAX (was Re: [xml-dev] ANN: Amara XMLToolki

[ Lists Home | Date Index | Thread Index ]



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. I am not a big believer in inventing
new languages - my ambitions are a lot more modest.

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.
Really just one step more than SAX. I use it for writing SAX-based
transformations.

Karl








 

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

Copyright 2001 XML.org. This site is hosted by OASIS