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

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: The SAX interface of the xml4c2 parser

[ Lists Home | Date Index | Thread Index ]
  • From: roddey@us.ibm.com
  • To: xml-dev@ic.ac.uk
  • Date: Mon, 25 Oct 1999 16:36:57 -0600




>I don't like returning "const XMLCh*" instead of "const wstring&" or
>"const string&" (even though an approach like this would be more
>efficient for an expat wrapper).  I don't need the index out of range
>warning capability, because I iterate through the AttributeList
>entries anyway.
>

wstring is not available on all the platforms. We have to support lots of
platforms and a plain character array pointer is the universal format that
everyone can understand.

>I don't like giving an AttributeList& argument to
>DocumentHandler::startElement(), instead of an
>AttributeList*, because this rules out the possibility
>of passing a null-pointer on for the cases that don't
>have an attribute list.
>

That's what the length method of the attribute list is for. Just query it for
the number of elements. A reference to an attribute list is more consistent with
the Java interface and is more convenient for the end user. For performance
reasons, most practical parsers would keep around one list object per parser
instance which is just passed out over and over again (as apposed to
constructing one on every start element callout), so there would be no
performance overhead concerns. And it means that the code that handles it can be
simpler. It doesn't have to test first for null then do the loop. It just does
the loop. If there are zero elements, the loop is never entered.

----------------------------------------
Dean Roddey
Software Weenie
IBM Center for Java Technology - Silicon Valley
roddey@us.ibm.com



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/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe 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