Package org.apache.xerces.impl

Examples of org.apache.xerces.impl.XMLEntityScanner


    private short determineDocVersion() throws IOException {
        // must assume 1.1 at this stage so that whitespace
        // handling is correct in the XML decl...
        fEntityManager.setScannerVersion(Constants.XML_VERSION_1_1);
        XMLEntityScanner scanner = fEntityManager.getEntityScanner();
        if(!scanner.skipString("<?xml"))  {
            // definitely not a well-formed 1.1 doc!
            return Constants.XML_VERSION_1_0;
        }
        if(!scanner.skipSpaces()) {
            fixupCurrentEntity(fEntityManager, EXPECTED_VERSION_STRING, 5);
            return Constants.XML_VERSION_1_0;
        }
        if(!scanner.skipString("version"))  {
            fixupCurrentEntity(fEntityManager, EXPECTED_VERSION_STRING, 6);
            return Constants.XML_VERSION_1_0;
        }
        scanner.skipSpaces();
        if(scanner.scanChar() != '=') {
            fixupCurrentEntity(fEntityManager, EXPECTED_VERSION_STRING, 13);
            return Constants.XML_VERSION_1_0;
        }
        scanner.skipSpaces();
        int quoteChar = scanner.scanChar();
        EXPECTED_VERSION_STRING[14] = (char)quoteChar;
        for (int versionPos=0; versionPos<XML11_VERSION.length; versionPos++) {
            EXPECTED_VERSION_STRING[15+versionPos] = (char)scanner.scanChar();
        }
        // REVISIT:  should we check whether this equals quoteChar?
        EXPECTED_VERSION_STRING[18] = (char)scanner.scanChar();
        fixupCurrentEntity(fEntityManager, EXPECTED_VERSION_STRING, 19);
        int matched = 0;
        for(; matched<XML11_VERSION.length; matched++) {
            if(EXPECTED_VERSION_STRING[15+matched] != XML11_VERSION[matched]) break;
        }
View Full Code Here

TOP

Related Classes of org.apache.xerces.impl.XMLEntityScanner

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.