本文整理汇总了Java中mf.org.w3c.dom.Node.getLastChild方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getLastChild方法的具体用法?Java Node.getLastChild怎么用?Java Node.getLastChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mf.org.w3c.dom.Node
的用法示例。
在下文中一共展示了Node.getLastChild方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLastElementChild
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
private Element getLastElementChild(Node n) {
final Node top = n;
while (n != null) {
if (n.getNodeType() == Node.ELEMENT_NODE) {
return (Element) n;
}
Node next = n.getLastChild();
while (next == null) {
if (top == n) {
break;
}
next = n.getPreviousSibling();
if (next == null) {
n = n.getParentNode();
if (n == null || top == n) {
return null;
}
}
}
n = next;
}
return null;
}
示例2: getLastChildElement
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/** Finds and returns the last child element node.
* Overload previous method for non-Xerces node impl.
*/
public static Element getLastChildElement(Node parent) {
// search for node
Node child = parent.getLastChild();
while (child != null) {
if (child.getNodeType() == Node.ELEMENT_NODE) {
return (Element)child;
}
child = child.getPreviousSibling();
}
// not found
return null;
}
示例3: getLastVisibleChildElement
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/** Finds and returns the last visible child element node. */
public static Element getLastVisibleChildElement(Node parent) {
// search for node
Node child = parent.getLastChild();
while (child != null) {
if (child.getNodeType() == Node.ELEMENT_NODE &&
!isHidden(child)) {
return (Element)child;
}
child = child.getPreviousSibling();
}
// not found
return null;
}
示例4: getLastChildElementNS
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/** Finds and returns the last child node with the given qualified name. */
public static Element getLastChildElementNS(Node parent,
String uri, String localpart) {
// search for node
Node child = parent.getLastChild();
while (child != null) {
if (child.getNodeType() == Node.ELEMENT_NODE) {
String childURI = child.getNamespaceURI();
if (childURI != null && childURI.equals(uri) &&
child.getLocalName().equals(localpart)) {
return (Element)child;
}
}
child = child.getPreviousSibling();
}
// not found
return null;
}
示例5: previousNode
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/** The method previousNode(Node) returns the previous node
* from the actual DOM tree.
*/
Node previousNode(Node node) {
Node result;
// if we're at the root, return null.
if (node == fRoot) return null;
// get sibling
result = node.getPreviousSibling();
if (result == null) {
//if 1st sibling, return parent
result = node.getParentNode();
return result;
}
// if sibling has children, keep getting last child of child.
if (result.hasChildNodes()
&& !(!fEntityReferenceExpansion
&& result != null
&& result.getNodeType() == Node.ENTITY_REFERENCE_NODE))
{
while (result.hasChildNodes()) {
result = result.getLastChild();
}
}
return result;
}
示例6: getLastChild
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/** Internal function.
* Return the last child Node, from the input node
* after applying filter, whatToshow.
* The current node is not consulted or set.
*/
Node getLastChild(Node node) {
if (node == null) return null;
if ( !fEntityReferenceExpansion
&& node.getNodeType() == Node.ENTITY_REFERENCE_NODE)
return null;
Node newNode = node.getLastChild();
if (newNode == null) return null;
int accept = acceptNode(newNode);
if (accept == NodeFilter.FILTER_ACCEPT)
return newNode;
else
if (accept == NodeFilter.FILTER_SKIP
&& newNode.hasChildNodes())
{
Node lChild = getLastChild(newNode);
if (lChild == null) {
return getPreviousSibling(newNode, node);
}
return lChild;
}
else
//if (accept == NodeFilter.REJECT_NODE)
{
return getPreviousSibling(newNode, node);
}
}
示例7: synchronizeData
import mf.org.w3c.dom.Node; //导入方法依赖的package包/类
/** Synchronizes the node's data. */
protected void synchronizeData() {
// no need to sync in the future
needsSyncData(false);
// fluff up enough nodes to fill identifiers hash
if (fIdElement != null) {
// REVISIT: There has to be a more efficient way of
// doing this. But keep in mind that the
// tree can have been altered and re-ordered
// before all of the element nodes with ID
// attributes have been registered. For now
// this is reasonable and safe. -Ac
IntVector path = new IntVector();
for (int i = 0; i < fIdCount; i++) {
// ignore if it's already been registered
int elementNodeIndex = fIdElement[i];
String idName = fIdName[i];
if (idName == null) {
continue;
}
// find path from this element to the root
path.removeAllElements();
int index = elementNodeIndex;
do {
path.addElement(index);
int pchunk = index >> CHUNK_SHIFT;
int pindex = index & CHUNK_MASK;
index = getChunkIndex(fNodeParent, pchunk, pindex);
} while (index != -1);
// Traverse path (backwards), fluffing the elements
// along the way. When this loop finishes, "place"
// will contain the reference to the element node
// we're interested in. -Ac
Node place = this;
for (int j = path.size() - 2; j >= 0; j--) {
index = path.elementAt(j);
Node child = place.getLastChild();
while (child != null) {
if (child instanceof DeferredNode) {
int nodeIndex =
((DeferredNode)child).getNodeIndex();
if (nodeIndex == index) {
place = child;
break;
}
}
child = child.getPreviousSibling();
}
}
// register the element
Element element = (Element)place;
putIdentifier0(idName, element);
fIdName[i] = null;
// see if there are more IDs on this element
while (i + 1 < fIdCount &&
fIdElement[i + 1] == elementNodeIndex) {
idName = fIdName[++i];
if (idName == null) {
continue;
}
putIdentifier0(idName, element);
}
}
} // if identifiers
}