Package org.frankframework.align
Class ToXml<C,N>
java.lang.Object
org.xml.sax.helpers.XMLFilterImpl
org.frankframework.align.XmlAligner
org.frankframework.align.ToXml<C,N>
- Type Parameters:
C
- containerN
- node
- All Implemented Interfaces:
ContentHandler
,DTDHandler
,EntityResolver
,ErrorHandler
,XMLFilter
,XMLReader
Base class for XML Schema guided Object to XML conversion;
- Author:
- Gerrit van Brakel
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
final String
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
ConstructorDescriptionToXml
(ValidatorHandler validatorHandler, List<org.apache.xerces.xs.XSModel> schemaInformation) -
Method Summary
Modifier and TypeMethodDescriptionObtain the XmlAligner as aSource
that can be used as input of aTransformer
.findNamespaceForName
(String name) getAttributes
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node) List<org.apache.xerces.xs.XSParticle>
getBestChildElementPath
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node, boolean silent) boolean
getBestMatchingElementPath
(org.apache.xerces.xs.XSElementDeclaration baseElementDeclaration, N baseNode, org.apache.xerces.xs.XSParticle particle, List<org.apache.xerces.xs.XSParticle> path, List<String> failureReasons) getChildrenByName
(N node, org.apache.xerces.xs.XSElementDeclaration childElementDeclaration) getNamespacePrefix
(String uri) getNodeNamespaceURI
(N node) return namespace of node, if known.abstract N
getRootNode
(C container) abstract String
getUnprocessedChildElementNames
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node, Set<String> processedChildren) protected void
handleComplexTypedElement
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node) void
handleElement
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node) void
handleElementContents
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node) void
handleError
(String msg) void
void
handleRootNode
(C container, String name, String nodeNamespace) Pushes node through validator.protected void
handleSimpleTypedElement
(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, org.apache.xerces.xs.XSSimpleTypeDefinition simpleTypeDefinition, N node) abstract boolean
boolean
boolean
abstract boolean
void
parse
(InputSource input) Start the parse, obtain the container to parse from the InputSource when set byasSource(Object)
.protected void
processChildElement
(N node, String parentName, org.apache.xerces.xs.XSElementDeclaration childElementDeclaration, boolean mandatory, Set<String> processedChildren) protected void
sendString
(String string) void
setDeepSearch
(boolean deepSearch) void
setFailOnWildcards
(boolean failOnWildcards) void
setRootElement
(String rootElement) void
setTargetNamespace
(String targetNamespace) void
startParse
(C container) Align the XML according to the schema.void
translate
(C data, ContentHandler handler) 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
-
XSI_PREFIX_MAPPING
- See Also:
-
MSG_EXPECTED_ELEMENT
- See Also:
-
MSG_INVALID_CONTENT
- See Also:
-
MSG_CANNOT_NOT_FIND_ELEMENT_DECLARATION
- See Also:
-
-
Constructor Details
-
ToXml
public ToXml(ValidatorHandler validatorHandler, List<org.apache.xerces.xs.XSModel> schemaInformation)
-
-
Method Details
-
getNodeNamespaceURI
return namespace of node, if known. If not, it will be determined from the schema. -
asSource
Obtain the XmlAligner as aSource
that can be used as input of aTransformer
. -
parse
Start the parse, obtain the container to parse from the InputSource when set byasSource(Object)
. Normally, the parse is started via {#startParse(C container)}, but this implementation allowsasSource(Object)
to function.- Specified by:
parse
in interfaceXMLReader
- Overrides:
parse
in classXMLFilterImpl
- Throws:
SAXException
IOException
-
startParse
Align the XML according to the schema.- Throws:
SAXException
-
getRootNode
-
getAttributes
public abstract Map<String,String> getAttributes(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node) throws SAXException - Throws:
SAXException
-
hasChild
public abstract boolean hasChild(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node, String childName) throws SAXException - Throws:
SAXException
-
getChildrenByName
public abstract Iterable<N> getChildrenByName(N node, org.apache.xerces.xs.XSElementDeclaration childElementDeclaration) throws SAXException - Throws:
SAXException
-
isNil
-
getText
-
getUnprocessedChildElementNames
protected Set<String> getUnprocessedChildElementNames(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node, Set<String> processedChildren) throws SAXException - Throws:
SAXException
-
handleRootNode
Pushes node through validator. Must push all nodes through validatorhandler, recursively, respecting the alignment request. Must set current=node before calling validatorHandler.startElement(), in order to get the right argument for the onStartElement / performAlignment callbacks.- Throws:
SAXException
-
handleElement
public void handleElement(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node) throws SAXException - Throws:
SAXException
-
handleElementContents
public void handleElementContents(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node) throws SAXException - Throws:
SAXException
-
handleComplexTypedElement
protected void handleComplexTypedElement(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node) throws SAXException - Throws:
SAXException
-
handleSimpleTypedElement
protected void handleSimpleTypedElement(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, org.apache.xerces.xs.XSSimpleTypeDefinition simpleTypeDefinition, N node) throws SAXException - Throws:
SAXException
-
processChildElement
protected void processChildElement(N node, String parentName, org.apache.xerces.xs.XSElementDeclaration childElementDeclaration, boolean mandatory, Set<String> processedChildren) throws SAXException - Throws:
SAXException
-
getBestChildElementPath
public List<org.apache.xerces.xs.XSParticle> getBestChildElementPath(org.apache.xerces.xs.XSElementDeclaration elementDeclaration, N node, boolean silent) throws SAXException - Throws:
SAXException
-
getBestMatchingElementPath
public boolean getBestMatchingElementPath(org.apache.xerces.xs.XSElementDeclaration baseElementDeclaration, N baseNode, org.apache.xerces.xs.XSParticle particle, List<org.apache.xerces.xs.XSParticle> path, List<String> failureReasons) throws SAXException - Parameters:
baseElementDeclaration
- TODOparticle
-failureReasons
- returns the reasons why no match was foundpath
- in this list the longest list of child elements, that matches the available, is maintained. Null if no matching.- Returns:
- true when a matching path is found. if false, failureReasons will contain reasons why.
- Throws:
SAXException
-
sendString
- Throws:
SAXException
-
handleError
- Throws:
SAXException
-
handleError
- Throws:
SAXException
-
getQName
- Throws:
SAXException
-
getNamespacePrefix
- Throws:
SAXException
-
findNamespaceForName
- Throws:
SAXException
-
translate
- Throws:
SAXException
-
translate
- Throws:
SAXException
-
getRootElement
-
setRootElement
-
getTargetNamespace
-
setTargetNamespace
-
isDeepSearch
public boolean isDeepSearch() -
setDeepSearch
public void setDeepSearch(boolean deepSearch) -
isFailOnWildcards
public boolean isFailOnWildcards() -
setFailOnWildcards
public void setFailOnWildcards(boolean failOnWildcards)
-