Home All Groups
jbossws-api / org / jboss / ws / api / util / DOMUtils.html /
org.jboss.ws.api.util

Class DOMUtils

    • Constructor Detail

      • DOMUtils

        public DOMUtils()
    • Method Detail

      • getElementQName

        public static QName getElementQName(Element el)
        Get the qname of the given node.
        Parameters:
        el - node
        Returns:
        Qname
      • resolveQName

        public static QName resolveQName(Element el,
                                         String qualifiedName)
        Transform the given qualified name into a QName
        Parameters:
        el - node
        qualifiedName - qualified name
        Returns:
        QName
      • getAttributeValue

        public static String getAttributeValue(Element el,
                                               String attrName)
        Get the value from the given attribute
        Parameters:
        el - element
        attrName - attribute name
        Returns:
        null if the attribute value is empty or the attribute is not present
      • getAttributeValue

        public static String getAttributeValue(Element el,
                                               QName attrName)
        Get the value from the given attribute
        Parameters:
        el - element
        attrName - attribute name
        Returns:
        null if the attribute value is empty or the attribute is not present
      • getAttributeValueAsQName

        public static QName getAttributeValueAsQName(Element el,
                                                     String attrName)
        Get the qname value from the given attribute
        Parameters:
        el - element
        attrName - attribute name
        Returns:
        QName
      • getAttributeValueAsQName

        public static QName getAttributeValueAsQName(Element el,
                                                     QName attrName)
        Get the qname value from the given attribute
        Parameters:
        el - element
        attrName - attribute name
        Returns:
        QName
      • getAttributeValueAsBoolean

        public static boolean getAttributeValueAsBoolean(Element el,
                                                         String attrName)
        Get the boolean value from the given attribute
        Parameters:
        el - element
        attrName - attribute name
        Returns:
        boolean
      • getAttributeValueAsBoolean

        public static boolean getAttributeValueAsBoolean(Element el,
                                                         QName attrName)
        Get the boolean value from the given attribute
        Parameters:
        el - element
        attrName - attribute name
        Returns:
        boolean
      • getAttributeValueAsInteger

        public static Integer getAttributeValueAsInteger(Element el,
                                                         String attrName)
        Get the integer value from the given attribute
        Parameters:
        el - element
        attrName - attribute name
        Returns:
        Integer
      • getAttributeValueAsInteger

        public static Integer getAttributeValueAsInteger(Element el,
                                                         QName attrName)
        Get the integer value from the given attribute
        Parameters:
        el - element
        attrName - attribute name
        Returns:
        Integer
      • getAttributes

        public static Map<QName,String> getAttributes(Element el)
        Get the attributes as Map<QName, String>
        Parameters:
        el - element
        Returns:
        Map
      • copyAttributes

        public static void copyAttributes(Element destElement,
                                          Element srcElement)
        Copy attributes between elements
        Parameters:
        destElement - element
        srcElement - element
      • hasTextChildNodesOnly

        public static boolean hasTextChildNodesOnly(Node node)
        True if the node has text child elements only
        Parameters:
        node - start node
        Returns:
        True if the node has text child
      • hasChildElements

        public static boolean hasChildElements(Node node)
        True if the node has child elements
        Parameters:
        node - start node
        Returns:
        true when child has elements
      • getChildElements

        public static Iterator<Element> getChildElements(Node node)
        Gets child elements
        Parameters:
        node - start node
        Returns:
        Iterator
      • getTextContent

        public static String getTextContent(Node node)
        Get the concatenated text content, or null.
        Parameters:
        node - node
        Returns:
        string
      • getFirstChildElement

        public static Element getFirstChildElement(Node node)
        Gets the first child element
        Parameters:
        node - start node
        Returns:
        element
      • getFirstChildElement

        public static Element getFirstChildElement(Node node,
                                                   boolean recursive)
        Gets the first child element
        Parameters:
        node - child
        recursive - recurse flag
        Returns:
        element
      • getFirstChildElement

        public static Element getFirstChildElement(Node node,
                                                   String nodeName)
        Gets the first child element for a given local name without namespace
        Parameters:
        node - child
        nodeName - name
        Returns:
        element
      • getFirstChildElement

        public static Element getFirstChildElement(Node node,
                                                   String nodeName,
                                                   boolean recursive)
        Gets the first child element for a given local name without namespace
        Parameters:
        node - child
        nodeName - name
        recursive - recurse flag
        Returns:
        element
      • getFirstChildElement

        public static Element getFirstChildElement(Node node,
                                                   QName nodeName)
        Gets the first child element for a given qname
        Parameters:
        node - child
        nodeName - name
        Returns:
        element
      • getFirstChildElement

        public static Element getFirstChildElement(Node node,
                                                   QName nodeName,
                                                   boolean recursive)
        Gets the first child element for a given qname
        Parameters:
        node - child
        nodeName - name
        recursive - recurse flag
        Returns:
        element
      • getChildElements

        public static Iterator<Element> getChildElements(Node node,
                                                         String nodeName)
        Gets the child elements for a given local name without namespace
        Parameters:
        node - child
        nodeName - name
        Returns:
        Iterator
      • getChildElements

        public static Iterator<Element> getChildElements(Node node,
                                                         String nodeName,
                                                         boolean recursive)
        Gets the child elements for a given local name without namespace
        Parameters:
        node - child
        nodeName - name
        recursive - recurse flag
        Returns:
        Iterator
      • getChildElements

        public static Iterator<Element> getChildElements(Node node,
                                                         QName nodeName)
        Gets the child element for a given qname
        Parameters:
        node - child
        nodeName - name
        Returns:
        Iterator
      • getChildElements

        public static Iterator<Element> getChildElements(Node node,
                                                         QName nodeName,
                                                         boolean recursive)
        Gets the child element for a given qname
        Parameters:
        node - child
        nodeName - name
        recursive - recurse flag
        Returns:
        Iterator
      • getChildElementsAsList

        public static List<Element> getChildElementsAsList(Node node,
                                                           String nodeName,
                                                           boolean recursive)
      • getChildElementsAsList

        public static List<Element> getChildElementsAsList(Node node,
                                                           QName nodeName)
      • getChildElementsAsList

        public static List<Element> getChildElementsAsList(Node node,
                                                           QName nodeName,
                                                           boolean recursive)
      • getParentElement

        public static Element getParentElement(Node node)
        Gets parent element or null if there is none
        Parameters:
        node - child
        Returns:
        element
      • parse

        public static Element parse(String xmlString,
                                    DocumentBuilder builder)
                             throws IOException
        Parse the given XML string and return the root Element
        Parameters:
        xmlString - string to be parsed
        builder - document builder
        Returns:
        element
        Throws:
        IOException - exception
      • createElement

        public static Element createElement(String localPart,
                                            String prefix,
                                            String uri,
                                            Document doc)
        Create an Element for a given name, prefix and uri
        Parameters:
        localPart - xml local part
        prefix - xml prefix
        uri - uri
        doc - document
        Returns:
        element

Copyright © 2018 JBoss, by Red Hat. All rights reserved.