Class JacksonXMLToJsonNodeMapper

  • All Implemented Interfaces:
    Mapper<com.fasterxml.jackson.databind.JsonNode>

    public class JacksonXMLToJsonNodeMapper
    extends JacksonXMLToObjectMapper<com.fasterxml.jackson.databind.JsonNode>
    implements Mapper<com.fasterxml.jackson.databind.JsonNode>
    A specialized Mapper that loads the contents of a valid XML Source (e.g.: file, URL, string) and converts it into a JsonNode, using Jackson's XmlMapper.

    This allows fetching the contents using JSONPath expressions.

    Because of differences between XML and JSON formats, there are certain limitations with Jackson's XML tree traversal support:

    • Jackson cannot differentiate between an Object and an Array. Since XML lacks native structures to distinguish an object from a list of objects, Jackson will simply collate repeated elements into a single value.
    • Since Jackson maps each XML element to a JSON node, it doesn't support mixed content (elements/attributes and text in same element).

    Additional details can be found at Jackson's official documentation.

    Notes:

    • Conversion from XML to JSON may vary depending on the Mapper implementation.
    • Support for Jackson modules lookup is disabled for this type of mapper.
    Since:
    0.3.0
    Author:
    oswaldo.bapvic.jr (Oswaldo Junior)
    • Constructor Detail

      • JacksonXMLToJsonNodeMapper

        public JacksonXMLToJsonNodeMapper()
        Builds a new XML-to-JSON mapper.