当前位置: 首页>>代码示例>>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;未经允许,请勿转载。