本文整理汇总了Java中com.sun.xml.internal.messaging.saaj.soap.name.NameImpl.getPrefixFromTagName方法的典型用法代码示例。如果您正苦于以下问题:Java NameImpl.getPrefixFromTagName方法的具体用法?Java NameImpl.getPrefixFromTagName怎么用?Java NameImpl.getPrefixFromTagName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.xml.internal.messaging.saaj.soap.name.NameImpl
的用法示例。
在下文中一共展示了NameImpl.getPrefixFromTagName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllAttributesFrom
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; //导入方法依赖的package包/类
protected static Iterator getAllAttributesFrom(final Element element) {
final NamedNodeMap attributes = element.getAttributes();
return new Iterator() {
int attributesLength = attributes.getLength();
int attributeIndex = 0;
String currentName;
public boolean hasNext() {
return attributeIndex < attributesLength;
}
public Object next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
Node current = attributes.item(attributeIndex++);
currentName = current.getNodeName();
String prefix = NameImpl.getPrefixFromTagName(currentName);
if (prefix.length() == 0) {
return NameImpl.createFromUnqualifiedName(currentName);
} else {
Name attributeName =
NameImpl.createFromQualifiedName(
currentName,
current.getNamespaceURI());
return attributeName;
}
}
public void remove() {
if (currentName == null) {
throw new IllegalStateException();
}
attributes.removeNamedItem(currentName);
}
};
}
示例2: getAllAttributesFrom
import com.sun.xml.internal.messaging.saaj.soap.name.NameImpl; //导入方法依赖的package包/类
protected static Iterator<Name> getAllAttributesFrom(final Element element) {
final NamedNodeMap attributes = element.getAttributes();
return new Iterator<Name>() {
int attributesLength = attributes.getLength();
int attributeIndex = 0;
String currentName;
@Override
public boolean hasNext() {
return attributeIndex < attributesLength;
}
@Override
public Name next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
Node current = attributes.item(attributeIndex++);
currentName = current.getNodeName();
String prefix = NameImpl.getPrefixFromTagName(currentName);
if (prefix.length() == 0) {
return NameImpl.createFromUnqualifiedName(currentName);
} else {
Name attributeName =
NameImpl.createFromQualifiedName(
currentName,
current.getNamespaceURI());
return attributeName;
}
}
@Override
public void remove() {
if (currentName == null) {
throw new IllegalStateException();
}
attributes.removeNamedItem(currentName);
}
};
}