mrglavas 2004/03/29 11:19:31 Modified: java/src/org/apache/xml/serialize BaseMarkupSerializer.java DOMSerializerImpl.java Log: Fixing Bug #27924:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27924 Entity reference nodes with no children should always be serialized even if the 'entities' parameter is set to false. We were breaking out of serializeNode without writing anything for such nodes. The attribute actualEncoding was renamed inputEncoding on the Document interface. We never updated this in the serializer and since the method is being called through reflection, it was failing silently at runtime. Once DOM Level 3 goes to REC all the reflective calls on Document should be replaced with static ones. These two bugs are fixed thanks to the patch from Naela Nissar. Revision Changes Path 1.53 +3 -2 xml-xerces/java/src/org/apache/xml/serialize/BaseMarkupSerializer.java Index: BaseMarkupSerializer.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/BaseMarkupSerializer.java,v retrieving revision 1.52 retrieving revision 1.53 diff -u -r1.52 -r1.53 --- BaseMarkupSerializer.java 24 Feb 2004 23:34:03 -0000 1.52 +++ BaseMarkupSerializer.java 29 Mar 2004 19:19:31 -0000 1.53 @@ -1086,7 +1086,8 @@ endCDATA(); content(); - if ( ((features & DOMSerializerImpl.ENTITIES) != 0)){ + if (((features & DOMSerializerImpl.ENTITIES) != 0) + || (node.getFirstChild() == null)) { if (fDOMFilter !=null && (fDOMFilter.getWhatToShow() & NodeFilter.SHOW_ENTITY_REFERENCE)!= 0) { short code = fDOMFilter.acceptNode(node); 1.19 +8 -4 xml-xerces/java/src/org/apache/xml/serialize/DOMSerializerImpl.java Index: DOMSerializerImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xml/serialize/DOMSerializerImpl.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- DOMSerializerImpl.java 2 Mar 2004 23:06:58 -0000 1.18 +++ DOMSerializerImpl.java 29 Mar 2004 19:19:31 -0000 1.19 @@ -78,6 +78,10 @@ */ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration { + // TODO: When DOM Level 3 goes to REC replace method calls using + // reflection for: getXmlEncoding, getInputEncoding and getXmlEncoding + // with regular static calls on the Document object. + // data // serializer private XMLSerializer serializer; @@ -663,7 +667,7 @@ if ((encoding = destination.getEncoding()) == null) { try { Method getEncoding = - fDocument.getClass().getMethod("getActualEncoding", new Class[] {}); + fDocument.getClass().getMethod("getInputEncoding", new Class[] {}); if (getEncoding != null) { encoding = (String) getEncoding.invoke(fDocument, null); } @@ -802,7 +806,7 @@ * (or its owner document) in this order: * <ol> * <li> - * <code>Document.actualEncoding</code>, + * <code>Document.inputEncoding</code>, * </li> * <li> * <code>Document.xmlEncoding</code>. @@ -856,7 +860,7 @@ try { Method getEncoding = - fDocument.getClass().getMethod("getActualEncoding", new Class[] {}); + fDocument.getClass().getMethod("getInputEncoding", new Class[] {}); if (getEncoding != null) { encoding = (String) getEncoding.invoke(fDocument, null); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]