venu 2003/11/01 21:56:06 Modified: java/src/org/apache/xerces/impl XMLDocumentFragmentScannerImpl.java XMLEntityManager.java java/src/org/apache/xerces/util EncodingMap.java Log: Description : DOMInput.setEncoding should take priority when DOMInput has bytestream. Also changed UTF-16 encoding for java. Revision Changes Path 1.39 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java Index: XMLDocumentFragmentScannerImpl.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLDocumentFragmentScannerImpl.java,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- XMLDocumentFragmentScannerImpl.java 22 Oct 2003 18:33:43 -0000 1.38 +++ XMLDocumentFragmentScannerImpl.java 2 Nov 2003 05:56:06 -0000 1.39 @@ -669,7 +669,7 @@ } // set encoding on reader - if (encoding != null) { + if (encoding != null && !fEntityScanner.fCurrentEntity.isDeclaredEncoding()) { fEntityScanner.setEncoding(encoding); } 1.67 +17 -2 xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java Index: XMLEntityManager.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/XMLEntityManager.java,v retrieving revision 1.66 retrieving revision 1.67 diff -u -r1.66 -r1.67 --- XMLEntityManager.java 14 Sep 2003 04:57:11 -0000 1.66 +++ XMLEntityManager.java 2 Nov 2003 05:56:06 -0000 1.67 @@ -923,6 +923,7 @@ String baseSystemId = xmlInputSource.getBaseSystemId(); String encoding = xmlInputSource.getEncoding(); Boolean isBigEndian = null; + boolean declaredEncoding = false; // create reader InputStream stream = null; @@ -934,6 +935,8 @@ } if (reader == null) { stream = xmlInputSource.getByteStream(); + if(stream != null && encoding != null) + declaredEncoding = true; if (stream == null) { URL location = new URL(expandedSystemId); URLConnection connect = location.openConnection(); @@ -1085,6 +1088,7 @@ fCurrentEntity = new ScannedEntity(name, new XMLResourceIdentifierImpl(publicId, literalSystemId, baseSystemId, expandedSystemId), stream, reader, encoding, literal, false, isExternal); + fCurrentEntity.setDeclaredEncoding(declaredEncoding); fEntityScanner.setCurrentEntity(fCurrentEntity); fResourceIdentifier.setValues(publicId, literalSystemId, baseSystemId, expandedSystemId); return encoding; @@ -2287,7 +2291,10 @@ /** Auto-detected encoding. */ public String encoding; - // status + /** Encoding has been set externally for eg: using DOMInput*/ + boolean declaredEncoding = false; + + // status /** True if in a literal. */ public boolean literal; @@ -2439,6 +2446,14 @@ return str.toString(); } // toString():String + + public boolean isDeclaredEncoding() { + return declaredEncoding; + } + + public void setDeclaredEncoding(boolean value) { + declaredEncoding = value; + } } // class ScannedEntity 1.18 +2 -2 xml-xerces/java/src/org/apache/xerces/util/EncodingMap.java Index: EncodingMap.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/util/EncodingMap.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- EncodingMap.java 16 Jul 2003 16:16:31 -0000 1.17 +++ EncodingMap.java 2 Nov 2003 05:56:06 -0000 1.18 @@ -833,7 +833,7 @@ fIANA2JavaMap.put("IBM367", "ASCII"); fIANA2JavaMap.put("CP367", "ASCII"); fIANA2JavaMap.put("UTF-8", "UTF8"); - fIANA2JavaMap.put("UTF-16", "Unicode"); + fIANA2JavaMap.put("UTF-16", "UTF-16"); fIANA2JavaMap.put("UTF-16BE", "UnicodeBig"); fIANA2JavaMap.put("UTF-16LE", "UnicodeLittle");
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]