[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: The SAX interface of the xml4c2 parser
>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@u... xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1 To unsubscribe, mailto:majordomo@i... the following message; unsubscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|