本文整理了Java中org.apache.axiom.om.OMNode
类的一些代码示例,展示了OMNode
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OMNode
类的具体详情如下:
包路径:org.apache.axiom.om.OMNode
类名称:OMNode
[英]Defines the base interface used by most of the XML object model within Axis.
This tree model for XML captures the idea of deferring the construction of child nodes until they are needed. The isComplete
function identifies whether or not a particular node has been fully parsed. A node may not be fully parsed, for example, if all of the children of an element have not yet been parsed.
In comparison to DOM, in this model, you will not find document fragments, or entities. In addition, while OMDocument and OMAttribute exist, neither is an extension of OMNode
.
[中]定义Axis中大多数XML对象模型使用的基本接口。
这种XML树模型抓住了将子节点的构造推迟到需要时的想法。isComplete
函数标识特定节点是否已被完全解析。例如,如果一个元素的所有子元素还没有被解析,那么一个节点可能没有被完全解析。
与DOM相比,在这个模型中,您将找不到文档片段或实体。此外,尽管存在OMDocument和OMAttribute,但它们都不是[$1$]的扩展。
代码示例来源:origin: org.paxml/paxml-core
/**
* Replace a node with another one.
*
* @param oldNode
* old node
* @param newNode
* new node
* @return the old node that is detached
*/
public static OMNode replaceNode(OMNode oldNode, OMNode newNode) {
oldNode.insertSiblingAfter(newNode);
return oldNode.detach();
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-api
protected OMNode getNextNode(OMNode currentNode) {
return currentNode.getNextOMSibling();
}
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl
public List getAllSoapTexts() {
List faultTexts = new ArrayList(1);
Iterator childrenIter = this.getChildren();
while (childrenIter.hasNext()) {
OMNode node = (OMNode) childrenIter.next();
if (node.getType() == OMNode.ELEMENT_NODE && (node instanceof SOAPFaultText)) {
faultTexts.add(((SOAPFaultText) node));
}
}
return faultTexts;
}
代码示例来源:origin: stackoverflow.com
OMNode child = omElement.getFirstOMChild();
while ( child != null )
{
if ( child instanceof OMText )
{
// process 'child' text here
final OMNode nextSibling = child.getNextOMSibling();
child.detach(); // detach from OM to keep memory usage low
child = nextSibling;
}
}
代码示例来源:origin: org.bluestemsoftware.open.eoa.ext/open-eoa-aspect-axiom
/**
* Returns the first Element node.
*
* @see org.apache.axiom.om.OMElement#getFirstElement()
*/
public OMElement getFirstElement() {
OMNode node = getFirstOMChild();
while (node != null) {
if (node.getType() == Node.ELEMENT_NODE) {
return (OMElement) node;
} else {
node = node.getNextOMSibling();
}
}
return null;
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public void setText(String text) {
complete();
if (text != null) {
OMNode child = this.getFirstOMChild();
while (child != null) {
if (child.getType() == OMNode.TEXT_NODE) {
child.detach();
}
child = child.getNextOMSibling();
}
getOMFactory().createOMText(this, text);
} else
_removeAllChildren();
// return (T)this;
}
代码示例来源:origin: org.paxml/paxml-core
static void processExpressions(ITag tag, IParserContext context) {
if (!(tag instanceof ExpressionTag)) {
// make sure all text nodes are converted to <expression> tags
OMElement ele = context.getElement();
for (OMNode child : AxiomUtils.getNodes(ele)) {
if (child.getType() == OMNode.TEXT_NODE) {
OMText textNode = (OMText) child;
String text = textNode.getText();
if (StringUtils.isNotBlank(text)) {
OMElement expTag = createExpressionTag(text, ele.getLineNumber());
child.insertSiblingAfter(expTag);
child.detach();
}
}
}
}
}
代码示例来源:origin: org.apache.axis2/axis2-saaj
public final void detachNode() {
omTarget.detach();
}
代码示例来源:origin: org.apache.synapse/synapse-core
if (resultValue instanceof String) {
OMAbstractFactory.getOMFactory().createOMText(
((OMNode) o).getParent(), (String) resultValue);
((OMNode) o).detach();
} else if (resultValue instanceof OMNode) {
((OMNode) o).insertSiblingAfter((OMNode) resultValue);
((OMNode) o).detach();
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl
/**
* Constructor.
*
* @param root
* the root node of the object model subtree that is being serialized; this
* information is used by the serializer in scenarios that require access to the
* namespace context of the parent of the root node
* @param namespaceRepairing
* indicates if the serializer should perform namespace repairing
* @param preserveNamespaceContext
* indicates if the namespace context determined by the ancestors of the root node
* should be strictly preserved in the output
*/
public Serializer(OMSerializable root, boolean namespaceRepairing, boolean preserveNamespaceContext) {
this.root = root;
if (root instanceof OMNode) {
OMContainer parent = ((OMNode)root).getParent();
if (parent instanceof OMElement) {
contextElement = (OMElement)parent;
} else {
contextElement = null;
}
} else {
contextElement = null;
}
this.namespaceRepairing = namespaceRepairing;
this.preserveNamespaceContext = preserveNamespaceContext;
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-c14n
public Node getNextSibling() {
if (next == null) {
if (node.getParent() instanceof OMDocument) {
OMNode n = node.getNextOMSibling();
do {
if (!(n instanceof OMText)) {
next = fac.getNode(n);
break;
}
n = n.getNextOMSibling();
} while (true);
} else {
next = fac.getNode(node.getNextOMSibling());
}
}
return next;
}
代码示例来源:origin: wso2/wso2-synapse
Object o = expression.evaluate(envelope, synCtx);
if (o instanceof OMNode) {
resultContainer.setParent(((OMNode) o).getParent());
elementList.add(((OMNode) o).detach());
} else if (o instanceof List) {
List oList = (List) o;
if (oList.size() > 0) {
resultContainer.setParent((((OMNode) oList.get(0)).getParent()));
elementList.add(((OMNode) elem).detach());
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-c14n
public Node getPreviousSibling() {
if (prev == null) {
if (node.getParent() instanceof OMDocument) {
OMNode n = node.getPreviousOMSibling();
do {
if (!(n instanceof OMText)) {
prev = fac.getNode(n);
break;
}
n = n.getPreviousOMSibling();
} while (true);
} else {
prev = fac.getNode(node.getPreviousOMSibling());
}
}
return prev;
}
代码示例来源:origin: org.apache.axis2/axis2-saaj
public SOAPElement addTextNode(String text) throws SOAPException {
Node firstChild = target.getFirstChild();
if (firstChild instanceof org.w3c.dom.Text) {
((org.w3c.dom.Text)firstChild).setData(text);
} else {
// Else this is a header
((OMNode)firstChild).insertSiblingBefore(this.omTarget.getOMFactory().createOMText(text));
}
return this;
}
代码示例来源:origin: org.ballerinalang/ballerina-core
/**
* {@inheritDoc}
*/
@Override
public void build() {
this.omNode.build();
}
代码示例来源:origin: org.apache.ws.commons.axiom/axiom-impl
while (node != null) {
if (node instanceof SOAPBody) {
node.insertSiblingBefore(child);
return;
node = node.getPreviousOMSibling();
代码示例来源:origin: deegree/deegree3
om.detach();
prevSib.insertSiblingAfter( newEl );
代码示例来源:origin: org.apache.abdera/abdera-parser
public <T extends Element> T setText(Content.Type type, String value) {
complete();
init(type);
if (value != null) {
OMNode child = this.getFirstOMChild();
while (child != null) {
if (child.getType() == OMNode.TEXT_NODE) {
child.detach();
}
child = child.getNextOMSibling();
}
getOMFactory().createOMText(this, value);
} else
_removeAllChildren();
return (T)this;
}
代码示例来源:origin: org.paxml/PaxmlCore
static void processExpressions(ITag tag, IParserContext context) {
if (!(tag instanceof ExpressionTag)) {
// make sure all text nodes are converted to <expression> tags
OMElement ele = context.getElement();
for (OMNode child : AxiomUtils.getNodes(ele)) {
if (child.getType() == OMNode.TEXT_NODE) {
OMText textNode = (OMText) child;
String text = textNode.getText();
if (StringUtils.isNotBlank(text)) {
OMElement expTag = createExpressionTag(text, ele.getLineNumber());
child.insertSiblingAfter(expTag);
child.detach();
}
}
}
}
}
代码示例来源:origin: apache/axis2-java
public final void detachNode() {
omTarget.detach();
}
内容来源于网络,如有侵权,请联系作者删除!