Package org.frankframework.align
Class Json2Xml
java.lang.Object
org.xml.sax.helpers.XMLFilterImpl
org.frankframework.align.XmlAligner
org.frankframework.align.ToXml<C,N>
org.frankframework.align.Tree2Xml<jakarta.json.JsonValue,jakarta.json.JsonValue>
org.frankframework.align.Json2Xml
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
,XMLFilter
,XMLReader
XML Schema guided JSON to XML converter;
- Author:
- Gerrit van Brakel
-
Field Summary
Fields inherited from class org.frankframework.align.ToXml
MSG_CANNOT_NOT_FIND_ELEMENT_DECLARATION, MSG_EXPECTED_ELEMENT, MSG_INVALID_CONTENT, XSI_PREFIX_MAPPING
Fields inherited from class org.frankframework.align.XmlAligner
FEATURE_NAMESPACE_PREFIXES, FEATURE_NAMESPACES, log, validatorHandler, XML_SCHEMA_INSTANCE_NAMESPACE, XML_SCHEMA_NIL_ATTRIBUTE
-
Constructor Summary
ConstructorDescriptionJson2Xml
(ValidatorHandler validatorHandler, List<org.apache.xerces.xs.XSModel> schemaInformation, boolean insertElementContainerElements, String rootElement) Json2Xml
(ValidatorHandler validatorHandler, List<org.apache.xerces.xs.XSModel> schemaInformation, boolean insertElementContainerElements, String rootElement, boolean strictSyntax) -
Method Summary
Modifier and TypeMethodDescriptionstatic Json2Xml
create
(URL schemaURL, boolean compactJsonArrays, String rootElement, boolean strictSyntax, boolean deepSearch, String targetNamespace, Map<String, Object> overrideValues) getAllNodeChildNames
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) getAttributes
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) Iterable<jakarta.json.JsonValue>
getNodeChildrenByName
(jakarta.json.JsonValue node, org.apache.xerces.xs.XSElementDeclaration childElementDeclaration) getNodeText
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) protected String
getOverride
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) jakarta.json.JsonValue
getRootNode
(jakarta.json.JsonValue container) protected jakarta.json.JsonValue
getSubstitutedChild
(jakarta.json.JsonValue node, String childName) Allows subclasses to provide a special way of substituting.void
handleElementContents
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) boolean
hasChild
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node, String childName) boolean
isNil
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) boolean
protected void
processChildElement
(jakarta.json.JsonValue node, String parentName, org.apache.xerces.xs.XSElementDeclaration childElementDeclaration, boolean mandatory, Set<String> processedChildren) void
setReadAttributes
(boolean readAttributes) void
startParse
(jakarta.json.JsonValue node) Align the XML according to the schema.static String
translate
(jakarta.json.JsonStructure json, URL schemaURL, boolean compactJsonArrays, String rootElement, boolean strictSyntax, boolean deepSearch, String targetNamespace, Map<String, Object> overrideValues) static String
translate
(jakarta.json.JsonStructure jsonStructure, URL schemaURL, boolean compactJsonArrays, String rootElement, String targetNamespace) static String
translate
(String json, URL schemaURL, boolean compactJsonArrays, String rootElement, String targetNamespace) Methods inherited from class org.frankframework.align.Tree2Xml
getChildrenByName, getSubstitutionProvider, getText, getUnprocessedChildElementNames, setOverrideValues, setSubstitutionProvider
Methods inherited from class org.frankframework.align.ToXml
asSource, findNamespaceForName, getBestChildElementPath, getBestMatchingElementPath, getNamespacePrefix, getNodeNamespaceURI, getQName, getRootElement, getTargetNamespace, handleComplexTypedElement, handleElement, handleError, handleError, handleRootNode, handleSimpleTypedElement, isDeepSearch, isFailOnWildcards, parse, sendString, setDeepSearch, setFailOnWildcards, setRootElement, setTargetNamespace, translate, translate
Methods inherited from class org.frankframework.align.XmlAligner
collectChildElements, determineIsParentOfSingleMultipleOccurringChildElement, endElement, findElementDeclarationForName, findElementDeclarationsForName, findMultipleOccurringChildElements, getAttributeUses, getAttributeUses, getContext, getDocumentLocator, getElementType, getMultipleOccurringChildElements, getSchemaInformation, getSchemaInformation, getTypeDefinition, getTypeDefinition, getValidatorHandler, handleRecoverableError, isIgnoreUndeclaredElements, isMultipleOccurringChildElement, isMultipleOccurringChildInParentElement, isNil, isParentOfSingleMultipleOccurringChildElement, isPresentInSet, isTypeContainsWildcard, newLine, newLine, setDocumentLocator, setFeature, setIgnoreUndeclaredElements, setPsviProvider, setSchemaInformation, startDocument, startElement, typeContainsWildcard
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
characters, endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setParent, setProperty, skippedEntity, startPrefixMapping, unparsedEntityDecl, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.xml.sax.ContentHandler
declaration
-
Field Details
-
MSG_FULL_INPUT_IN_STRICT_COMPACTING_MODE
- See Also:
-
MSG_EXPECTED_SINGLE_ELEMENT
- See Also:
-
-
Constructor Details
-
Json2Xml
public Json2Xml(ValidatorHandler validatorHandler, List<org.apache.xerces.xs.XSModel> schemaInformation, boolean insertElementContainerElements, String rootElement) -
Json2Xml
public Json2Xml(ValidatorHandler validatorHandler, List<org.apache.xerces.xs.XSModel> schemaInformation, boolean insertElementContainerElements, String rootElement, boolean strictSyntax)
-
-
Method Details
-
startParse
Description copied from class:ToXml
Align the XML according to the schema.- Overrides:
startParse
in classToXml<jakarta.json.JsonValue,
jakarta.json.JsonValue> - Throws:
SAXException
-
getRootNode
public jakarta.json.JsonValue getRootNode(jakarta.json.JsonValue container) - Specified by:
getRootNode
in classToXml<jakarta.json.JsonValue,
jakarta.json.JsonValue>
-
handleElementContents
public void handleElementContents(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) throws SAXException - Overrides:
handleElementContents
in classToXml<jakarta.json.JsonValue,
jakarta.json.JsonValue> - Throws:
SAXException
-
getNodeText
public String getNodeText(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) - Specified by:
getNodeText
in classTree2Xml<jakarta.json.JsonValue,
jakarta.json.JsonValue>
-
isNil
public boolean isNil(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) -
getAttributes
public Map<String,String> getAttributes(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) throws SAXException - Specified by:
getAttributes
in classToXml<jakarta.json.JsonValue,
jakarta.json.JsonValue> - Throws:
SAXException
-
hasChild
public boolean hasChild(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node, String childName) throws SAXException - Overrides:
hasChild
in classTree2Xml<jakarta.json.JsonValue,
jakarta.json.JsonValue> - Throws:
SAXException
-
getAllNodeChildNames
public Set<String> getAllNodeChildNames(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) throws SAXException - Specified by:
getAllNodeChildNames
in classTree2Xml<jakarta.json.JsonValue,
jakarta.json.JsonValue> - Throws:
SAXException
-
getNodeChildrenByName
public Iterable<jakarta.json.JsonValue> getNodeChildrenByName(jakarta.json.JsonValue node, org.apache.xerces.xs.XSElementDeclaration childElementDeclaration) throws SAXException - Specified by:
getNodeChildrenByName
in classTree2Xml<jakarta.json.JsonValue,
jakarta.json.JsonValue> - Throws:
SAXException
-
getSubstitutedChild
Description copied from class:Tree2Xml
Allows subclasses to provide a special way of substituting. This is used by Json2Xml to insert a List of values as a JsonArray.- Overrides:
getSubstitutedChild
in classTree2Xml<jakarta.json.JsonValue,
jakarta.json.JsonValue>
-
getOverride
protected String getOverride(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, jakarta.json.JsonValue node) - Overrides:
getOverride
in classTree2Xml<jakarta.json.JsonValue,
jakarta.json.JsonValue>
-
processChildElement
protected void processChildElement(jakarta.json.JsonValue node, String parentName, org.apache.xerces.xs.XSElementDeclaration childElementDeclaration, boolean mandatory, Set<String> processedChildren) throws SAXException - Overrides:
processChildElement
in classToXml<jakarta.json.JsonValue,
jakarta.json.JsonValue> - Throws:
SAXException
-
translate
public static String translate(String json, URL schemaURL, boolean compactJsonArrays, String rootElement, String targetNamespace) throws SAXException - Throws:
SAXException
-
translate
public static String translate(jakarta.json.JsonStructure jsonStructure, URL schemaURL, boolean compactJsonArrays, String rootElement, String targetNamespace) throws SAXException - Throws:
SAXException
-
translate
public static String translate(jakarta.json.JsonStructure json, URL schemaURL, boolean compactJsonArrays, String rootElement, boolean strictSyntax, boolean deepSearch, String targetNamespace, Map<String, Object> overrideValues) throws SAXException- Throws:
SAXException
-
create
public static Json2Xml create(URL schemaURL, boolean compactJsonArrays, String rootElement, boolean strictSyntax, boolean deepSearch, String targetNamespace, Map<String, Object> overrideValues) throws SAXException- Throws:
SAXException
-
isReadAttributes
public boolean isReadAttributes() -
setReadAttributes
public void setReadAttributes(boolean readAttributes)
-