src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/XMLUtils.java
changeset 54731 81de17a33575
parent 53998 d870bb08194a
child 59240 b3116877866f
equal deleted inserted replaced
54730:8bca46822c05 54731:81de17a33575
   252             LOG.debug(ex.getMessage(), ex);
   252             LOG.debug(ex.getMessage(), ex);
   253             // throw new RuntimeException(ex.getMessage());
   253             // throw new RuntimeException(ex.getMessage());
   254         }
   254         }
   255     }
   255     }
   256 
   256 
   257     /**
   257     @Deprecated
   258      * Method getFullTextChildrenFromElement
   258     public static String getFullTextChildrenFromElement(Element element) {
   259      *
   259         return getFullTextChildrenFromNode(element);
   260      * @param element
   260     }
       
   261 
       
   262     /**
       
   263      * Method getFullTextChildrenFromNode
       
   264      *
       
   265      * @param node
   261      * @return the string of children
   266      * @return the string of children
   262      */
   267      */
   263     public static String getFullTextChildrenFromElement(Element element) {
   268     public static String getFullTextChildrenFromNode(Node node) {
   264         StringBuilder sb = new StringBuilder();
   269         StringBuilder sb = new StringBuilder();
   265 
   270 
   266         Node child = element.getFirstChild();
   271         Node child = node.getFirstChild();
   267         while (child != null) {
   272         while (child != null) {
   268             if (child.getNodeType() == Node.TEXT_NODE) {
   273             if (child.getNodeType() == Node.TEXT_NODE) {
   269                 sb.append(((Text)child).getData());
   274                 sb.append(((Text)child).getData());
   270             }
   275             }
   271             child = child.getNextSibling();
   276             child = child.getNextSibling();
   680      */
   685      */
   681     public static Element selectNode(Node sibling, String uri, String nodeName, int number) {
   686     public static Element selectNode(Node sibling, String uri, String nodeName, int number) {
   682         while (sibling != null) {
   687         while (sibling != null) {
   683             if (sibling.getNamespaceURI() != null && sibling.getNamespaceURI().equals(uri)
   688             if (sibling.getNamespaceURI() != null && sibling.getNamespaceURI().equals(uri)
   684                 && sibling.getLocalName().equals(nodeName)) {
   689                 && sibling.getLocalName().equals(nodeName)) {
   685                 if (number == 0){
   690                 if (number == 0) {
   686                     return (Element)sibling;
   691                     return (Element)sibling;
   687                 }
   692                 }
   688                 number--;
   693                 number--;
   689             }
   694             }
   690             sibling = sibling.getNextSibling();
   695             sibling = sibling.getNextSibling();