當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。