< prev index next >

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

Print this page




3009                                     return XMLEvent.CHARACTERS;
3010                                 }
3011                             }
3012 
3013                             //if there was a text declaration, call next() it will be taken care.
3014                             if(fScannerState == SCANNER_STATE_TEXT_DECL){
3015                                 fLastSectionWasEntityReference = true ;
3016                                 continue;
3017                             }
3018 
3019                             if(fScannerState == SCANNER_STATE_REFERENCE){
3020                                 setScannerState(SCANNER_STATE_CONTENT);
3021                                 if (fReplaceEntityReferences &&
3022                                         fEntityStore.isDeclaredEntity(fCurrentEntityName)) {
3023                                     // Skip the entity reference, we don't care
3024                                     continue;
3025                                 }
3026                                 return XMLEvent.ENTITY_REFERENCE;
3027                             }
3028                         }
3029                         //Wether it was character reference, entity reference or built-in entity
3030                         //set the next possible state to SCANNER_STATE_CONTENT
3031                         setScannerState(SCANNER_STATE_CONTENT);
3032                         fLastSectionWasEntityReference = true ;
3033                         continue;
3034                     }
3035 
3036                     case SCANNER_STATE_TEXT_DECL: {
3037                         // scan text decl
3038                         if (fEntityScanner.skipString("<?xml")) {
3039                             fMarkupDepth++;
3040                             // NOTE: special case where entity starts with a PI
3041                             //       whose name starts with "xml" (e.g. "xmlfoo")
3042                             if (isValidNameChar(fEntityScanner.peekChar())) {
3043                                 fStringBuffer.clear();
3044                                 fStringBuffer.append("xml");
3045 
3046                                 if (fNamespaces) {
3047                                     while (isValidNCName(fEntityScanner.peekChar())) {
3048                                         fStringBuffer.append((char)fEntityScanner.scanChar(null));
3049                                     }




3009                                     return XMLEvent.CHARACTERS;
3010                                 }
3011                             }
3012 
3013                             //if there was a text declaration, call next() it will be taken care.
3014                             if(fScannerState == SCANNER_STATE_TEXT_DECL){
3015                                 fLastSectionWasEntityReference = true ;
3016                                 continue;
3017                             }
3018 
3019                             if(fScannerState == SCANNER_STATE_REFERENCE){
3020                                 setScannerState(SCANNER_STATE_CONTENT);
3021                                 if (fReplaceEntityReferences &&
3022                                         fEntityStore.isDeclaredEntity(fCurrentEntityName)) {
3023                                     // Skip the entity reference, we don't care
3024                                     continue;
3025                                 }
3026                                 return XMLEvent.ENTITY_REFERENCE;
3027                             }
3028                         }
3029                         //Whether it was character reference, entity reference or built-in entity
3030                         //set the next possible state to SCANNER_STATE_CONTENT
3031                         setScannerState(SCANNER_STATE_CONTENT);
3032                         fLastSectionWasEntityReference = true ;
3033                         continue;
3034                     }
3035 
3036                     case SCANNER_STATE_TEXT_DECL: {
3037                         // scan text decl
3038                         if (fEntityScanner.skipString("<?xml")) {
3039                             fMarkupDepth++;
3040                             // NOTE: special case where entity starts with a PI
3041                             //       whose name starts with "xml" (e.g. "xmlfoo")
3042                             if (isValidNameChar(fEntityScanner.peekChar())) {
3043                                 fStringBuffer.clear();
3044                                 fStringBuffer.append("xml");
3045 
3046                                 if (fNamespaces) {
3047                                     while (isValidNCName(fEntityScanner.peekChar())) {
3048                                         fStringBuffer.append((char)fEntityScanner.scanChar(null));
3049                                     }


< prev index next >