本文整理汇总了Java中com.sun.org.apache.xerces.internal.util.XMLAttributesImpl.getValue方法的典型用法代码示例。如果您正苦于以下问题:Java XMLAttributesImpl.getValue方法的具体用法?Java XMLAttributesImpl.getValue怎么用?Java XMLAttributesImpl.getValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.org.apache.xerces.internal.util.XMLAttributesImpl
的用法示例。
在下文中一共展示了XMLAttributesImpl.getValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAttributeValue
import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl; //导入方法依赖的package包/类
/**
* @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()") ;
}
}
示例2: getAttributeValue
import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl; //导入方法依赖的package包/类
/**
* @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()");
}
}