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