本文整理匯總了Java中org.w3c.dom.Node.getNextSibling方法的典型用法代碼示例。如果您正苦於以下問題:Java Node.getNextSibling方法的具體用法?Java Node.getNextSibling怎麽用?Java Node.getNextSibling使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.w3c.dom.Node
的用法示例。
在下文中一共展示了Node.getNextSibling方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getPublicKeyFromStaticResolvers
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* Searches the library wide KeyResolvers for public keys
*
* @return The public key contained in this Node.
* @throws KeyResolverException
*/
PublicKey getPublicKeyFromStaticResolvers() throws KeyResolverException {
Iterator<KeyResolverSpi> it = KeyResolver.iterator();
while (it.hasNext()) {
KeyResolverSpi keyResolver = it.next();
keyResolver.setSecureValidation(secureValidation);
Node currentChild = this.constructionElement.getFirstChild();
String uri = this.getBaseURI();
while (currentChild != null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
for (StorageResolver storage : storageResolvers) {
PublicKey pk =
keyResolver.engineLookupAndResolvePublicKey(
(Element) currentChild, uri, storage
);
if (pk != null) {
return pk;
}
}
}
currentChild = currentChild.getNextSibling();
}
}
return null;
}
示例2: readFrom
import org.w3c.dom.Node; //導入方法依賴的package包/類
private static ITXtTest readFrom(File f) {
try {
ImageInputStream iis = ImageIO.createImageInputStream(f);
ImageReader r = ImageIO.getImageReaders(iis).next();
r.setInput(iis);
IIOImage dst = r.readAll(0, null);
// look for iTXt node
IIOMetadata m = dst.getMetadata();
Node root = m.getAsTree(m.getNativeMetadataFormatName());
Node n = root.getFirstChild();
while (n != null && !"iTXt".equals(n.getNodeName())) {
n = n.getNextSibling();
}
if (n == null) {
throw new RuntimeException("No iTXt node!");
}
ITXtTest t = ITXtTest.getFromNode((IIOMetadataNode)n);
return t;
} catch (Throwable e) {
throw new RuntimeException("Reading test failed.", e);
}
}
示例3: getFirstElementChild
import org.w3c.dom.Node; //導入方法依賴的package包/類
public static Element getFirstElementChild(Element element, String namespace,
String localname) {
ParamUtil.requireNonNull("element", element);
ParamUtil.requireNonBlank("localname", localname);
Node node = element.getFirstChild();
if (node == null) {
return null;
}
do {
if (match(node, namespace, localname)) {
return (Element) node;
}
node = node.getNextSibling();
}
while (node != null);
return null;
}
示例4: hasTextOnlyChildren
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* Check if an EntityReference node has Text Only child nodes
*
* @param node
* @return true - Contains text only children
*/
private boolean hasTextOnlyChildren(Node node) {
Node child = node;
if (child == null) {
return false;
}
child = child.getFirstChild();
while (child != null) {
int type = child.getNodeType();
if (type == Node.ENTITY_REFERENCE_NODE) {
return hasTextOnlyChildren(child);
}
else if (type != Node.TEXT_NODE
&& type != Node.CDATA_SECTION_NODE
&& type != Node.ENTITY_REFERENCE_NODE) {
return false;
}
child = child.getNextSibling();
}
return true;
}
示例5: selectDsNode
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* @param sibling
* @param nodeName
* @param number
* @return nodes with the constraint
*/
public static Element selectDsNode(Node sibling, String nodeName, int number) {
while (sibling != null) {
if (Constants.SignatureSpecNS.equals(sibling.getNamespaceURI())
&& sibling.getLocalName().equals(nodeName)) {
if (number == 0){
return (Element)sibling;
}
number--;
}
sibling = sibling.getNextSibling();
}
return null;
}
示例6: nextElementNode
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* @param n
* The current XML node
* @return The next sibling that is a {@link Node#ELEMENT_NODE}.
*/
public static Node nextElementNode(Node n) {
if (isElementNode(n))
n = n.getNextSibling();
while (n != null && !isElementNode(n))
n = n.getNextSibling();
return n;
}
示例7: getPrivateKeyFromStaticResolvers
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* Searches the library wide KeyResolvers for Private keys
*
* @return the private key contained in this KeyInfo
* @throws KeyResolverException
*/
PrivateKey getPrivateKeyFromStaticResolvers() throws KeyResolverException {
Iterator<KeyResolverSpi> it = KeyResolver.iterator();
while (it.hasNext()) {
KeyResolverSpi keyResolver = it.next();
keyResolver.setSecureValidation(secureValidation);
Node currentChild = this.constructionElement.getFirstChild();
String uri = this.getBaseURI();
while (currentChild != null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
// not using StorageResolvers at the moment
// since they cannot return private keys
PrivateKey pk =
keyResolver.engineLookupAndResolvePrivateKey(
(Element) currentChild, uri, null
);
if (pk != null) {
return pk;
}
}
currentChild = currentChild.getNextSibling();
}
}
return null;
}
示例8: getElementsByTagName
import org.w3c.dom.Node; //導入方法依賴的package包/類
private void getElementsByTagName(String name, List l) {
if (nodeName.equals(name)) {
l.add(this);
}
Node child = getFirstChild();
while (child != null) {
((IIOMetadataNode)child).getElementsByTagName(name, l);
child = child.getNextSibling();
}
}
示例9: decodeChildren
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* Decodec all children of the given node using decodeChild.
*/
protected void decodeChildren(mxCodec dec, Node node, Object obj) {
Node child = node.getFirstChild();
while (child != null) {
if (child.getNodeType() == Node.ELEMENT_NODE && !processInclude(dec, child, obj)) {
decodeChild(dec, child, obj);
}
child = child.getNextSibling();
}
}
示例10: getFullTextChildrenFromElement
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* Method getFullTextChildrenFromElement
*
* @param element
* @return the string of children
*/
public static String getFullTextChildrenFromElement(Element element) {
StringBuilder sb = new StringBuilder();
Node child = element.getFirstChild();
while (child != null) {
if (child.getNodeType() == Node.TEXT_NODE) {
sb.append(((Text)child).getData());
}
child = child.getNextSibling();
}
return sb.toString();
}
示例11: write
import org.w3c.dom.Node; //導入方法依賴的package包/類
protected void write(Element node) throws ShellException {
printWriter.print('<');
printWriter.print(node.getNodeName());
Attr attrs[] = sortAttributes(node.getAttributes());
for (int i = 0; i < attrs.length; i++) {
Attr attr = attrs[i];
printWriter.print(' ');
printWriter.print(attr.getNodeName());
printWriter.print("=\""); //$NON-NLS-1$
normalizeAndPrint(attr.getNodeValue(), true);
printWriter.print('"');
}
if (node.getChildNodes().getLength() == 0) {
printWriter.print(" />"); //$NON-NLS-1$
printWriter.flush();
} else {
printWriter.print('>');
printWriter.flush();
Node child = node.getFirstChild();
while (child != null) {
writeAnyNode(child);
child = child.getNextSibling();
}
printWriter.print("</"); //$NON-NLS-1$
printWriter.print(node.getNodeName());
printWriter.print('>');
printWriter.flush();
}
}
示例12: testMergeStandardTree
import org.w3c.dom.Node; //導入方法依賴的package包/類
public static void testMergeStandardTree() {
// Merge a standard metadata tree and inspect creation time
if (pngMetadata != null) {
try {
IIOMetadataNode root = createStandardMetadataNodeTree();
/*
* Merge the standard metadata tree created. The data should
* correctly reflect in the native tree
*/
pngMetadata.mergeTree("javax_imageio_1.0", root);
Node keyNode = findNode(pngMetadata.getAsTree("javax_imageio_png_1.0"),
"tEXtEntry");
// Last text entry would contain the merged information
while (keyNode != null && keyNode.getNextSibling() != null) {
keyNode = keyNode.getNextSibling();
}
if (keyNode != null) {
// Query the attributes of the node and check for the value
NamedNodeMap attrMap = keyNode.getAttributes();
String attrValue = attrMap.getNamedItem("value")
.getNodeValue();
if (!attrValue.contains("2016")) {
// Throw exception. Incorrect year value observed
throw new RuntimeException("Test Failed: Incorrect"
+ " creation time value observed.");
}
} else {
// Throw exception.
reportExceptionAndFail("Test Failed: Image creation"
+ " time doesn't exist in metadata.");
}
} catch (IOException ex) {
// Throw exception.
reportExceptionAndFail("Test Failed: While executing"
+ " mergeTree on metadata.");
}
}
}
示例13: selectXencNode
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* @param sibling
* @param nodeName
* @param number
* @return nodes with the constrain
*/
public static Element selectXencNode(Node sibling, String nodeName, int number) {
while (sibling != null) {
if (EncryptionConstants.EncryptionSpecNS.equals(sibling.getNamespaceURI())
&& sibling.getLocalName().equals(nodeName)) {
if (number == 0){
return (Element)sibling;
}
number--;
}
sibling = sibling.getNextSibling();
}
return null;
}
示例14: parseCondition
import org.w3c.dom.Node; //導入方法依賴的package包/類
void parseCondition(Node conditionNode, Database db) {
Node exprNode = conditionNode.getFirstChild();
while ((exprNode != null) && (exprNode.getNodeType() != Node.ELEMENT_NODE))
exprNode = exprNode.getNextSibling();
if (exprNode == null)
return;
where = parseExpressionTree(exprNode, db);
ExpressionUtil.assignLiteralConstantTypesRecursively(where);
ExpressionUtil.assignOutputValueTypesRecursively(where);
}
示例15: getSecretKeyFromInternalResolvers
import org.w3c.dom.Node; //導入方法依賴的package包/類
/**
* Searches the per-KeyInfo KeyResolvers for secret keys
*
* @return the secret key contained in this KeyInfo
* @throws KeyResolverException
*/
SecretKey getSecretKeyFromInternalResolvers() throws KeyResolverException {
for (KeyResolverSpi keyResolver : internalKeyResolvers) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "Try " + keyResolver.getClass().getName());
}
keyResolver.setSecureValidation(secureValidation);
Node currentChild = this.constructionElement.getFirstChild();
String uri = this.getBaseURI();
while (currentChild != null) {
if (currentChild.getNodeType() == Node.ELEMENT_NODE) {
for (StorageResolver storage : storageResolvers) {
SecretKey sk =
keyResolver.engineLookupAndResolveSecretKey(
(Element) currentChild, uri, storage
);
if (sk != null) {
return sk;
}
}
}
currentChild = currentChild.getNextSibling();
}
}
return null;
}