jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java

Print this page

        

*** 381,390 **** --- 381,392 ---- protected boolean fAddDefaultAttr = false; protected boolean foundBuiltInRefs = false; + /** Built-in reference character event */ + protected boolean builtInRefCharacterHandled = false; //skip element algorithm static final short MAX_DEPTH_LIMIT = 5 ; static final short ELEMENT_ARRAY_LENGTH = 200 ; static final short MAX_POINTER_AT_A_DEPTH = 4 ;
*** 1947,1957 **** fSingleChar[0] = c; if (fNotifyBuiltInRefs) { fDocumentHandler.startGeneralEntity(entity, null, null, null); } fTempString.setValues(fSingleChar, 0, 1); ! //fDocumentHandler.characters(fTempString, null); if (fNotifyBuiltInRefs) { fDocumentHandler.endGeneralEntity(entity, null); } } --- 1949,1962 ---- fSingleChar[0] = c; if (fNotifyBuiltInRefs) { fDocumentHandler.startGeneralEntity(entity, null, null, null); } fTempString.setValues(fSingleChar, 0, 1); ! if(!fIsCoalesce){ ! fDocumentHandler.characters(fTempString, null); ! builtInRefCharacterHandled = true; ! } if (fNotifyBuiltInRefs) { fDocumentHandler.endGeneralEntity(entity, null); } }
*** 3066,3077 **** --- 3071,3087 ---- scanEntityReference(fContentBuffer); //if there was built-in entity reference & coalesce is not true //return CHARACTERS if(fScannerState == SCANNER_STATE_BUILT_IN_REFS && !fIsCoalesce){ setScannerState(SCANNER_STATE_CONTENT); + if (builtInRefCharacterHandled) { + builtInRefCharacterHandled = false; + return XMLEvent.ENTITY_REFERENCE; + } else { return XMLEvent.CHARACTERS; } + } //if there was a text declaration, call next() it will be taken care. if(fScannerState == SCANNER_STATE_TEXT_DECL){ fLastSectionWasEntityReference = true ; continue;