Package org.joox

Class Util

java.lang.Object
org.joox.Util

class Util extends Object
DOM utilities
  • Field Details

    • xalanExtensionLoaded

      private static volatile boolean xalanExtensionLoaded
      A flag indicating whether xalan extensions have been loaded
    • xalanNamespaceContext

      private static NamespaceContext xalanNamespaceContext
      The xalan extensions NamespaceContext if available
    • xalanFunctionResolver

      private static XPathFunctionResolver xalanFunctionResolver
      The xalan extensions XPathFunctionResolver if available
    • PATTERN_DD_MM_YYYY

      private static final Pattern PATTERN_DD_MM_YYYY
      A pattern for the dd.mm.yyyy format
    • PATTERN_YYYY_MM_DD

      private static final Pattern PATTERN_YYYY_MM_DD
      A pattern for various yyyy-mm-dd formats
  • Constructor Details

    • Util

      Util()
  • Method Details

    • createContent

      static final DocumentFragment createContent(Document doc, String text)
      Create some content in the context of a given document
      Returns:
      • A DocumentFragment if text is well-formed.
      • null, if text is plain text or not well formed
    • attr

      static final String attr(Element element, String name)
      Get an attribute value if it exists, or null
    • attr

      static final String attr(Element element, String name, boolean ignoreNamespace)
      Get an attribute value if it exists, or null
    • importOrDetach

      static final List<Element> importOrDetach(Document document, Element... elements)
      Make a list of elements available in a document.
      • Any element that is already in the document will be detached from its parent
      • Any element that is not already in the document will be deep-imported
      Parameters:
      document - The document to import elements into
      elements - The elements that are made available to a document.
      Returns:
      Elements that are all in the supplied document, but detached.
    • elements

      static final Element[] elements(Match... content)
      Transform an Match[] into an Element[], removing duplicates.
    • toString

      static final String toString(Element element)
      Transform an Element into a String.
    • textNodesOnly

      static final boolean textNodesOnly(NodeList list)
      Check whether there are any element nodes in a NodeList
    • xpath

      static final String xpath(Element element)
      Return an XPath expression describing an element
    • path

      static final String path(Element element)
      Return an path expression describing an element
    • siblingIndex

      private static final int siblingIndex(Element element)
      Find the index among siblings of the same tag name
    • context

      static final Context context(Element match, int matchIndex, int matchSize)
      Create a context object
    • context

      static final Context context(Element match, int matchIndex, int matchSize, Element element, int elementIndex, int elementSize)
      Create a context object
    • nonNull

      static final String nonNull(String string)
      Return string or "" if string is null
    • split

      static final List<String> split(String value)
      Split a string into values
    • xalanExtensionAware

      static final void xalanExtensionAware(XPath xpath)
      Make a given XPath object "xalan-extension aware", if Xalan is on the classpath.
    • parseDate

      static final Date parseDate(String formatted)
      Parse any date format
    • getDate

      private static final Date getDate(int year, int month, int day, int hour, int minute, int second, int millisecond)
    • defaultIfEmpty

      static final String defaultIfEmpty(String string, String defaultString)
    • getNamespace

      static final String getNamespace(String tagName)
    • stripNamespace

      static final String stripNamespace(String tagName)