mrglavas 2003/12/01 14:45:20 Modified: java/src/org/apache/xerces/xinclude XIncludeHandler.java Log: Fixing Bug #24318: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24318 Comments and PIs from the DTD should be directed to the DTDHandler. Revision Changes Path 1.12 +29 -13 xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java Index: XIncludeHandler.java =================================================================== RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/xinclude/XIncludeHandler.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- XIncludeHandler.java 1 Dec 2003 21:52:32 -0000 1.11 +++ XIncludeHandler.java 1 Dec 2003 22:45:20 -0000 1.12 @@ -287,6 +287,9 @@ // track the version of the document being parsed private boolean fIsXML11; + // track whether a DTD is being parsed + private boolean fInDTD; + // track whether a warning has already been reported for // use of the old http://www.w3.org/2001/XInclude namespace. private boolean fOldNamespaceWarningIssued; @@ -319,6 +322,7 @@ fUnparsedEntities = new Vector(); fParentRelativeURI = null; fIsXML11 = false; + fInDTD = false; fOldNamespaceWarningIssued = false; baseURIScope.clear(); @@ -578,12 +582,17 @@ public void comment(XMLString text, Augmentations augs) throws XNIException { - if (fDocumentHandler != null - && getState() == STATE_NORMAL_PROCESSING) { - fDepth++; - augs = modifyAugmentations(augs); - fDocumentHandler.comment(text, augs); - fDepth--; + if (!fInDTD) { + if (fDocumentHandler != null + && getState() == STATE_NORMAL_PROCESSING) { + fDepth++; + augs = modifyAugmentations(augs); + fDocumentHandler.comment(text, augs); + fDepth--; + } + } + else if (fDTDHandler != null) { + fDTDHandler.comment(text, augs); } } @@ -592,13 +601,18 @@ XMLString data, Augmentations augs) throws XNIException { - if (fDocumentHandler != null - && getState() == STATE_NORMAL_PROCESSING) { - // we need to change the depth like this so that modifyAugmentations() works - fDepth++; - augs = modifyAugmentations(augs); - fDocumentHandler.processingInstruction(target, data, augs); - fDepth--; + if (!fInDTD) { + if (fDocumentHandler != null + && getState() == STATE_NORMAL_PROCESSING) { + // we need to change the depth like this so that modifyAugmentations() works + fDepth++; + augs = modifyAugmentations(augs); + fDocumentHandler.processingInstruction(target, data, augs); + fDepth--; + } + } + else if (fDTDHandler != null) { + fDTDHandler.processingInstruction(target, data, augs); } } @@ -864,6 +878,7 @@ if (fDTDHandler != null) { fDTDHandler.endDTD(augmentations); } + fInDTD = false; } /* (non-Javadoc) @@ -980,6 +995,7 @@ */ public void startDTD(XMLLocator locator, Augmentations augmentations) throws XNIException { + fInDTD = true; if (fDTDHandler != null) { fDTDHandler.startDTD(locator, augmentations); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]