📄 attributefinder.java
字号:
package com.esri.solutions.jitk.datasources.ogc.wfs.parsing.stax;
import java.util.Iterator;
import javax.xml.stream.events.Attribute;
import javax.xml.stream.events.StartElement;
public class AttributeFinder {
public AttributeFinder() {
}
@SuppressWarnings("unchecked")
public boolean hasAttribute(StartElement se, String attribute, String value) {
Iterator i = se.getAttributes();
return hasAttribute(i, attribute, value);
}
@SuppressWarnings("unchecked")
public boolean hasAttribute(Iterator i, String attribute, String value) {
while (i.hasNext()) {
Attribute attr = (Attribute) i.next();
if (attr.getName().getLocalPart().equals(attribute)) {
if (attr.getValue().equals(value)) {
return true;
}
}
}
return false;
}
@SuppressWarnings("unchecked")
public String getAttributeValue(Iterator i, String attribute) {
while (i.hasNext()) {
Attribute attr = (Attribute) i.next();
if (attr.getName().getLocalPart().equals(attribute)) {
return attr.getValue();
}
}
return null;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -