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] DESIGN PROPOSAL: Java XMLIterator

[ Lists Home | Date Index | Thread Index ]

| 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

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

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?



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


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

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