Class XmlUtils


  • public final class XmlUtils
    extends Object
    Utilities for XML-to-JAXB binding
    • Field Detail

      • XML_TEMPORAL_DATATYPE_FACTORY

        public static final DatatypeFactory XML_TEMPORAL_DATATYPE_FACTORY
        XML datatype factory for parsing XML-Schema-compliant date/time/duration values into Java types. DatatypeFactory's official javadoc does not say whether it is thread-safe. But bug report indicates it should be and has been so far: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6466177 Reusing the same instance matters for performance: https://www.java.net/node/666491 The alternative would be to use ThreadLocal to limit thread-safety issues in the future.
      • SAXON_CONFIGURATION_CLASSPATH_LOCATION

        public static final String SAXON_CONFIGURATION_CLASSPATH_LOCATION
        Saxon configuration file for Attributes/Content XML parsing (into XDM data model) and AttributeSelector's XPath evaluation
        See Also:
        Constant Field Values
      • SAXON_PROCESSOR

        public static final net.sf.saxon.s9api.Processor SAXON_PROCESSOR
        SAXON XML/XPath Processor configured by "saxon.xml"
    • Method Detail

      • newXPathCompiler

        public static net.sf.saxon.s9api.XPathCompiler newXPathCompiler​(String xpathVersionURI,
                                                                        Map<String,​String> namespaceURIsByPrefix)
                                                                 throws IllegalArgumentException
        Create XPath compiler for given XPath version and namespace context. For single evaluation of a given XPath with XPathCompiler.evaluateSingle(String, XdmItem). For repeated evaluation of the same XPath, use XmlUtils.XPathEvaluator instead. What we have in XACML Policy/PolicySetDefaults is the version URI so we need this map to map the URI to the XPath compiler
        Parameters:
        xpathVersionURI - XPath version URI, e.g. "http://www.w3.org/TR/1999/REC-xpath-19991116"
        namespaceURIsByPrefix - namespace prefix-URI mapping to be part of the static context for XPath expressions compiled using the created XPathCompiler
        Returns:
        XPath compiler instance
        Throws:
        IllegalArgumentException - if xpathVersionURI is invalid or unsupported XPath version or one of the namespace prefixes/URIs in namespaceURIsByPrefix is null