当前位置: 首页>>代码示例>>Java>>正文


Java XMLEvent.PROCESSING_INSTRUCTION属性代码示例

本文整理汇总了Java中javax.xml.stream.events.XMLEvent.PROCESSING_INSTRUCTION属性的典型用法代码示例。如果您正苦于以下问题:Java XMLEvent.PROCESSING_INSTRUCTION属性的具体用法?Java XMLEvent.PROCESSING_INSTRUCTION怎么用?Java XMLEvent.PROCESSING_INSTRUCTION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在javax.xml.stream.events.XMLEvent的用法示例。


在下文中一共展示了XMLEvent.PROCESSING_INSTRUCTION属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPIData

/** Get the data section of a processing instruction
 * @return the data or null
 */

public String getPIData() {
    if( fEventType == XMLEvent.PROCESSING_INSTRUCTION){
        return fScanner.getPIData().toString();
    }
    else throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType) +
    " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION  ) ;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:XMLStreamReaderImpl.java

示例2: getPITarget

/** Get the target of a processing instruction
 * @return the target or null
 */
public String getPITarget() {
    if( fEventType == XMLEvent.PROCESSING_INSTRUCTION){
        return fScanner.getPITarget();
    }
    else throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType) +
    " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION  ) ;

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:XMLStreamReaderImpl.java

示例3: getValue

/**
 * @return
 */
public String getValue() {
    if(fEventType == XMLEvent.PROCESSING_INSTRUCTION){
        return fScanner.getPIData().toString();
    } else if(fEventType == XMLEvent.COMMENT){
        return fScanner.getComment();
    } else if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT){
        return fScanner.getElementQName().localpart ;
    } else if(fEventType == XMLEvent.CHARACTERS){
        return fScanner.getCharacterData().toString();
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:15,代码来源:XMLStreamReaderImpl.java

示例4: hasValue

/**
 * @return
 */
public boolean hasValue() {
    if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
    || fEventType == XMLEvent.ENTITY_REFERENCE || fEventType == XMLEvent.PROCESSING_INSTRUCTION
    || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CHARACTERS) {
        return true;
    } else {
        return false;
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:XMLStreamReaderImpl.java

示例5: 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

示例6: getPIData

/**
 * Get the data section of a processing instruction
 *
 * @return the data or null
 */
public String getPIData() {
    if (fEventType == XMLEvent.PROCESSING_INSTRUCTION) {
        return fScanner.getPIData().toString();
    } else {
        throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType)
                + " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:XMLStreamReaderImpl.java

示例7: getPITarget

/**
 * Get the target of a processing instruction
 *
 * @return the target or null
 */
public String getPITarget() {
    if (fEventType == XMLEvent.PROCESSING_INSTRUCTION) {
        return fScanner.getPITarget();
    } else {
        throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType)
                + " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION);
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:14,代码来源:XMLStreamReaderImpl.java

示例8: getValue

/**
 * @return
 */
public String getValue() {
    if (fEventType == XMLEvent.PROCESSING_INSTRUCTION) {
        return fScanner.getPIData().toString();
    } else if (fEventType == XMLEvent.COMMENT) {
        return fScanner.getComment();
    } else if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
        return fScanner.getElementQName().localpart;
    } else if (fEventType == XMLEvent.CHARACTERS) {
        return fScanner.getCharacterData().toString();
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:XMLStreamReaderImpl.java

示例9: hasValue

/**
 * @return
 */
public boolean hasValue() {
    if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
            || fEventType == XMLEvent.ENTITY_REFERENCE || fEventType == XMLEvent.PROCESSING_INSTRUCTION
            || fEventType == XMLEvent.COMMENT || fEventType == XMLEvent.CHARACTERS) {
        return true;
    } else {
        return false;
    }

}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:XMLStreamReaderImpl.java

示例10: 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

示例11: isIgnorable

private boolean isIgnorable(XMLEvent event) {
    int eventType = event.getEventType();
    return eventType==XMLEvent.COMMENT || eventType==XMLEvent.PROCESSING_INSTRUCTION;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:StAXEventConnector.java

示例12: 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

示例13: isProcessingInstruction

public boolean isProcessingInstruction() {
    return fEventType == XMLEvent.PROCESSING_INSTRUCTION;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:3,代码来源:DummyEvent.java


注:本文中的javax.xml.stream.events.XMLEvent.PROCESSING_INSTRUCTION属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。