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

RE: about saxon

  • From: Kay Michael <Michael.Kay@i...>
  • To: "'Huaxin Zhang'" <hxzhang@c...>, unlisted-recipients <unlisted-recipients:@x400.icl.co.uk;>
  • Date: Wed, 7 Jun 2000 10:15:32 +0100

unlisted recipients
> I am new at XML. Somebody told me SAXON is considered better 
> than SAX and DOM. Because users can make use of the "event-rule-action" 
> model. However, this feature is pretty vague to me.

Saxon is now used mainly as an XSLT processor, but in its original form it
was just a Java class library for processing XML files, and it can still be
used this way if you want. The processing model is (of course) very similar
to the XSLT processing model: you declare a set of handlers (Java classes)
to process the nodes that match a particular pattern. Then you
start processing at the root node: the handler for the root node will
typically call applyTemplates() to trigger processing of its child nodes,
each using its own handler, and so on.
> 
> First, there is no event, the examples are just setting 
> elemnent handlers to specified tags. If I want something like "once there
are 
> three <task> objects with the same "user" attribute, do something, how can

> I set this rule? (or even with any XML tools you know)

As with XSLT, you can only define patterns that an individual node must
satisfy, there is no way of matching a sequence of nodes. However, the
patterns are quite powerful, for example the pattern
"task[not(@user=preceding-sibling::task[1]/@user)]" matches any <task>
element except one whose user attribute is the same as the user attribute of
the immediately preceding <task> element.

The "event" is that a handler calls applyTemplates(), this causes a set of
nodes to be selected, for each one the appropriate handler is selected
according to its match pattern, and this handler is then fired off.

(At one time SAXON worked serially through the document, so handlers were
fired off automatically as SAX events occurred. This was later changed to a
more navigational model in line with the XSLT specification)
> 
> Another question is :
>  I want to have a XML containing a lot of <task/>, each have
> a taskID, I want to get a int[] returned from the 
> "Expression", but seems this is not doable. How shall I get all the sets
to an array?

You can get a node-set containing all the taskID attribute nodes using the
XPath expression task/@taskID; you can then convert this node-set into an
int[] in your own Java code.

Mike Kay
 

***************************************************************************
This is xml-dev, the mailing list for XML developers.
To unsubscribe, mailto:majordomo@x...&BODY=unsubscribe%20xml-dev
List archives are available at http://xml.org/archives/xml-dev/
***************************************************************************

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.