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

Print this page




2711                             //element content is there..
2712                             setScannerState(SCANNER_STATE_CHARACTER_DATA);
2713                             break;
2714                         }
2715                     }
2716 
2717                     case SCANNER_STATE_START_OF_MARKUP: {
2718                         startOfMarkup();
2719                         break;
2720                     }//case: SCANNER_STATE_START_OF_MARKUP
2721 
2722                 }//end of switch
2723                 //decideSubState() ;
2724 
2725                 //do some special handling if isCoalesce is set to true.
2726                 if(fIsCoalesce){
2727                     fUsebuffer = true ;
2728                     //if the last section was character data
2729                     if(fLastSectionWasCharacterData){
2730 
2731                         //if we dont encounter any CDATA or ENITY REFERENCE and current state is also not SCANNER_STATE_CHARACTER_DATA
2732                         //return the last scanned charactrer data.
2733                         if((fScannerState != SCANNER_STATE_CDATA) && (fScannerState != SCANNER_STATE_REFERENCE)
2734                         && (fScannerState != SCANNER_STATE_CHARACTER_DATA)){
2735                             fLastSectionWasCharacterData = false;
2736                             return XMLEvent.CHARACTERS;
2737                         }
2738                     }//if last section was CDATA or ENTITY REFERENCE
2739                     //xxx: there might be another entity reference or CDATA after this
2740                     //<foo>blah blah &amp;&lt;<![CDATA[[aa]]>blah blah</foo>
2741                     else if((fLastSectionWasCData || fLastSectionWasEntityReference)){
2742                         //and current state is not SCANNER_STATE_CHARACTER_DATA
2743                         //or SCANNER_STATE_CDATA or SCANNER_STATE_REFERENCE
2744                         //this means there is nothing more to be coalesced.
2745                         //return the CHARACTERS event.
2746                         if((fScannerState != SCANNER_STATE_CDATA) && (fScannerState != SCANNER_STATE_REFERENCE)
2747                         && (fScannerState != SCANNER_STATE_CHARACTER_DATA)){
2748 
2749                             fLastSectionWasCData = false;
2750                             fLastSectionWasEntityReference = false;
2751                             return XMLEvent.CHARACTERS;




2711                             //element content is there..
2712                             setScannerState(SCANNER_STATE_CHARACTER_DATA);
2713                             break;
2714                         }
2715                     }
2716 
2717                     case SCANNER_STATE_START_OF_MARKUP: {
2718                         startOfMarkup();
2719                         break;
2720                     }//case: SCANNER_STATE_START_OF_MARKUP
2721 
2722                 }//end of switch
2723                 //decideSubState() ;
2724 
2725                 //do some special handling if isCoalesce is set to true.
2726                 if(fIsCoalesce){
2727                     fUsebuffer = true ;
2728                     //if the last section was character data
2729                     if(fLastSectionWasCharacterData){
2730 
2731                         //if we dont encounter any CDATA or ENTITY REFERENCE and current state is also not SCANNER_STATE_CHARACTER_DATA
2732                         //return the last scanned charactrer data.
2733                         if((fScannerState != SCANNER_STATE_CDATA) && (fScannerState != SCANNER_STATE_REFERENCE)
2734                         && (fScannerState != SCANNER_STATE_CHARACTER_DATA)){
2735                             fLastSectionWasCharacterData = false;
2736                             return XMLEvent.CHARACTERS;
2737                         }
2738                     }//if last section was CDATA or ENTITY REFERENCE
2739                     //xxx: there might be another entity reference or CDATA after this
2740                     //<foo>blah blah &amp;&lt;<![CDATA[[aa]]>blah blah</foo>
2741                     else if((fLastSectionWasCData || fLastSectionWasEntityReference)){
2742                         //and current state is not SCANNER_STATE_CHARACTER_DATA
2743                         //or SCANNER_STATE_CDATA or SCANNER_STATE_REFERENCE
2744                         //this means there is nothing more to be coalesced.
2745                         //return the CHARACTERS event.
2746                         if((fScannerState != SCANNER_STATE_CDATA) && (fScannerState != SCANNER_STATE_REFERENCE)
2747                         && (fScannerState != SCANNER_STATE_CHARACTER_DATA)){
2748 
2749                             fLastSectionWasCData = false;
2750                             fLastSectionWasEntityReference = false;
2751                             return XMLEvent.CHARACTERS;