[jdom-commits] CVS update: jdom/src/java/org/jdom/output

cvs at cvs.jdom.org cvs at cvs.jdom.org
Thu Oct 17 22:43:25 PDT 2002


Date:	Friday October 18, 2002 @ 1:43
Author:	cvs

Update of /home/cvspublic/jdom/src/java/org/jdom/output
In directory jools.org:/tmp/cvs-serv8144/output

Modified Files:
	SAXOutputter.java 
Log Message:
Patch from Laurent Bihanic.  His description is below.

-jh-

Please find attached a new version of SAXOutputter patch which include:
  - Notification of EntityRef thru ContentHandler.skippedEntity() (new method 
entityRef())
  - Notification of some errors to the registered SAX ErrorHandler (new 
*protected* method handleError())

JDOMSource has been updated to support outputting portions of documents. 
Finally I rewrote the list vs document handling in JDOMResult to avoid 
destroying the original document (setDocument) to recreate it later (getDocument).


> Attached is a patch to SAXOutputter that fixes the following:
> 
> - Added support for Comments as Element children;
> 
> - Added support for CDATA (i.e. distinguish CDATA from plain text and 
> use of the start/endCDATA callbacks of LexicalHandler): new method cdata();
> 
> - Remove support for CDATA as children of the document node
> (Method output(Document) used to test on CDATA nodes and fired the 
> corresponding events which seems invalid according to the XML spec. and 
> the XML parsers I tried!);
> 
> - Added support for outputting portions of documents (i.e. lists of JDOM 
> nodes) as such output is valid when used as input of XSLT processors. 
> This feature will be used by JDOMSource.
> 
> Note: Method elementContent() has been rewritten to support CDATA. The 
> optimization for text-only content has been removed as it did not seem 
> to bring any performance improvement and made the code quite 
> complicated. In order to make code clearer, this method now uses the 
> same type of loop as used by output(Document).
> 
> Regards,
> 
> Laurent
> 
> 
> Laurent Bihanic wrote:
> 
>>
>> Hi,
>>
>> While reading the SAXOutputter code (latest from CVS), I found 2 
>> apparent bugs:
>>
>> 1. No support for Comments as Element children
>> SAXOutputter fires SAX events for Comment nodes in method 
>> output(Document) but not in method elementContent(Element, 
>> NamespaceStack). Hence only top level comments are outputted.
>>
>> 2. No support for CDATA
>> The method characters(String) should be changed (adding an argument or 
>> a new method) to support reporting whether the outputted text is 
>> regular or CDATA using LexicalHandler's start/endCDATA methods.
>>
>> Finally, SAXOutputter's code never checks for EntityRef nodes. Thus 
>> these simply disappear from the outputted document. Is this on 
>> purpose? Shouldn't JDOM at least use ContentHandler's skippedEntity?
>>
>> Laurent



===================================================================
File: no file SAXOutputter.java		Status: Needs Checkout

   Working revision:	1.25	Fri Oct 18 05:43:25 2002
   Repository revision:	1.25	/home/cvspublic/jdom/src/java/org/jdom/output/SAXOutputter.java,v

   Existing Tags:
	jdom_1_0_b8              	(revision: 1.18)
	jdom_1_0_b8_rc1          	(revision: 1.18)
	jdom_prefilter           	(revision: 1.16)
	jdom_1_0_b7              	(revision: 1.11)
	jdom_1_0_b6              	(revision: 1.4)
	start                    	(revision: 1.1.1.1)
	jdom                     	(branch: 1.1.1)




More information about the jdom-commits mailing list