Class NamespaceContextBuilder


  • public class NamespaceContextBuilder
    extends Object
    Builds a namespace context for XPath expression evaluations. Builder supports default mappings as well as dynamic mappings from received message. Namespace mappings are defined as key value pairs where key is definded as namespace prefix and value is the actual namespace uri.
    Author:
    Christoph Deppisch
    • Field Detail

      • DEFAULT_BEAN_ID

        public static final String DEFAULT_BEAN_ID
        The default bean id in Spring application context
        See Also:
        Constant Field Values
    • Constructor Detail

      • NamespaceContextBuilder

        public NamespaceContextBuilder()
    • Method Detail

      • buildContext

        public NamespaceContext buildContext​(Message receivedMessage,
                                             Map<String,​String> namespaces)
        Construct a basic namespace context from the received message and explicit namespace mappings.
        Parameters:
        receivedMessage - the actual message received.
        namespaces - explicit namespace mappings for this construction.
        Returns:
        the constructed namespace context.
      • setNamespaceMappings

        public void setNamespaceMappings​(Map<String,​String> defaultMappings)
        Sets the default mappings for this namespace context builder.
        Parameters:
        defaultMappings - the defaultMappings to set
      • getNamespaceMappings

        public Map<String,​String> getNamespaceMappings()
        Gets the namespaceMappings.
        Returns:
        the namespaceMappings the namespaceMappings to get.
      • lookupNamespaces

        public static Map<String,​String> lookupNamespaces​(String xml)
        Look up namespace attribute declarations in the XML fragment and store them in a binding map, where the key is the namespace prefix and the value is the namespace uri.
        Parameters:
        xml - XML fragment.
        Returns:
        map containing namespace prefix - namespace uri pairs.