當前位置: 首頁>>代碼示例>>Java>>正文


Java XMLEvent.START_DOCUMENT屬性代碼示例

本文整理匯總了Java中javax.xml.stream.events.XMLEvent.START_DOCUMENT屬性的典型用法代碼示例。如果您正苦於以下問題:Java XMLEvent.START_DOCUMENT屬性的具體用法?Java XMLEvent.START_DOCUMENT怎麽用?Java XMLEvent.START_DOCUMENT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在javax.xml.stream.events.XMLEvent的用法示例。


在下文中一共展示了XMLEvent.START_DOCUMENT屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getEventTypeString

final static String getEventTypeString(int eventType) {
    switch (eventType){
        case XMLEvent.START_ELEMENT:
            return "START_ELEMENT";
        case XMLEvent.END_ELEMENT:
            return "END_ELEMENT";
        case XMLEvent.PROCESSING_INSTRUCTION:
            return "PROCESSING_INSTRUCTION";
        case XMLEvent.CHARACTERS:
            return "CHARACTERS";
        case XMLEvent.COMMENT:
            return "COMMENT";
        case XMLEvent.START_DOCUMENT:
            return "START_DOCUMENT";
        case XMLEvent.END_DOCUMENT:
            return "END_DOCUMENT";
        case XMLEvent.ENTITY_REFERENCE:
            return "ENTITY_REFERENCE";
        case XMLEvent.ATTRIBUTE:
            return "ATTRIBUTE";
        case XMLEvent.DTD:
            return "DTD";
        case XMLEvent.CDATA:
            return "CDATA";
        case XMLEvent.SPACE:
            return "SPACE";
    }
    return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:29,代碼來源:XMLStreamReaderImpl.java

示例2: next

public int next() throws IOException, XNIException {

            // next driver is prolog regardless of whether there
            // is an XMLDecl in this document
            setScannerState(SCANNER_STATE_PROLOG);
            setDriver(fPrologDriver);

            //System.out.println("fEntityScanner = " + fEntityScanner);
            // scan XMLDecl
            try {
                if (fEntityScanner.skipString(XMLDECL)) {
                    if (XMLChar.isSpace(fEntityScanner.peekChar())) {
                        fMarkupDepth++;
                        scanXMLDeclOrTextDecl(false);
                    } else {
                        // PI, reset position
                        fEntityManager.fCurrentEntity.position = 0;
                    }
                }

                //START_OF_THE_DOCUMENT
                fEntityManager.fCurrentEntity.mayReadChunks = true;
                return XMLEvent.START_DOCUMENT;

            }

            // premature end of file
            catch (EOFException e) {
                reportFatalError("PrematureEOF", null);
                return -1;
                //throw e;
            }

        }
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:34,代碼來源:XMLDocumentScannerImpl.java

示例3: getEventTypeString

final static String getEventTypeString(int eventType) {
    switch (eventType) {
        case XMLEvent.START_ELEMENT:
            return "START_ELEMENT";
        case XMLEvent.END_ELEMENT:
            return "END_ELEMENT";
        case XMLEvent.PROCESSING_INSTRUCTION:
            return "PROCESSING_INSTRUCTION";
        case XMLEvent.CHARACTERS:
            return "CHARACTERS";
        case XMLEvent.COMMENT:
            return "COMMENT";
        case XMLEvent.START_DOCUMENT:
            return "START_DOCUMENT";
        case XMLEvent.END_DOCUMENT:
            return "END_DOCUMENT";
        case XMLEvent.ENTITY_REFERENCE:
            return "ENTITY_REFERENCE";
        case XMLEvent.ATTRIBUTE:
            return "ATTRIBUTE";
        case XMLEvent.DTD:
            return "DTD";
        case XMLEvent.CDATA:
            return "CDATA";
        case XMLEvent.SPACE:
            return "SPACE";
    }
    return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:29,代碼來源:XMLStreamReaderImpl.java

示例4: next

public int next() throws IOException, XNIException {
    if(DEBUG_NEXT){
        System.out.println("NOW IN XMLDeclDriver");
    }

    // next driver is prolog regardless of whether there
    // is an XMLDecl in this document
    setScannerState(SCANNER_STATE_PROLOG);
    setDriver(fPrologDriver);

    //System.out.println("fEntityScanner = " + fEntityScanner);
    // scan XMLDecl
    try {
        if (fEntityScanner.skipString(xmlDecl)) {
            fMarkupDepth++;
            // NOTE: special case where document starts with a PI
            //       whose name starts with "xml" (e.g. "xmlfoo")
            if (XMLChar.isName(fEntityScanner.peekChar())) {
                fStringBuffer.clear();
                fStringBuffer.append("xml");
                while (XMLChar.isName(fEntityScanner.peekChar())) {
                    fStringBuffer.append((char)fEntityScanner.scanChar());
                }
                String target = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length);
                //this function should fill the data.. and set the fEvent object to this event.
                fContentBuffer.clear() ;
                scanPIData(target, fContentBuffer);
                //REVISIT:where else we can set this value to 'true'
                fEntityManager.fCurrentEntity.mayReadChunks = true;
                //return PI event since PI was encountered
                return XMLEvent.PROCESSING_INSTRUCTION ;
            }
            // standard XML declaration
            else {
                scanXMLDeclOrTextDecl(false);
                //REVISIT:where else we can set this value to 'true'
                fEntityManager.fCurrentEntity.mayReadChunks = true;
                return XMLEvent.START_DOCUMENT;
            }
        } else{
            //REVISIT:where else we can set this value to 'true'
            fEntityManager.fCurrentEntity.mayReadChunks = true;
            //In both case return the START_DOCUMENT. ony difference is that first block will
            //cosume the XML declaration if any.
            return XMLEvent.START_DOCUMENT;
        }


        //START_OF_THE_DOCUMENT


    }

    // premature end of file
    catch (EOFException e) {
        reportFatalError("PrematureEOF", null);
        return -1;
        //throw e;
    }

}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:61,代碼來源:XMLDocumentScannerImpl.java

示例5: isStartDocument

public boolean isStartDocument() {
    return fEventType == XMLEvent.START_DOCUMENT;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:3,代碼來源:DummyEvent.java


注:本文中的javax.xml.stream.events.XMLEvent.START_DOCUMENT屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。