mrglavas 2004/03/21 20:15:14 Modified: java/docs faq-sax.xml Log: Adding a FAQ on the scoping of the startElement Attributes parameter. Revision Changes Path 1.6 +18 -1 xml-xerces/java/docs/faq-sax.xml Index: faq-sax.xml =================================================================== RCS file: /home/cvs/xml-xerces/java/docs/faq-sax.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- faq-sax.xml 25 Feb 2004 16:22:44 -0000 1.5 +++ faq-sax.xml 22 Mar 2004 04:15:14 -0000 1.6 @@ -89,6 +89,23 @@ </a> </faq> + <faq title="Attributes and ContentHandler.startElement"> + <q>Why is the Attributes parameter passed to startElement always a + reference to the same object?</q> + <a> + <p>Outside the scope of <code>startElement</code>, the value of the + <code>Attributes</code> parameter is undefined. For each instance of Xerces' + SAX parser, there exists only one <code>Attributes</code> instance which + is reused for every new set of attributes. Before each + <code>startElement</code> callback, the previous values in this object + will be overwritten. This is done for performance reasons in order + to reduce object creation. To persist a set of attributes + beyond <code>startElement</code> the object should be cloned, for + instance by using <code>org.xml.sax.helpers.AttributesImpl</code>. + </p> + </a> + </faq> + <faq title="Namespace of xmlns attributes"> <q>Why does the SAX parser report that xmlns attributes have no namespace?</q> <a> @@ -101,7 +118,7 @@ </a> </faq> - <faq title="Encodings and XML Version Via SAX"> + <faq title="Encodings and XML Version via SAX"> <q>Is there any way I can determine what encoding an entity was written in, or what XML version the document conformed to, if I'm using SAX?</q>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]