本文整理汇总了Java中org.w3c.dom.Element.getNextSibling方法的典型用法代码示例。如果您正苦于以下问题:Java Element.getNextSibling方法的具体用法?Java Element.getNextSibling怎么用?Java Element.getNextSibling使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.Element
的用法示例。
在下文中一共展示了Element.getNextSibling方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandXMLMap
import org.w3c.dom.Element; //导入方法依赖的package包/类
private void expandXMLMap(Element elt) {
if (elt != null) {
NodeList children = elt.getChildNodes();
Node next = elt.getNextSibling();
int len = children.getLength();
if (len > 0) {
Node child = children.item(0);
while (child != null) {
if (child.getNodeType() == Node.ELEMENT_NODE)
expandXMLMap((Element)child);
child = child.getNextSibling();
}
}
String sOccurs = elt.getAttribute("occurs");
if ((sOccurs != null) && (!sOccurs.equalsIgnoreCase(""))) {
String aOccurs[] = sOccurs.split(":");
int count = 1;
int j = Integer.parseInt(aOccurs[0],10);
if (aOccurs.length>1)
j = Integer.parseInt(aOccurs[1],10);
while (count++ < j) {
elt.setAttribute("occurs","");
Element clone = (Element)elt.cloneNode(true);
clone.setAttribute("occurence",""+count);
expandXMLElement(elt,clone,count);
if (next != null)
elt.getParentNode().insertBefore(clone,next);
else
elt.getParentNode().appendChild(clone);
}
//elt.setAttribute("occurs",sOccurs);
}
}
}
示例2: getNextSiblingElement
import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
* Return the next sibling element of the given element. Null if no
* more sibling elements are found.
*
* @param elem Element whose sibling element is to be returned
* @return the next sibling element.
*/
public static Element getNextSiblingElement (Element elem) {
for (Node n = elem.getNextSibling (); n != null; n = n.getNextSibling ()) {
if (n.getNodeType () == Node.ELEMENT_NODE) {
return (Element) n;
}
}
return null;
}
示例3: hasSiblingAfter
import org.w3c.dom.Element; //导入方法依赖的package包/类
public static boolean hasSiblingAfter(Element element) {
Node sibling = element.getNextSibling();
while (sibling != null) {
if (sibling.getNodeType() == Node.ELEMENT_NODE) {
return true;
}
sibling = sibling.getNextSibling();
}
return false;
}
示例4: hasSameTypeAfter
import org.w3c.dom.Element; //导入方法依赖的package包/类
public static boolean hasSameTypeAfter(Element element) {
Node sibling = element.getNextSibling();
while (sibling != null) {
if (sibling.getNodeType() == Node.ELEMENT_NODE) {
if (isSameType(element, (Element)sibling)) {
return true;
}
}
sibling = sibling.getNextSibling();
}
return false;
}
示例5: countSiblingsAfter
import org.w3c.dom.Element; //导入方法依赖的package包/类
public static int countSiblingsAfter(Element element) {
int count = 0;
Node sibling = element.getNextSibling();
while (sibling != null) {
if (sibling.getNodeType() == Node.ELEMENT_NODE) {
++count;
}
sibling = sibling.getNextSibling();
}
return count;
}
示例6: countSameTypeAfter
import org.w3c.dom.Element; //导入方法依赖的package包/类
public static int countSameTypeAfter(Element element) {
int count = 0;
Node sibling = element.getNextSibling();
while (sibling != null) {
if (sibling.getNodeType() == Node.ELEMENT_NODE) {
if (isSameType(element, (Element)sibling)) {
++count;
}
}
sibling = sibling.getNextSibling();
}
return count;
}