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

Print this page




1786                 }
1787             }
1788         }
1789 
1790     } // scanCharReference()
1791 
1792 
1793     /**
1794      * Scans an entity reference.
1795      *
1796      * @return returns true if the new entity is started. If it was built-in entity
1797      *         'false' is returned.
1798      * @throws IOException  Thrown if i/o error occurs.
1799      * @throws XNIException Thrown if handler throws exception upon
1800      *                      notification.
1801      */
1802     protected void scanEntityReference(XMLStringBuffer content) throws IOException, XNIException {
1803         String name = fEntityScanner.scanName();
1804         if (name == null) {
1805             reportFatalError("NameRequiredInReference", null);

1806         }
1807         if (!fEntityScanner.skipChar(';')) {
1808             reportFatalError("SemicolonRequiredInReference", new Object []{name});
1809         }
1810         if (fEntityStore.isUnparsedEntity(name)) {
1811             reportFatalError("ReferenceToUnparsedEntity", new Object[]{name});
1812         }
1813         fMarkupDepth--;
1814         fCurrentEntityName = name;
1815 
1816         // handle built-in entities
1817         if (name == fAmpSymbol) {
1818             handleCharacter('&', fAmpSymbol, content);
1819             fScannerState = SCANNER_STATE_BUILT_IN_REFS;
1820             return ;
1821         } else if (name == fLtSymbol) {
1822             handleCharacter('<', fLtSymbol, content);
1823             fScannerState = SCANNER_STATE_BUILT_IN_REFS;
1824             return ;
1825         } else if (name == fGtSymbol) {




1786                 }
1787             }
1788         }
1789 
1790     } // scanCharReference()
1791 
1792 
1793     /**
1794      * Scans an entity reference.
1795      *
1796      * @return returns true if the new entity is started. If it was built-in entity
1797      *         'false' is returned.
1798      * @throws IOException  Thrown if i/o error occurs.
1799      * @throws XNIException Thrown if handler throws exception upon
1800      *                      notification.
1801      */
1802     protected void scanEntityReference(XMLStringBuffer content) throws IOException, XNIException {
1803         String name = fEntityScanner.scanName();
1804         if (name == null) {
1805             reportFatalError("NameRequiredInReference", null);
1806             return;
1807         }
1808         if (!fEntityScanner.skipChar(';')) {
1809             reportFatalError("SemicolonRequiredInReference", new Object []{name});
1810         }
1811         if (fEntityStore.isUnparsedEntity(name)) {
1812             reportFatalError("ReferenceToUnparsedEntity", new Object[]{name});
1813         }
1814         fMarkupDepth--;
1815         fCurrentEntityName = name;
1816 
1817         // handle built-in entities
1818         if (name == fAmpSymbol) {
1819             handleCharacter('&', fAmpSymbol, content);
1820             fScannerState = SCANNER_STATE_BUILT_IN_REFS;
1821             return ;
1822         } else if (name == fLtSymbol) {
1823             handleCharacter('<', fLtSymbol, content);
1824             fScannerState = SCANNER_STATE_BUILT_IN_REFS;
1825             return ;
1826         } else if (name == fGtSymbol) {