mbeckerle commented on a change in pull request #436:
URL: https://github.com/apache/incubator-daffodil/pull/436#discussion_r508048053
##########
File path:
daffodil-runtime1/src/main/scala/org/apache/daffodil/api/DFDLParserUnparser.scala
##########
@@ -202,6 +212,66 @@ object DFDL {
def parse(ab: Array[Byte]): Unit
}
+ trait DaffodilInputContentHandler extends org.xml.sax.ContentHandler with
ProducerCoroutine {
+ def getUnparseResult: UnparseResult
+ def enableInputterUriAbsolutization(): Unit
+ }
+
+ case class DaffodilUnparseErrorSAXException(unparseResult: UnparseResult)
+ extends
org.xml.sax.SAXException(unparseResult.getDiagnostics.mkString("\n"))
+
+ case class DaffodilUnhandledSAXException(description: String, cause:
Exception)
+ extends org.xml.sax.SAXException(description, cause)
+
+ class SaxInfosetEvent() {
+ var localName: Maybe[String] = Nope
+ var simpleText: Maybe[String] = Nope
+ var namespaceURI: Maybe[String] = Nope
+ var eventType: Maybe[InfosetInputterEventType] = Nope
+ var nilValue: Maybe[String] = Nope
+ var causeError: Maybe[SAXException] = Nope
+ var unparseResult: Maybe[UnparseResult] = Nope
+
+ def isError: Boolean = causeError.isDefined
+
+ def clear: Unit = {
+ localName = Nope
+ simpleText = Nope
+ namespaceURI = Nope
+ eventType = Nope
+ nilValue = Nope
+ causeError = Nope
+ unparseResult = Nope
+ }
+
+ def isEmpty: Boolean = {
+ localName.isEmpty &&
+ simpleText.isEmpty &&
+ namespaceURI.isEmpty &&
+ eventType.isEmpty &&
+ nilValue.isEmpty &&
+ causeError.isEmpty &&
+ unparseResult.isEmpty
+ }
+
+ override def toString: String = {
+ val errorState = if (isError) "ERROR" else ""
+ s"$errorState ${if (eventType.isDefined) eventType.get else
"No_EventType"}:" +
+ s"{${if (namespaceURI.isDefined) namespaceURI.get else ""}}" +
+ s"${if (localName.isDefined) localName.get else "No_Name"}:" +
+ s"(${if (simpleText.isDefined) simpleText.get else "No_content"})"
Review comment:
Yup. This is the runtime system. We need to avoid scala-constructs that
are heavyweight in favor of lightweight java-ish idioms unfortunately.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]