本文整理了Java中org.w3c.dom.Element.getPreviousSibling()
方法的一些代码示例,展示了Element.getPreviousSibling()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getPreviousSibling()
方法的具体详情如下:
包路径:org.w3c.dom.Element
类名称:Element
方法名:getPreviousSibling
暂无
代码示例来源:origin: jamesagnew/hapi-fhir
public static Element getPrevSibling(Element e) {
Node n = e.getPreviousSibling();
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
n = n.getPreviousSibling();
return (Element) n;
}
代码示例来源:origin: stackoverflow.com
Element curElement = (Element)items.item(i);
// Start new code
Node prev = curElement.getPreviousSibling();
if (prev != null &&
prev.getNodeType() == Node.TEXT_NODE &&
prev.getNodeValue().trim().length() == 0) {
items_parent.removeChild(prev);
}
// End new code
items_parent.removeChild(curElement);
代码示例来源:origin: jamesagnew/hapi-fhir
public static Element getPrevSibling(Element e) {
Node n = e.getPreviousSibling();
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
n = n.getPreviousSibling();
return (Element) n;
}
代码示例来源:origin: jamesagnew/hapi-fhir
private void reapComments(org.w3c.dom.Element element, Element context) {
Node node = element.getPreviousSibling();
while (node != null && node.getNodeType() != Node.ELEMENT_NODE) {
if (node.getNodeType() == Node.COMMENT_NODE)
context.getComments().add(0, node.getTextContent());
node = node.getPreviousSibling();
}
node = element.getLastChild();
while (node != null && node.getNodeType() != Node.ELEMENT_NODE) {
node = node.getPreviousSibling();
}
while (node != null) {
if (node.getNodeType() == Node.COMMENT_NODE)
context.getComments().add(node.getTextContent());
node = node.getNextSibling();
}
}
代码示例来源:origin: jamesagnew/hapi-fhir
private void reapComments(org.w3c.dom.Element element, Element context) {
Node node = element.getPreviousSibling();
while (node != null && node.getNodeType() != Node.ELEMENT_NODE) {
if (node.getNodeType() == Node.COMMENT_NODE)
context.getComments().add(0, node.getTextContent());
node = node.getPreviousSibling();
}
node = element.getLastChild();
while (node != null && node.getNodeType() != Node.ELEMENT_NODE) {
node = node.getPreviousSibling();
}
while (node != null) {
if (node.getNodeType() == Node.COMMENT_NODE)
context.getComments().add(node.getTextContent());
node = node.getNextSibling();
}
}
代码示例来源:origin: spring-projects/spring-roo
documentElement.insertBefore(onStartElement, firstViewState.getPreviousSibling()
.getPreviousSibling());
代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-utilities
public static Element getPrevSibling(Element e) {
Node n = e.getPreviousSibling();
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
n = n.getPreviousSibling();
return (Element) n;
}
代码示例来源:origin: org.picketlink/picketlink-trust-jbossws
public static Element getPreviousSiblingElement(Element element)
{
Node sibling = element.getPreviousSibling();
while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE)
sibling = sibling.getPreviousSibling();
return (Element)sibling;
}
代码示例来源:origin: ca.uhn.hapi.fhir/hapi-fhir-structures-hl7org-dstu2
public static Element getPrevSibling(Element e) {
Node n = e.getPreviousSibling();
while (n != null && n.getNodeType() != Node.ELEMENT_NODE)
n = n.getPreviousSibling();
return (Element) n;
}
代码示例来源:origin: danfickle/openhtmltopdf
public Object getPreviousSiblingElement(Object element) {
Node sibling = ((Element) element).getPreviousSibling();
while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE) {
sibling = sibling.getPreviousSibling();
}
if (sibling == null || sibling.getNodeType() != Node.ELEMENT_NODE) {
return null;
}
return sibling;
}
代码示例来源:origin: org.xhtmlrenderer/core-renderer
public Object getPreviousSiblingElement(Object element) {
Node sibling = ((Element) element).getPreviousSibling();
while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE) {
sibling = sibling.getPreviousSibling();
}
if (sibling == null || sibling.getNodeType() != Node.ELEMENT_NODE) {
return null;
}
return sibling;
}
代码示例来源:origin: org.docx4j/xhtmlrenderer
public Object getPreviousSiblingElement(Object element) {
Node sibling = ((Element) element).getPreviousSibling();
while (sibling != null && sibling.getNodeType() != Node.ELEMENT_NODE) {
sibling = sibling.getPreviousSibling();
}
if (sibling == null || sibling.getNodeType() != Node.ELEMENT_NODE) {
return null;
}
return sibling;
}
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Node#getPreviousSibling()
*/
@Override
public Node getPreviousSibling() {
return original.get().getPreviousSibling();
}
代码示例来源:origin: org.opensingular/singular-commons
/**
* @see org.w3c.dom.Node#getPreviousSibling()
*/
public Node getPreviousSibling() {
return getCurrentInternal().getPreviousSibling();
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Node#getPreviousSibling()
*/
public Node getPreviousSibling() {
return getAtualInterno().getPreviousSibling();
}
代码示例来源:origin: org.opensingular/form-core
/**
* @see org.w3c.dom.Node#getPreviousSibling()
*/
@Override
public Node getPreviousSibling() {
return original.get().getPreviousSibling();
}
代码示例来源:origin: Geomatys/geotoolkit
@Override
public Node getPreviousSibling() {
final Element elem = getElement();
return elem != null ? elem.getPreviousSibling() : null;
}
代码示例来源:origin: io.fabric8/common-util
/**
* Removes any previous siblings text nodes
*/
public static void removePreviousSiblingText(Element element) {
while (true) {
Node sibling = element.getPreviousSibling();
if (sibling instanceof Text) {
detach(sibling);
} else {
break;
}
}
}
代码示例来源:origin: org.apache.rampart/rampart-core
public static Element insertSiblingBeforeOrPrepend(RampartMessageData rmd, Element child, Element elem) {
Element retElem = null;
if (child != null && child.getPreviousSibling() != null) {
retElem = RampartUtil.insertSiblingBefore(rmd, child, elem);
} else { //Prepend
retElem = prependSecHeader(rmd, elem);
}
return retElem;
}
代码示例来源:origin: org.sonarsource.xml/sonar-xml-plugin
private boolean checkIndentation(Element element) {
if (!needToCheckIndentation(element)) {
return false;
}
int expectedIndent = depth(element) * indentSize;
if (expectedIndent != startIndent(element.getPreviousSibling())) {
reportIssue(XmlFile.startLocation(element), expectedIndent);
// if reporting on start node, don't report on rest of the block
return true;
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!