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


Java XMLEvent.ATTRIBUTE屬性代碼示例

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


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

示例1: getAttributeValue

/**
 * @param namespaceURI
 * @param localName
 * @return
 */
public String getAttributeValue(String namespaceURI, String localName) {
    //State should be either START_ELEMENT or ATTRIBUTE
    if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        XMLAttributesImpl attributes = fScanner.getAttributeIterator();
        if (namespaceURI == null) { //sjsxp issue 70
            return attributes.getValue(attributes.getIndexByLocalName(localName));
        } else {
            return fScanner.getAttributeIterator().getValue(
                    namespaceURI.length() == 0 ? null : namespaceURI, localName);
        }

    } else {
        throw new java.lang.IllegalStateException("Current state is not among the states "
                + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                + getEventTypeString(XMLEvent.ATTRIBUTE)
                + "valid for getAttributeValue()");
    }

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

示例2: handleEvent

private void handleEvent(XMLStreamReader xmlr, int eventType) {
    switch (eventType) {
        case XMLEvent.START_ELEMENT:
            handleStartElement(xmlr);
            break;
        case XMLEvent.END_ELEMENT:
            handleEndElement(xmlr);
            break;
        case XMLEvent.CHARACTERS:
            handleCharacters(xmlr);
            break;
        case XMLEvent.COMMENT:
            handleComment(xmlr);
            break;
        case XMLEvent.ENTITY_REFERENCE:
            break;
        case XMLEvent.ATTRIBUTE:
            break;
        case XMLEvent.DTD:
            break;
        case XMLEvent.CDATA:
            break;
        default:
            break;
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:26,代碼來源:EntityTest.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:SunburstApps,項目名稱:OpenJSharp,代碼行數:29,代碼來源:XMLStreamReaderImpl.java

示例4: getAttributeName

/** Returns the localName of the attribute at the provided
 * index
 * @param index the position of the attribute
 * @return the localName of the attribute
 * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
 */
public QName getAttributeName(int index) {
    //State should be either START_ELEMENT or ATTRIBUTE
    if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        return convertXNIQNametoJavaxQName(fScanner.getAttributeIterator().getQualifiedName(index)) ;
    } else{
        throw new java.lang.IllegalStateException("Current state is not among the states "
                 + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                 + getEventTypeString(XMLEvent.ATTRIBUTE)
                 + "valid for getAttributeName()") ;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:XMLStreamReaderImpl.java

示例5: getAttributeLocalName

/**
 * @param index
 * @return
 */
public String getAttributeLocalName(int index) {
    //State should be either START_ELEMENT or ATTRIBUTE
    if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        return fScanner.getAttributeIterator().getLocalName(index) ;
    } else{
        throw new java.lang.IllegalStateException() ;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:XMLStreamReaderImpl.java

示例6: getAttributeNamespace

/** Returns the namespace of the attribute at the provided
 * index
 * @param index the position of the attribute
 * @return the namespace URI (can be null)
 * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
 */
public String getAttributeNamespace(int index) {
    //State should be either START_ELEMENT or ATTRIBUTE
    if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        return fScanner.getAttributeIterator().getURI(index);
    } else{
        throw new java.lang.IllegalStateException("Current state is not among the states "
                 + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                 + getEventTypeString(XMLEvent.ATTRIBUTE)
                 + "valid for getAttributeNamespace()") ;
    }

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

示例7: getAttributePrefix

/** Returns the prefix of this attribute at the
 * provided index
 * @param index the position of the attribute
 * @return the prefix of the attribute
 * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
 */
public String getAttributePrefix(int index) {
    //State should be either START_ELEMENT or ATTRIBUTE
    if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        return fScanner.getAttributeIterator().getPrefix(index);
    } else{
        throw new java.lang.IllegalStateException("Current state is not among the states "
                 + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                 + getEventTypeString(XMLEvent.ATTRIBUTE)
                 + "valid for getAttributePrefix()") ;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:XMLStreamReaderImpl.java

示例8: getAttributeQName

/** Returns the qname of the attribute at the provided index
 *
 * @param index the position of the attribute
 * @return the QName of the attribute
 * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
 */
public javax.xml.namespace.QName getAttributeQName(int index) {
    //State should be either START_ELEMENT or ATTRIBUTE
    if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        // create new object at runtime..
        String localName = fScanner.getAttributeIterator().getLocalName(index) ;
        String uri = fScanner.getAttributeIterator().getURI(index) ;
        return new javax.xml.namespace.QName(uri, localName) ;
    } else{
        throw new java.lang.IllegalStateException("Current state is not among the states "
                 + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                 + getEventTypeString(XMLEvent.ATTRIBUTE)
                 + "valid for getAttributeQName()") ;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:20,代碼來源:XMLStreamReaderImpl.java

示例9: getAttributeType

/** Returns the XML type of the attribute at the provided
 * index
 * @param index the position of the attribute
 * @return the XML type of the attribute
 * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
 */
public String getAttributeType(int index) {
    //State should be either START_ELEMENT or ATTRIBUTE
    if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        return fScanner.getAttributeIterator().getType(index) ;
    } else{
        throw new java.lang.IllegalStateException("Current state is not among the states "
                 + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                 + getEventTypeString(XMLEvent.ATTRIBUTE)
                 + "valid for getAttributeType()") ;
    }

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

示例10: isAttributeSpecified

/**
 * Returns a boolean which indicates if this attribute was created by
 * default
 *
 * @param index the position of the attribute
 * @return true if this is a default attribute
 * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
 */
public boolean isAttributeSpecified(int index) {
    //check that current state should be either START_ELEMENT or ATTRIBUTE
    if ((fEventType == XMLEvent.START_ELEMENT) || (fEventType == XMLEvent.ATTRIBUTE)) {
        return fScanner.getAttributeIterator().isSpecified(index);
    } else {
        throw new IllegalStateException("Current state is not among the states "
                + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                + getEventTypeString(XMLEvent.ATTRIBUTE)
                + "valid for isAttributeSpecified()");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:19,代碼來源:XMLStreamReaderImpl.java

示例11: isAttributeSpecified

/** Returns a boolean which indicates if this
 * attribute was created by default
 * @param index the position of the attribute
 * @return true if this is a default attribute
 * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
 */
public boolean isAttributeSpecified(int index) {
    //check that current state should be either START_ELEMENT or ATTRIBUTE
    if( (fEventType == XMLEvent.START_ELEMENT) || (fEventType == XMLEvent.ATTRIBUTE)){
        return fScanner.getAttributeIterator().isSpecified(index) ;
    } else{
        throw new IllegalStateException("Current state is not among the states "
                 + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                 + getEventTypeString(XMLEvent.ATTRIBUTE)
                 + "valid for isAttributeSpecified()")  ;
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:17,代碼來源:XMLStreamReaderImpl.java

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

示例13: getAttributeCount

/**
 * Returns the count of attributes on this START_ELEMENT, this method is
 * only valid on a START_ELEMENT or ATTRIBUTE. This count excludes namespace
 * definitions. Attribute indices are zero-based.
 *
 * @return returns the number of attributes
 * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
 */
public int getAttributeCount() {
    //xxx: recognize SAX properties namespace, namespace-prefix to get XML Namespace declarations
    //does length includes namespace declarations ?

    //State should be either START_ELEMENT or ATTRIBUTE
    if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        return fScanner.getAttributeIterator().getLength();
    } else {
        throw new java.lang.IllegalStateException("Current state is not among the states "
                + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                + getEventTypeString(XMLEvent.ATTRIBUTE)
                + "valid for getAttributeCount()");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:22,代碼來源:XMLStreamReaderImpl.java

示例14: getAttributeLocalName

/**
 * @param index
 * @return
 */
public String getAttributeLocalName(int index) {
    //State should be either START_ELEMENT or ATTRIBUTE
    if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        return fScanner.getAttributeIterator().getLocalName(index);
    } else {
        throw new java.lang.IllegalStateException();
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:12,代碼來源:XMLStreamReaderImpl.java

示例15: getAttributePrefix

/**
 * Returns the prefix of this attribute at the provided index
 *
 * @param index the position of the attribute
 * @return the prefix of the attribute
 * @throws IllegalStateException if this is not a START_ELEMENT or ATTRIBUTE
 */
public String getAttributePrefix(int index) {
    //State should be either START_ELEMENT or ATTRIBUTE
    if (fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
        return fScanner.getAttributeIterator().getPrefix(index);
    } else {
        throw new java.lang.IllegalStateException("Current state is not among the states "
                + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
                + getEventTypeString(XMLEvent.ATTRIBUTE)
                + "valid for getAttributePrefix()");
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:18,代碼來源:XMLStreamReaderImpl.java


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