Package org.apache.daffodil.api.infoset
Class InfosetInputter
java.lang.Object
org.apache.daffodil.api.infoset.InfosetInputter
Abstract class used to determine how the infoset representation should be
input from a call to
DataProcessor.unparse(input* DataProcessor.unparse)
. This uses a Cursor API, such
that each call to advance/inspect must update a cursor value, minimizing
allocations. Callers of advance/inspect are expected to copy out any
information from advanceAccessor and inspectAccessor if they need to retain
the information after a call to advance/inspect.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
fini()
clean upabstract Daffodil.InfosetInputterEventType
abstract String
Get the local name of the current event.abstract String
Get the namespace of the current event.abstract String
getSimpleText
(org.apache.daffodil.runtime1.dpath.NodeInfo.Kind primType, Map<String, String> runtimeProperties) Get the content of a simple type.boolean
Get if this infoset inputter supports namespaces.abstract boolean
hasNext()
abstract Boolean
isNilled()
Determine if the current event is nilled.abstract void
next()
Move the internal state to the next event.void
setSupportsNamespaces
(boolean supportsNS) Set if this infoset inputter supports namespaces.
-
Constructor Details
-
InfosetInputter
public InfosetInputter()
-
-
Method Details
-
getSupportsNamespaces
public boolean getSupportsNamespaces()Get if this infoset inputter supports namespaces. The return value of getNamespace will be ignored if this is false. Note that if this is false, some infoset representations may fail to unparse if the schema depends on namespace information to differentiate between elements.- Returns:
- true if this infoset inputter supports namespaces
-
setSupportsNamespaces
public void setSupportsNamespaces(boolean supportsNS) Set if this infoset inputter supports namespaces. The return value of getNamespace will be ignored if this is false. Note that if this is false, some infoset representations may fail to unparse if the schema depends on namespace information to differentiate between elements.- Parameters:
supportsNS
- value to set supportNamespaces to
-
getEventType
- Returns:
- the current infoset inputter event type
-
getLocalName
Get the local name of the current event. This will only be called when the current event type is StartElement.- Returns:
- local name of the current event
-
getNamespaceURI
Get the namespace of the current event. This will only be called when the current event type is StartElement. If the InfosetInputter does not support namespaces, this should return null. This may return null to represent no namespaces.- Returns:
- namespace of the current event
-
getSimpleText
public abstract String getSimpleText(org.apache.daffodil.runtime1.dpath.NodeInfo.Kind primType, Map<String, String> runtimeProperties) Get the content of a simple type. This will only be called when the current event type is StartElement and the element is a simple type. If the event contains complex data, it is an error and should throw NonTextFoundInSimpleContentException. If the element does not have any simple content, this should return either null or the empty string.- Parameters:
primType
- prim type to queryruntimeProperties
- runtime properties ex stringAsXML- Returns:
- content of a simple type
-
isNilled
Determine if the current event is nilled. This will only be called when the current event type is StartElement.- Returns:
- null if no nil property is set, which implies the element is not nilled or false if the nil property is set, but it is set to false or true if the nil property is set to true.
-
hasNext
public abstract boolean hasNext()- Returns:
- true if there are remaining events. False otherwise.
-
next
public abstract void next()Move the internal state to the next event. -
fini
public abstract void fini()clean up
-