SAX 1.0 : handleData and processingInstruction

Lars Marius Garshol larsga at ifi.uio.no
Mon May 18 17:42:00 BST 1998


* Philippe Le Hégaret
|
| charecters takes an array of characters for the data :
| 
|   public abstract void characters(char ch[],
|                                   int start,
|                                   int length) throws SAXException
| 
|   processingInstruction takes a String for the data :
| 
|   public abstract void processingInstruction(String target,
|                                              String data) throws SAXException
| 
|   Why is there this difference in SAX ?

I wasn't "present" when this decision was made, but I'd guess
characters is the way it is because this way is faster in most
implementations, since most parsers keep a character buffer during
parsing and this avoids unecessary buffer copying. 

However, doing it this way is obviously less convenient for the user,
who would prefer to just get a String and be done with it. I guess
this is why the current form of processingInstruction was chosen,
since processing instructions rarely occur often in documents and thus
performance is less of an issue.

See also:

<URL:http://www.lists.ic.ac.uk/hypermail/xml-dev/9801/0042.html>
<URL:http://www.lists.ic.ac.uk/hypermail/xml-dev/9801/0087.html>

-- 
"These are, as I began, cumbersome ways / to kill a man. Simpler, direct, 
and much more neat / is to see that he is living somewhere in the middle /
of the twentieth century, and leave him there."     -- Edwin Brock

 http://www.stud.ifi.uio.no/~larsga/      http://birk105.studby.uio.no/


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




More information about the Xml-dev mailing list