Class Dom4jDocumentJsonSerializer
java.lang.Object
com.fasterxml.jackson.databind.JsonSerializer<org.dom4j.Document>
org.craftercms.core.util.json.jackson.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
IMPORTANT: XML Namespaces are ALWAYS ignored.
Document
.
The following are the conversion patterns used between XML and JSON:
XML | JSON | Access |
---|---|---|
<e/> | "e": null | o.e |
<e>text</e> | "e": "text" | o.e |
<e name="value" /> | "e": { "name": "value" } | o.e["name"] |
<e name="value">text</e> | "e": { "name": "value", "text": "text" } | o.e["name"] o.e["text"] |
<e><a>text</a><b>text</b></e> | "e": { "a": "text", "b": "text" } | o.e.a o.e.b |
<e><a>text</a><a>text</a></e> | "e": { "a": ["text", "text"] } | o.e.a[0] o.e.a[1] |
<e>text<a>text</a></e> | "e": { "text": "text", "a": "text" } | o.e["text"] o.e.a |
<e>text<a>text</a>text</e> | "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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonSerializer
com.fasterxml.jackson.databind.JsonSerializer.None
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.fasterxml.jackson.databind.JsonSerializer
acceptJsonFormatVisitor, getDelegatee, isEmpty, isEmpty, isUnwrappingSerializer, properties, replaceDelegatee, serializeWithType, unwrappingSerializer, usesObjectId, withFilterId
-
Field Details
-
ITEM_LIST_ATTRIBUTE_NAME
- See Also:
-
IGNORABLE_ATTRIBUTES
-
TEXT_JSON_KEY
- See Also:
-
-
Constructor Details
-
Dom4jDocumentJsonSerializer
public Dom4jDocumentJsonSerializer()
-
-
Method Details
-
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 classcom.fasterxml.jackson.databind.JsonSerializer<org.dom4j.Document>
- Throws:
IOException
-
handledType
- Overrides:
handledType
in classcom.fasterxml.jackson.databind.JsonSerializer<org.dom4j.Document>
-