本文整理汇总了Java中org.apache.axiom.om.OMNode.getNextOMSibling方法的典型用法代码示例。如果您正苦于以下问题:Java OMNode.getNextOMSibling方法的具体用法?Java OMNode.getNextOMSibling怎么用?Java OMNode.getNextOMSibling使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axiom.om.OMNode
的用法示例。
在下文中一共展示了OMNode.getNextOMSibling方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setValue
import org.apache.axiom.om.OMNode; //导入方法依赖的package包/类
/**
* If this is a Text node then this method will set its value, otherwise it sets the value of
* the immediate (Text) child of this node. The value of the immediate child of this node can be
* set only if, there is one child node and that node is a Text node, or if there are no
* children in which case a child Text node will be created.
*
* @param value the text to set
* @throws IllegalStateException if the node is not a Text node and either has more than one
* child node or has a child node that is not a Text node
*/
public void setValue(String value) {
OMNode firstChild = element.getFirstOMChild();
if (firstChild == null) {
try {
this.addTextNode(value);
} catch (SOAPException e) {
throw new RuntimeException("Cannot add text node", e);
}
} else if (((org.w3c.dom.Node)firstChild).getNodeType() == javax.xml.soap.Node.TEXT_NODE
&& firstChild.getNextOMSibling() == null) {
((org.w3c.dom.Text)firstChild).setData(value);
} else {
throw new IllegalStateException("This node is not a Text node and " +
"either has more than one child node or has a child " +
"node that is not a Text node");
}
}
示例2: test
import org.apache.axiom.om.OMNode; //导入方法依赖的package包/类
@Test(groups = {"wso2.esb"}, description = "Check the content of the aggregation specified by an xpath")
public void test() throws IOException, XMLStreamException {
String Response = aggregatedRequestClient.getResponse();
Assert.assertNotNull(Response);
OMElement Response2 = AXIOMUtil.stringToOM(Response);
OMElement responseParts = Response2.getFirstElement().getFirstElement();
String singleResponse = responseParts.toString();
Assert.assertTrue(singleResponse.contains("return"), "return child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("change"), "change child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("earnings"), "earnings child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("high"), "high child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("last"), "last child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("lastTradeTimestamp"), "lastTradeTimestamp child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("low"), "low child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("marketCap"), "marketCap child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("open"), "open child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("name"), "name child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("open"), "open child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("peRatio"), "PerRatio child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("percentageChange"), "PercentageChange child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("symbol"), "symbol child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("volume"), "volume child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("getQuoteResponse"), "getQuoteResponse child message does not exist in the aggregated response");
OMNode content = responseParts.getNextOMSibling();
for (int count = 0; count < no_of_requests - 1; count++) {
Assert.assertNotNull(content);
singleResponse = content.toString();
Assert.assertTrue(singleResponse.contains("return"), "return child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("change"), "change child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("earnings"), "earinings child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("high"), "high child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("last"), "last child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("lastTradeTimestamp"), "lastTradeTimestamp child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("low"), "low child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("marketCap"), "marketCap child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("open"), "open child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("name"), "name child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("open"), "open child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("peRatio"), "PerRatio child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("percentageChange"), "PercentageChange child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("symbol"), "symbol child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("volume"), "volume child message does not exist in the aggregated response");
Assert.assertTrue(singleResponse.contains("getQuoteResponse"), "getQuoteResponse child message does not exist in the aggregated response");
content = content.getNextOMSibling();
}
}
示例3: getPathSet
import org.apache.axiom.om.OMNode; //导入方法依赖的package包/类
/**
*
* @return a list of couple file/source folders paths
* @throws OtherException .
* @throws BadFileFormatException .
* @throws FileNotFoundException .
*/
@SuppressWarnings("rawtypes")
public final List<GenerationConfigUnit> getPathSet()
throws FileNotFoundException, BadFileFormatException,
OtherException {
final List<GenerationConfigUnit> out = new ArrayList<GenerationConfigUnit>();
String genModel;
String outSrcFolder;
String outTestFolder;
String tooling;
final OMElement root = getDocument(confFile);
@SuppressWarnings("unused")
final Iterator iter = root.getChildrenWithLocalName("generationset");
OMElement element = root.getFirstElement();
do {
//final OMElement element = (OMElement) iter.next();
genModel = "";
outSrcFolder = "";
outTestFolder = "";
tooling = "";
final Iterator iter2 = element.getChildElements();
while (iter2.hasNext()) {
final OMElement subelement = (OMElement) iter2.next();
if (subelement.getLocalName().equals("genmodel")) {
genModel = subelement.getText().trim();
} else if (subelement.getLocalName().equals("outsrcfolder")) {
outSrcFolder = subelement.getText().trim();
} else if (subelement.getLocalName().equals("outtestfolder")) {
outTestFolder = subelement.getText().trim();
} else if (subelement.getLocalName().equals("tooling")) {
tooling = subelement.getText().trim();
}
}
final GenerationConfigUnit outloc = new GenerationConfigUnit(
genModel, outSrcFolder, outTestFolder, tooling);
out.add(outloc);
// Get next generationset element
OMNode nextElem = element.getNextOMSibling();
while(!(nextElem instanceof OMElement) && nextElem != null)
nextElem = nextElem.getNextOMSibling();
if (nextElem != null)
element = (OMElement)nextElem ;
else
element = null;
} while (element != null);
return out;
}
示例4: countSiblings
import org.apache.axiom.om.OMNode; //导入方法依赖的package包/类
/**
* This is a recursive function to count the number of siblings.
* This is a little confusing, but what it does is traverse through the
* siblings (getNextOMSibling) by checking to see there is a next sibling.
* If there is, it sets the count to 1, and calls itself again. When it reaches
* no next sibling, it returns 1 i.e. the last sibling). Then the method stack
* should return adding up each of the 1's.
*
* @param sibling OMNode
* @param count initial count (i.e. first sibling, this should always be 1).
* @return total sibling count.
*/
private int countSiblings(OMNode sibling, int count) {
if (sibling.getNextOMSibling() != null) {
count = 1; // I am a sibling.
return count + countSiblings(sibling.getNextOMSibling(), 1);
} else {
return 1; // I am the last sibling.
}
}