Klasse XmlUtil

java.lang.Object
org.freedesktop.dbus.utils.XmlUtil

public final class XmlUtil extends Object
Assorted static XML utility methods.
Autor:
hypfvieh
  • Methodendetails

    • isElementType

      public static boolean isElementType(Node _node)
      Shortcut for checking if given node is of type Element.
      Parameter:
      _node - node
      Gibt zurück:
      true if Element, false otherwise
    • toElement

      public static Element toElement(Node _node)
      Checks and converts given Node to Element if possible.
      Parameter:
      _node - node
      Gibt zurück:
      Element or null if given Node is not Element subtype
    • applyXpathExpressionToDocument

      public static NodeList applyXpathExpressionToDocument(String _xpathExpression, Node _xmlDocumentOrNode) throws IOException
      Applys a xpathExpression to a xml-Document and return a NodeList with the results.
      Parameter:
      _xpathExpression - xpath expression
      _xmlDocumentOrNode - document or node
      Gibt zurück:
      NodeList
      Löst aus:
      IOException - on error
    • parseXmlString

      public static Document parseXmlString(String _xmlStr, boolean _validating, boolean _namespaceAware) throws IOException
      Read the given string as XML document.
      Parameter:
      _xmlStr - xml string
      _validating - boolean
      _namespaceAware - boolean
      Gibt zurück:
      Document
      Löst aus:
      IOException - on error
    • convertToElementList

      public static List<Element> convertToElementList(NodeList _nodeList)
      Convert a NodeList to a Java List of Elements.
      Parameter:
      _nodeList - collection of nodes
      Gibt zurück:
      list of elements
    • convertToAttributeMap

      public static Map<String,String> convertToAttributeMap(NamedNodeMap _nodeMap)
      Converts NamedNodeMap to a LinkedHashMap<String,String>.
      Parameter:
      _nodeMap - node map
      Gibt zurück:
      LinkedHashMap, maybe empty but never null