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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: org.xml.sax.AttributeMap

[ Lists Home | Date Index | Thread Index ]
  • From: Antony Blakey <antony@n-space.com.au>
  • To: xml-dev Mailing List <xml-dev@ic.ac.uk>
  • Date: Wed, 25 Feb 1998 12:50:12 +1030

Don Park wrote:
> How about replacing the five with following method and three constants?
> 
> public static final int NAME = 0;
> public static final int PUBLIC_ID = 1;
> public static final int SYSTEM_ID = 2;
> 
> public abstract String[] getDataInfo (int index);
> 
> Since AttributeList is valid only within startElement method, you can reuse
> a single string array rather allocate a new one per getEntityInfo method.
> If the method returns null, then it is attribute has no info.
> 
> If you haven't guessed by now, the constants above are used to index into
> the returned array.  Implementations should take steps to make sure the size
> of the returned array is 3 and stuff null for NAME if it is not a notation.

Why would you not simply return a strongly typed data item (ignoring the
names)

public abstract DataInfo getDataInfo(int index);

public interface EntityInfo {
  public String getName();
  public String getPublicID();
  Public String getSystemID();
}

As far as reuse of values is concerned however, I think this is a very
bad idea: startElement defines a new context, so reusing the parameters
to that call is workable, however reusing the result from the
getDataInfo call is a different kettle of fish. It would be better (if
you are so concerned) to keep a pool that you return so that they are
not reused within the context of a startElement call. This may seem like
more work on the part of the parser implementor, but you shouldn't push
this complexity onto the users of the parser when you can safely hide it
within the parser. The parser writer can make the effort for
efficiencies sake.

+----------------------------------+
|          Antony Blakey           |
|         N-Space Pty Ltd          |
|    Java - CORBA - SGML - XML     |
|   mailto:antony@n-space.com.au   |
|     http://www.n-space.com.au    |
+----------------------------------+

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/
To (un)subscribe, mailto:majordomo@ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)





 

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

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