當前位置: 首頁>>代碼示例>>Java>>正文


Java Node.getNextSibling方法代碼示例

本文整理匯總了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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:32,代碼來源:KeyInfo.java

示例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);
    }
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:25,代碼來源:ITXtTest.java

示例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;
}
 
開發者ID:xipki,項目名稱:xitk,代碼行數:19,代碼來源:XmlUtil.java

示例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;
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:31,代碼來源:TextImpl.java

示例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;
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:20,代碼來源:XMLUtils.java

示例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;
}
 
開發者ID:KeepTheBeats,項目名稱:alevin-svn2,代碼行數:15,代碼來源:XMLUtils.java

示例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;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:33,代碼來源:KeyInfo.java

示例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();
    }
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:12,代碼來源:IIOMetadataNode.java

示例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();
  }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:15,代碼來源:mxObjectCodec.java

示例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();
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:20,代碼來源:XMLUtils.java

示例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();
    }
}
 
開發者ID:ajtdnyy,項目名稱:PackagePlugin,代碼行數:33,代碼來源:DomWriter.java

示例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.");
        }
    }
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:41,代碼來源:PngCreationTimeTest.java

示例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;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:XMLUtils.java

示例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);
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:11,代碼來源:ParsedUpdateStmt.java

示例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;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:35,代碼來源:KeyInfo.java


注:本文中的org.w3c.dom.Node.getNextSibling方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。