本文整理汇总了Java中javax.xml.soap.SOAPElement.getChildNodes方法的典型用法代码示例。如果您正苦于以下问题:Java SOAPElement.getChildNodes方法的具体用法?Java SOAPElement.getChildNodes怎么用?Java SOAPElement.getChildNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.soap.SOAPElement
的用法示例。
在下文中一共展示了SOAPElement.getChildNodes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUniqueID
import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
public static String getUniqueID(SOAPElement itinerary) {
String uniqueID = "";
NodeList nodeList = itinerary.getChildNodes();
try {
for(int index1=0; index1<nodeList.getLength() ; index1++) {
Node node1 = nodeList.item(index1);
if(node1.getNodeName().endsWith("ItineraryRef")) {
for (int index2=0 ; index2<node1.getChildNodes().getLength() ; index2++) {
Node node2 = node1.getChildNodes().item(index2);
if(node2.getNodeName().endsWith("UniqueID")) {
uniqueID = node2.getTextContent();
break;
}
}
}
}
} catch (Exception ex) {
}
return uniqueID;
}
示例2: moveChildren
import javax.xml.soap.SOAPElement; //导入方法依赖的package包/类
/**
* Move all the children under from SOAPElement to under to SOAPElement. If
* updateNamespaceAndPrefix is true and from elements do not have namespace
* URI yet, to elements namespace URI and prefix are recursively copied to
* them.
*
* @param from source element
* @param to target element
* @param updateNamespaceAndPrefix should elements namespace URI and prefix
* be applied to all the copied elements if they do not have namespace URI
* yet
* @throws SOAPException if there's an error
*/
public static void moveChildren(SOAPElement from, SOAPElement to, boolean updateNamespaceAndPrefix) throws SOAPException {
NodeList children = from.getChildNodes();
for (int i = 0; i < children.getLength(); i++) {
Node child = (Node) children.item(i);
if (updateNamespaceAndPrefix && (child.getNamespaceURI() == null || child.getNamespaceURI().isEmpty())) {
child = updateNamespaceAndPrefix(child, to.getNamespaceURI(), to.getPrefix());
updateNamespaceAndPrefix(child.getChildNodes(), to.getNamespaceURI(), to.getPrefix());
}
child.setParentElement(to);
}
}