本文整理了Java中org.w3c.dom.Element.getNextSibling()
方法的一些代码示例,展示了Element.getNextSibling()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getNextSibling()
方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:getNextSibling
暂无
代码示例来源:origin: jMonkeyEngine/jmonkeyengine
private Element findNextSiblingElement(Element current) {
Node ret = current.getNextSibling();
while (ret != null) {
if (ret instanceof Element) {
return (Element) ret;
}
ret = ret.getNextSibling();
}
return null;
}
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
public XmlNode updateXML(Object jaxbObject, XmlNode xmlNode) throws JAXBException {
if(jaxbObject==null || xmlNode==null) throw new IllegalArgumentException();
// TODO
// for now just marshal
// TODO: object model independenc
Element e = (Element)xmlNode;
Node ns = e.getNextSibling();
Node p = e.getParentNode();
p.removeChild(e);
// if the type object is passed, the following step is necessary to make
// the marshalling successful.
JaxBeanInfo bi = context.getBeanInfo(jaxbObject, true);
if(!bi.isElement())
jaxbObject = new JAXBElement(new QName(e.getNamespaceURI(),e.getLocalName()),bi.jaxbType,jaxbObject);
getMarshaller().marshal(jaxbObject,p);
Node newNode = p.getLastChild();
p.removeChild(newNode);
p.insertBefore(newNode,ns);
return (XmlNode)newNode;
}
代码示例来源:origin: jamesagnew/hapi-fhir
public static Element getNextSibling(Element e) {
Node n = e.getNextSibling();
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
n = n.getNextSibling();
return (Element) n;
}
代码示例来源:origin: jamesagnew/hapi-fhir
public static Element getNextSibling(Element e) {
Node n = e.getNextSibling();
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
n = n.getNextSibling();
return (Element) n;
}
代码示例来源:origin: wsdl4j/wsdl4j
/**
* 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;
}
代码示例来源:origin: spring-projects/spring-roo
private static void insertAfter(final Element element, final String afterElementName,
final Document document) {
final Element afterElement =
XmlUtils.findFirstElement(WEB_APP_XPATH + afterElementName, document.getDocumentElement());
if (afterElement != null && afterElement.getNextSibling() != null
&& afterElement.getNextSibling() instanceof Element) {
document.getDocumentElement().insertBefore(element, afterElement.getNextSibling());
addLineBreakBefore(element, document);
addLineBreakBefore(element, document);
return;
}
document.getDocumentElement().appendChild(element);
addLineBreakBefore(element, document);
addLineBreakBefore(element, document);
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void insertChildElementAfter(DomElement elementToInsert, DomElement insertAfter) {
synchronized(document) {
Element newElement = ((DomElementImpl) elementToInsert).getElement();
// find node to insert before
Node insertBeforeNode;
if (insertAfter == null) {
insertBeforeNode = element.getFirstChild();
}
else {
insertBeforeNode = ((DomElementImpl) insertAfter).getElement().getNextSibling();
}
// insert before node or append if no node was found
if (insertBeforeNode != null) {
element.insertBefore(newElement, insertBeforeNode);
}
else {
element.appendChild(newElement);
}
}
}
代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime
public XmlNode updateXML(Object jaxbObject, XmlNode xmlNode) throws JAXBException {
if(jaxbObject==null || xmlNode==null) throw new IllegalArgumentException();
// TODO
// for now just marshal
// TODO: object model independenc
Element e = (Element)xmlNode;
Node ns = e.getNextSibling();
Node p = e.getParentNode();
p.removeChild(e);
// if the type object is passed, the following step is necessary to make
// the marshalling successful.
JaxBeanInfo bi = context.getBeanInfo(jaxbObject, true);
if(!bi.isElement())
jaxbObject = new JAXBElement(new QName(e.getNamespaceURI(),e.getLocalName()),bi.jaxbType,jaxbObject);
getMarshaller().marshal(jaxbObject,p);
Node newNode = p.getLastChild();
p.removeChild(newNode);
p.insertBefore(newNode,ns);
return (XmlNode)newNode;
}
代码示例来源:origin: spring-projects/spring-roo
private static void insertBetween(final Element element, final String afterElementName,
final String beforeElementName, final Document document) {
final Element beforeElement =
XmlUtils.findFirstElement(WEB_APP_XPATH + beforeElementName, document.getDocumentElement());
if (beforeElement != null) {
document.getDocumentElement().insertBefore(element, beforeElement);
addLineBreakBefore(element, document);
addLineBreakBefore(element, document);
return;
}
final Element afterElement =
XmlUtils.findFirstElement(WEB_APP_XPATH + afterElementName, document.getDocumentElement());
if (afterElement != null && afterElement.getNextSibling() != null
&& afterElement.getNextSibling() instanceof Element) {
document.getDocumentElement().insertBefore(element, afterElement.getNextSibling());
addLineBreakBefore(element, document);
addLineBreakBefore(element, document);
return;
}
document.getDocumentElement().appendChild(element);
addLineBreakBefore(element, document);
addLineBreakBefore(element, document);
}
代码示例来源:origin: org.apache.commons/commons-configuration2
getElement(sibling1, refHandler).getNextSibling());
代码示例来源:origin: geotools/geotools
ids.add(FILTER_FACT.featureId(fidElement.getAttribute("fid")));
Node sibling = fidElement.getNextSibling();
代码示例来源:origin: apache/cxf
public static Element getNextElement(Element el) {
Node nd = el.getNextSibling();
while (nd != null) {
if (nd.getNodeType() == Node.ELEMENT_NODE) {
return (Element)nd;
}
nd = nd.getNextSibling();
}
return null;
}
代码示例来源:origin: org.apache.cxf/cxf-api
public static Element getNextElement(Element el) {
Node nd = el.getNextSibling();
while (nd != null) {
if (nd.getNodeType() == Node.ELEMENT_NODE) {
return (Element)nd;
}
nd = nd.getNextSibling();
}
return null;
}
代码示例来源:origin: org.apache.cxf/cxf-core
public static Element getNextElement(Element el) {
Node nd = el.getNextSibling();
while (nd != null) {
if (nd.getNodeType() == Node.ELEMENT_NODE) {
return (Element)nd;
}
nd = nd.getNextSibling();
}
return null;
}
代码示例来源:origin: org.apache.cxf/cxf-common-utilities
public static Element getNextElement(Element el) {
Node nd = el.getNextSibling();
while (nd != null) {
if (nd.getNodeType() == Node.ELEMENT_NODE) {
return (Element)nd;
}
nd = nd.getNextSibling();
}
return null;
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Node#getNextSibling()
*/
public Node getNextSibling() {
return getAtualInterno().getNextSibling();
}
代码示例来源:origin: org.apache.cxf/cxf-rt-ws-security
protected void insertAfter(Element child, Element sib) {
child = (Element)DOMUtils.getDomElement(child);
if (sib.getNextSibling() == null) {
secHeader.getSecurityHeaderElement().appendChild(child);
} else {
secHeader.getSecurityHeaderElement().insertBefore(child, sib.getNextSibling());
}
}
代码示例来源:origin: apache/cxf
protected void insertAfter(Element child, Element sib) {
child = (Element)DOMUtils.getDomElement(child);
if (sib.getNextSibling() == null) {
secHeader.getSecurityHeaderElement().appendChild(child);
} else {
secHeader.getSecurityHeaderElement().insertBefore(child, sib.getNextSibling());
}
}
代码示例来源:origin: org.apache.woden/woden-impl-dom
protected XMLElement doGetNextSiblingElement() {
XMLElement xmlElement = new DOMXMLElement(fErrorReporter);
Element el = (Element)fSource;
for (Node node = el.getNextSibling (); node != null; node = node.getNextSibling ()) {
if (node.getNodeType() == Node.ELEMENT_NODE){
xmlElement.setSource(node);
return xmlElement;
}
}
return null; //no sibling element found
}
代码示例来源:origin: apache/cxf
@Override
public void modifySecurityHeader(Element securityHeader) {
if (securityHeader != null) {
Element signatureElement =
XMLUtils.findElement(securityHeader, "Signature", WSS4JConstants.SIG_NS);
Node firstChild = signatureElement.getFirstChild();
while (!(firstChild instanceof Element) && firstChild != null) {
firstChild = signatureElement.getNextSibling();
}
((Element)firstChild).setAttributeNS(null, "Id", "xyz");
}
}
内容来源于网络,如有侵权,请联系作者删除!