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

Re: DESIGN PROPOSAL: Java XMLIterator


java push xml
| package org.ccil.cowan.iter;
| public interface XMLNode {
| public org.xml.sax.Locator getLocator();
| public int getType();
| public int getAttributeType();
| public string getNSURI();
| public string getQName();
| public string getLocalName();
| public org.xml.sax.Attributes getAttributes();
| public string getValue();
| public bool isIgnorableWhitespace();
| }

I would also suggest a getParent() function as this
is most useful... and requiring the source of the
iterator to keep an ancestor stack is a very small
requirement. 

Let's call this interface PULL and the SAX interface PUSH.
Typically, programs will use this as their interface for
the parser, and use the SAX interface for the emitter.

(xml) -> PULL -> [appliction] -> PUSH -> (xml)

The application then can do much of it's processing
with a set of nested functions called recurisvely,
where each function has a single while loop to iterate
over the children and push the results to the output
interface.   

Thus, the goal of this interface is to make the 
application's job easy; the getParent() does this 
nicely and it's only a small additional requirement 
to have on the provider of the XML source information.  
A nice trade if you ask me.  Why duplicate all of 
the logic to track the ancestor stack in each application
when the parser can do it for you?

Best,

Clark

-- 
Clark C. Evans                   Axista, Inc.
http://www.axista.com            800.926.5525
XCOLLA Collaborative Project Management Software

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.