com.revolsys.io.xml

Class XmlProcessor

    • Constructor Detail

      • XmlProcessor

        protected XmlProcessor(String namespaceUri)
        Construct a new XmlProcessor for the XML Namespace URI.
        Parameters:
        namespaceUri - The XML Namespace URI.
    • Method Detail

      • registerEnumConverter

        public static void registerEnumConverter(Class<? extends Enum> enumClass)
      • getContext

        public final XmlProcessorContext getContext()
        Get the context for processing the XML Document.
        Returns:
        The context for processing the XML Document.
      • getNamespaceUri

        public String getNamespaceUri()
      • process

        public <T> T process(org.springframework.core.io.Resource resource)
      • process

        public <T> T process(String xml)
      • process

        public <T> T process(XMLStreamReader parser)
                  throws XMLStreamException,
                         IOException

        The process method is used to return an object representation of the current XML element and subtree from the XMLStreamReader. The method finds the process method in the subclass that has the method name with the prefix "process" followed by the XML element name, have only an XMLStreamReader parameter and return an Object (any subclass of Object can be returned).

        For example the process method for the XML element BankAccount would have the following signature.

         public BankAccount processBankAccount(XMLStreamReader parser);
         

        For example the process method for the XML element firstName would have the following signature. Note that the part of the method name for the XML element must have the same case as the XML element name.

         public String processfirstName(XMLStreamReader parser);
         
        Parameters:
        parser - The STAX XML parser.
        Returns:
        The object representation of the XML subtree.
        Throws:
        IOException - If an I/O exception occurs.
        XMLStreamException - If an exception processing the XML occurs.
      • setContext

        public final void setContext(XmlProcessorContext context)
        Set the context for processing the XML Document.
        Parameters:
        context - The context for processing the XML Document.

Copyright © 2015 Revolution Systems Inc.. All rights reserved.