elena 2004/02/12 08:56:07 Modified: java/src/org/apache/xml/serialize BaseMarkupSerializer.java Log: Fixing a bug in XML Serializer -- CDATA sections were automatically
converted to Text; entity references were expanded. Revision Changes Path 1.51 +33 -33 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.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- BaseMarkupSerializer.java 29 Jan 2004 21:11:30 -0000 1.50 +++ BaseMarkupSerializer.java 12 Feb 2004 16:56:07 -0000 1.51 @@ -170,7 +170,7 @@ { // DOM L3 implementation - protected short features; + protected short features = 0xFFFFFFFF; protected DOMErrorHandler fDOMErrorHandler; protected final DOMErrorImpl fDOMError = new DOMErrorImpl(); protected LSSerializerFilter fDOMFilter; @@ -1449,39 +1449,39 @@ && index + 2 < length && text.charAt(index + 1) == ']' && text.charAt(index + 2) == '>') { // check for ']]>' - if (fDOMErrorHandler != null){ - // REVISIT: this means that if DOM Error handler is not registered we don't report any - // fatal errors and might serialize not wellformed document - if ((features & DOMSerializerImpl.SPLITCDATA) == 0 && - (features & DOMSerializerImpl.WELLFORMED) == 0) { - // issue fatal error - String msg = - DOMMessageFormatter.formatMessage( - DOMMessageFormatter.SERIALIZER_DOMAIN, - "EndingCDATA", - null); - modifyDOMError( - msg, - DOMError.SEVERITY_FATAL_ERROR, - fCurrentNode); - boolean continueProcess = + if (fDOMErrorHandler != null) { + // REVISIT: this means that if DOM Error handler is not registered we don't report any + // fatal errors and might serialize not wellformed document + if ((features & DOMSerializerImpl.SPLITCDATA) == 0 + && (features & DOMSerializerImpl.WELLFORMED) == 0) { + // issue fatal error + String msg = + DOMMessageFormatter.formatMessage( + DOMMessageFormatter.SERIALIZER_DOMAIN, + "EndingCDATA", + null); + modifyDOMError( + msg, + DOMError.SEVERITY_FATAL_ERROR, + fCurrentNode); + boolean continueProcess = + fDOMErrorHandler.handleError(fDOMError); + if (!continueProcess) { + throw new IOException(); + } + } else { + // issue warning + String msg = + DOMMessageFormatter.formatMessage( + DOMMessageFormatter.SERIALIZER_DOMAIN, + "SplittingCDATA", + null); + modifyDOMError( + msg, + DOMError.SEVERITY_WARNING, + fCurrentNode); fDOMErrorHandler.handleError(fDOMError); - if (!continueProcess) { - throw new IOException(); } - } else { - // issue warning - String msg = - DOMMessageFormatter.formatMessage( - DOMMessageFormatter.SERIALIZER_DOMAIN, - "SplittingCDATA", - null); - modifyDOMError( - msg, - DOMError.SEVERITY_WARNING, - fCurrentNode); - fDOMErrorHandler.handleError(fDOMError); - } } // split CDATA section _printer.printText("]]]]><![CDATA[>"); --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]