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


cafe design
At 5:11 PM -0500 12/17/01, John Cowan wrote:

>package org.ccil.cowan.iter;
>public interface XMLIterator
>	extends java.util.Iterator {

I know this is how Java iterator are implemented but it really bugs 
me when you you're returning an XMLNode, but the methods are only 
declared to return java.lang.Object. Frankly, this bugs me so much I 
wouldn't extend java.util.Iterator

>// Node types: legal return values of XMLNode.getType method
>public static int END = 0;
>public static int ELEMENT = 1;
>public static int ATTRIBUTE = 2;
>public static int SKIPPED_ENTITY = 3;
>public static int END_ELEMENT = 4;
>public static int PI = 5;
>// Attribute types: legal return values of getAttributeType method
>public static int CDATA = 0;
>public static int ID = 1;
>public static int IDREF = 2;
>public static int IDREFS = 3;
>public static int NMTOKEN = 4;	// also used for enumerations
>public static int NMTOKENS = 5;
>public static int ENTITY = 6;
>public static int ENTITIES = 7;
>public static int NOTATION = 8;

Integer type constants are error-prone. Use type-safe enums instead.

>package org.ccil.cowan.iter;
>public interface XMLNode {
>// If the current node is an ELEMENT or ATTRIBUTE node,
>// and QName information is available, return it
>public string getQName();
Java names shouldn't be abbreviated. getQualfiedName() would be better

>// If the current node is an ELEMENT or ATTRIBUTE node, and
>// local name information is available, return it;
>// if the current node is a PI node, return the target;
>// if the current node is a SKIPPED_ENTITY node,
>// return the entity name
>public string getLocalName();

and if its something else like a comment? return null? return 
#comment? This should be documented.

>// If the current node is an ELEMENT node,
>// return an Attributes object containing the attributes
>public org.xml.sax.Attributes getAttributes();

and if it's not?

>// If the current node is an ELEMENT node,
>//   return all text content up to the next tag;
>// if the current node is an ATTRIBUTE node,
>//   return the normalized attribute value;
>// if the current node is an END_ELEMENT node,
>//   return all text content up to the next tag;

Is this the text before or after the end-tag?

>// if the current node is a PI node,
>//   return the content of the PI
>public string getValue();


| Elliotte Rusty Harold | elharo@m... | Writer/Programmer |
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |


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.
First Name
Last Name
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.