本文整理了Java中org.w3c.dom.Node.getLastChild()
方法的一些代码示例,展示了Node.getLastChild()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getLastChild()
方法的具体详情如下:
包路径:org.w3c.dom.Node
类名称:Node
方法名:getLastChild
[英]The last child of this node. If there is no such node, this returns null
.
[中]此节点的最后一个子节点。如果没有这样的节点,则返回null
。
代码示例来源:origin: pmd/pmd
@Override
public org.w3c.dom.Node getLastChild() {
return node.getLastChild();
}
代码示例来源:origin: xalan/xalan
/**
* @see org.w3c.dom.Node#getLastChild()
*/
public Node getLastChild() {
return m_attributeNode.getLastChild();
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public void characters(char[] ch, int start, int length) {
String data = new String(ch, start, length);
Node parent = getParent();
Node lastChild = parent.getLastChild();
if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
((Text) lastChild).appendData(data);
}
else {
Text text = this.document.createTextNode(data);
parent.appendChild(text);
}
}
代码示例来源:origin: org.springframework/spring-core
@Override
public void characters(char[] ch, int start, int length) {
String data = new String(ch, start, length);
Node parent = getParent();
Node lastChild = parent.getLastChild();
if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
((Text) lastChild).appendData(data);
}
else {
Text text = this.document.createTextNode(data);
parent.appendChild(text);
}
}
代码示例来源:origin: com.sun.xml.bind/jaxb-impl
protected Text characters(String s) {
Node parent = nodeStack.peek();
Node lastChild = parent.getLastChild();
Text text;
if (isConsolidate && lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
text = (Text) lastChild;
text.appendData(s);
} else {
text = document.createTextNode(s);
parent.appendChild(text);
}
return text;
}
代码示例来源: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: robovm/robovm
/**
* @param token the XML pull parser token type, such as XmlPullParser.CDSECT
* or XmlPullParser.ENTITY_REF.
*/
private void appendText(DocumentImpl document, Node parent, int token, String text) {
// Ignore empty runs.
if (text.isEmpty()) {
return;
}
// Merge with any previous text node if possible.
if (coalescing || token != XmlPullParser.CDSECT) {
Node lastChild = parent.getLastChild();
if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
Text textNode = (Text) lastChild;
textNode.appendData(text);
return;
}
}
// Okay, we really do need a new text node
parent.appendChild(token == XmlPullParser.CDSECT
? new CDATASectionImpl(document, text)
: new TextImpl(document, text));
}
代码示例来源:origin: robovm/robovm
CDATASection section =(CDATASection) m_currentNode.getLastChild();
section.appendData(s);
代码示例来源:origin: xalan/xalan
CDATASection section =(CDATASection) m_currentNode.getLastChild();
section.appendData(s);
代码示例来源:origin: robovm/robovm
childNode = m_currentNode != null ? m_currentNode.getLastChild(): null;
if( childNode != null && childNode.getNodeType() == Node.TEXT_NODE ){
((Text)childNode).appendData(s);
代码示例来源:origin: xalan/xalan
childNode = m_currentNode != null ? m_currentNode.getLastChild(): null;
if( childNode != null && childNode.getNodeType() == Node.TEXT_NODE ){
((Text)childNode).appendData(s);
代码示例来源:origin: org.glassfish.jaxb/jaxb-runtime
protected Text characters(String s) {
Node parent = nodeStack.peek();
Node lastChild = parent.getLastChild();
Text text;
if (isConsolidate && lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
text = (Text) lastChild;
text.appendData(s);
} else {
text = document.createTextNode(s);
parent.appendChild(text);
}
return text;
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void characters(char ch[], int start, int length) throws SAXException {
String data = new String(ch, start, length);
Node parent = getParent();
Node lastChild = parent.getLastChild();
if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
((Text) lastChild).appendData(data);
}
else {
Text text = document.createTextNode(data);
parent.appendChild(text);
}
}
代码示例来源: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: haraldk/TwelveMonkeys
jfifThumb.appendChild(thumbTree.getLastChild());
app0JFXX.appendChild(jfifThumb);
break;
代码示例来源:origin: org.apache.xalan/com.springsource.org.apache.xalan
/**
* @see org.w3c.dom.Node#getLastChild()
*/
public Node getLastChild() {
return m_attributeNode.getLastChild();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan
/**
* @see org.w3c.dom.Node#getLastChild()
*/
public Node getLastChild() {
return m_attributeNode.getLastChild();
}
代码示例来源:origin: danfickle/openhtmltopdf
public boolean isLastChildElement(Object element) {
org.w3c.dom.Node parent = ((org.w3c.dom.Element) element).getParentNode();
Node currentChild = parent.getLastChild();
while (currentChild != null && currentChild.getNodeType() != Node.ELEMENT_NODE) {
currentChild = currentChild.getPreviousSibling();
}
return currentChild == element;
}
代码示例来源:origin: net.sourceforge.htmlunit/htmlunit
/**
* {@inheritDoc}
*/
@Override
public void selectNodeContents(final Node node) throws RangeException, DOMException {
startContainer_ = node.getFirstChild();
startOffset_ = 0;
endContainer_ = node.getLastChild();
endOffset_ = getMaxOffset(node.getLastChild());
}
代码示例来源:origin: org.springframework.ws/org.springframework.xml
public void characters(char ch[], int start, int length) throws SAXException {
String data = new String(ch, start, length);
Node parent = getParent();
Node lastChild = parent.getLastChild();
if (lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) {
((Text) lastChild).appendData(data);
}
else {
Text text = document.createTextNode(data);
parent.appendChild(text);
}
}
内容来源于网络,如有侵权,请联系作者删除!