本文整理了Java中org.apache.axiom.om.OMAttribute.getOwner()
方法的一些代码示例,展示了OMAttribute.getOwner()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMAttribute.getOwner()
方法的具体详情如下:
包路径:org.apache.axiom.om.OMAttribute
类名称:OMAttribute
方法名:getOwner
[英]Returns the owner element of this attribute
[中]返回此属性的所有者元素
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
/**
* Construct an XPath expression from a given attribute.
* The string representation of the expression is taken from the attribute
* value, while the attribute's owner element is used to determine the
* namespace context of the expression.
*
* @param attribute the attribute to construct the expression from
* @throws JaxenException if there is a syntax error while parsing the expression
* or if the namespace context could not be set up
*/
public AXIOMXPath(OMAttribute attribute) throws JaxenException {
this(attribute.getOwner(), attribute.getAttributeValue());
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
/**
* Returns the parent of the given context node.
* <p>
* The parent of any node must either be a document node or an element node.
*
* @param contextNode the context node
* @return Returns the parent of the context node, or null if this is a document node.
* @throws UnsupportedAxisException if the parent axis is not supported by the model
* @see #isDocument
* @see #isElement
*/
public Object getParentNode(Object contextNode) throws UnsupportedAxisException {
if (contextNode == null ||
contextNode instanceof OMDocument) {
return null;
} else if (contextNode instanceof OMAttribute) {
return ((OMAttribute) contextNode).getOwner();
} else if (contextNode instanceof OMNamespaceEx) {
return ((OMNamespaceEx) contextNode).getParent();
}
return ((OMNode) contextNode).getParent();
}
代码示例来源:origin: deegree/deegree3
public QName[] getNodesAsQNames( OMElement contextNode, XPath xpath ) {
QName[] values = null;
List<?> nl = getNodes( contextNode, xpath );
if ( nl != null ) {
values = new QName[nl.size()];
for ( int i = 0; i < nl.size(); i++ ) {
Object node = nl.get( i );
QName value = null;
if ( node instanceof OMText ) {
value = ( (OMText) node ).getTextAsQName();
} else if ( node instanceof OMElement ) {
OMElement element = (OMElement) node;
value = element.resolveQName( element.getText() );
} else if ( node instanceof OMAttribute ) {
OMAttribute attribute = (OMAttribute) node;
value = attribute.getOwner().resolveQName( attribute.getAttributeValue() );
} else {
String msg = "Unexpected node type '" + node.getClass() + "'.";
throw new XMLParsingException( this, contextNode, msg );
}
values[i] = value;
}
} else {
values = new QName[0];
}
return values;
}
代码示例来源:origin: deegree/deegree3
public QName getNodeAsQName( OMElement context, XPath xpath, QName defaultValue )
throws XMLParsingException {
QName value = defaultValue;
Object node = getNode( context, xpath );
if ( node != null ) {
if ( node instanceof OMText ) {
value = ( (OMText) node ).getTextAsQName();
} else if ( node instanceof OMElement ) {
OMElement element = (OMElement) node;
value = element.resolveQName( element.getText() );
} else if ( node instanceof OMAttribute ) {
OMAttribute attribute = (OMAttribute) node;
value = attribute.getOwner().resolveQName( attribute.getAttributeValue() );
} else {
String msg = "Unexpected node type '" + node.getClass() + "'.";
throw new XMLParsingException( this, context, msg );
}
}
return value;
}
代码示例来源:origin: org.wso2.carbon.governance/org.wso2.carbon.governance.list.ui
OMElement parentElement = ((OMAttribute)resultNode).getOwner();
if(parentElement.getAttributeValue(new QName("class")).equals(defaultLifecycleGeneratorClass)){
Iterator childrenIterator = parentElement.getParent().getChildrenWithLocalName("name");
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
/**
* Retrieves an <code>Iterator</code> matching the <code>parent</code> XPath axis.
*
* @param contextNode the original context node
* @return Returns an Iterator capable of traversing the axis, not null.
* @throws UnsupportedAxisException if the semantics of the parent axis are not supported by
* this object model
*/
public Iterator getParentAxisIterator(Object contextNode) throws UnsupportedAxisException {
if (contextNode instanceof OMNode) {
return new SingleObjectIterator(((OMNode) contextNode).getParent());
} else if (contextNode instanceof OMNamespaceEx) {
return new SingleObjectIterator(
((OMNamespaceEx) contextNode).getParent());
} else if (contextNode instanceof OMAttribute) {
return new SingleObjectIterator(
((OMAttribute) contextNode).getOwner());
}
return JaxenConstants.EMPTY_ITERATOR;
}
内容来源于网络,如有侵权,请联系作者删除!