Class Dom4jDocumentJsonSerializer

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable

    public class Dom4jDocumentJsonSerializer
    extends com.fasterxml.jackson.databind.JsonSerializer<org.dom4j.Document>
    Custom Jackson serializer for Document.

    The following are the conversion patterns used between XML and JSON:

    XML JSON Access --- ---- ------ "e": null o.e text "e": "text" o.e "e": { "name": "value" } o.e["name"] text "e": { "name": "value", "text": "text" } o.e["name"] o.e["text"] texttext "e": { "a": "text", "b": "text" } o.e.a o.e.b texttext "e": { "a": ["text", "text"] } o.e.a[0] o.e.a[1] texttext "e": { "text": "text", "a": "text" } o.e["text"] o.e.a texttexttext "e": { "text": ["text", "text"], "a": "text" } o.e["text"][0] o.e["text"][1] o.e.a

    IMPORTANT: XML Namespaces are ALWAYS ignored.

    Author:
    avasquez
    • Constructor Detail

      • Dom4jDocumentJsonSerializer

        public Dom4jDocumentJsonSerializer()
    • Method Detail

      • serialize

        public void serialize​(org.dom4j.Document doc,
                              com.fasterxml.jackson.core.JsonGenerator jsonGenerator,
                              com.fasterxml.jackson.databind.SerializerProvider provider)
                       throws IOException
        Specified by:
        serialize in class com.fasterxml.jackson.databind.JsonSerializer<org.dom4j.Document>
        Throws:
        IOException
      • handledType

        public Class<org.dom4j.Document> handledType()
        Overrides:
        handledType in class com.fasterxml.jackson.databind.JsonSerializer<org.dom4j.Document>