Package com.adaptris.core.transform.json
Class SafeJsonTransformationDriver
- java.lang.Object
-
- com.adaptris.core.transform.json.JsonTransformationDriverImpl
-
- com.adaptris.core.transform.json.JsonlibTransformationDriver
-
- com.adaptris.core.transform.json.SafeJsonTransformationDriver
-
- All Implemented Interfaces:
TransformationDriver
@ComponentProfile(summary="JSON/XML Transformation driver that strips spaces before rendering as JSON", since="3.6.4", tag="json,xml,transformation") public class SafeJsonTransformationDriver extends JsonlibTransformationDriver
Executes a transform to strip-spaces before rendering as JSON.This will execute a transform to strip spaces using the standard
xsl:strip-space elements="*"
directive before attempting to serialize the XML as JSON. In some situations the default driver can be very sensitive to whitespace that may occur because of indenting and formatting.The transform used is stored in the jar file itself - "META-INF/com.adaptris.core.transform.json.strip-spaces.xsl"; it is very simple, and may not handle namespaces terribly well.
- Since:
- 3.6.4
In the adapter configuration file this class is aliased as json-safe-transformation-driver which is the preferred alternative to the fully qualified classname when building your configuration.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
STRIP_SPACES_XSLT
-
Constructor Summary
Constructors Constructor Description SafeJsonTransformationDriver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
xmlToJSON(java.lang.String input)
Convert XML to JSON.-
Methods inherited from class com.adaptris.core.transform.json.JsonlibTransformationDriver
parse, parseArray, parseObject
-
Methods inherited from class com.adaptris.core.transform.json.JsonTransformationDriverImpl
getArrayName, getElementName, getForceTopLevelObject, getObjectName, getRootName, getSkipWhitespace, getTrimSpaces, getTypeHintsCompatibility, getTypeHintsEnabled, objectName, setArrayName, setElementName, setForceTopLevelObject, setObjectName, setRootName, setSkipWhitespace, setTrimSpaces, setTypeHintsCompatibility, setTypeHintsEnabled, transform
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.transform.json.TransformationDriver
transform
-
-
-
-
Field Detail
-
STRIP_SPACES_XSLT
public static final java.lang.String STRIP_SPACES_XSLT
- See Also:
- Constant Field Values
-
-
Method Detail
-
xmlToJSON
protected java.lang.String xmlToJSON(java.lang.String input) throws ServiceException
Description copied from class:JsonTransformationDriverImpl
Convert XML to JSON.- Overrides:
xmlToJSON
in classJsonTransformationDriverImpl
- Parameters:
input
- The XML to convert.- Returns:
- The converted JSON.
- Throws:
ServiceException
- Thrown if there was a problem converting from XML to JSON.
-
-