stevedlawrence commented on code in PR #1532:
URL: https://github.com/apache/daffodil/pull/1532#discussion_r2282225867
##########
daffodil-core/src/main/java/org/apache/daffodil/api/Daffodil.java:
##########
@@ -36,4 +49,192 @@ private Daffodil() {
public static org.apache.daffodil.api.Compiler compiler() {
return org.apache.daffodil.core.compiler.Compiler.apply(true);
}
+
+
+ /**
+ * {@link InfosetOutputter} to build an infoset represented as a
scala.xml.Node
+ *
+ * @return InfosetOutputter
+ */
+ public static ScalaXMLInfosetOutputter newScalaXMLInfosetOutputter() {
+ return new
org.apache.daffodil.runtime1.infoset.ScalaXMLInfosetOutputter(false);
+ }
+
+ /**
+ * {@link InfosetOutputter} to build an infoset represented as XML written
to a java.io.OutputStream
+ * <p>
+ * Output the infoset as XML Text, written to a java.io.OutputStream
+ *
+ * @param os the java.io.OutputStream to write the XML text to
+ * @param pretty enable or disable pretty printing. Pretty printing will only
+ * insert indentation and newlines where it will not affect the
+ * content of the XML.
+ * @return InfosetOutputter
+ */
+ public static InfosetOutputter newXMLTextInfosetOutputter(OutputStream os,
boolean pretty) {
+ return new XMLTextInfosetOutputter(os, pretty,
XMLTextEscapeStyle.Standard, false);
+ }
+
+ /**
+ * {@link InfosetOutputter} to build an infoset represented as XML written
to a java.io.OutputStream
+ * <p>
+ * Output the infoset as XML Text, written to a java.io.OutputStream
+ *
+ * @param os the java.io.OutputStream to write the XML text
to
+ * @param pretty enable or disable pretty printing. Pretty
printing will only
+ * insert indentation and newlines where it will
not affect the
+ * content of the XML.
+ * @param xmlTextEscapeStyle determine whether to wrap values of elements of
type
+ * xs:string in CDATA tags in order to preserve
+ * whitespace.
+ * @return InfosetOutputter
+ */
+ public static InfosetOutputter newXMLTextInfosetOutputter(OutputStream os,
boolean pretty, XMLTextEscapeStyle xmlTextEscapeStyle) {
+ return new XMLTextInfosetOutputter(os, pretty, xmlTextEscapeStyle, false);
+ }
+
+ /**
+ * {@link InfosetOutputter} to build an infoset represented as JSON written
to a java.io.OutputStream
+ * Output the infoset as json text, written to a java.io.OutputStream
+ *
+ * @param os the java.io.OutputStream to write the json text to
+ * @param pretty enable or disable pretty printing. Pretty printing will only
+ * insert indentation and newlines where it will not affect the
+ * content of the json.
+ * @return InfosetOutputter
+ */
+ public static InfosetOutputter newJsonInfosetOutputter(OutputStream os,
boolean pretty) {
+ return new JsonInfosetOutputter(os, pretty);
+ }
+
+ /**
+ * {@link InfosetOutputter} to build an infoset represented as an
org.jdom2.Document
+ *
+ * @return InfosetOutputter
+ */
+ public static JDOMInfosetOutputter newJDOMInfosetOutputter() {
+ return new org.apache.daffodil.runtime1.infoset.JDOMInfosetOutputter();
+ }
+
+ /**
+ * {@link InfosetOutputter} to build an infoset represented as an
org.w3c.dom.Document
+ *
+ * @return InfosetOutputter
+ */
+ public static W3CDOMInfosetOutputter newW3CDOMInfosetOutputter() {
+ return new org.apache.daffodil.runtime1.infoset.W3CDOMInfosetOutputter();
+ }
+
+ /**
+ * {@link InfosetOutputter} that does not build an infoset representation,
ignoring
+ * all {@link InfosetOutputter} events
+ *
+ * @return InfosetOutputter
+ */
+ public static InfosetOutputter newNullInfosetOutputter() {
+ return new org.apache.daffodil.runtime1.infoset.NullInfosetOutputter();
+ }
+
+ /**
+ * {@link InfosetInputter} to read an infoset represented as a scala.xml.Node
+ *
+ * @param node the scala.xml.Node infoset
+ * @return InfosetInputter
+ */
+ public static InfosetInputter newScalaXMLInfosetInputter(scala.xml.Node
node) {
+ return new
org.apache.daffodil.runtime1.infoset.ScalaXMLInfosetInputter(node);
+ }
+
+ /**
+ * {@link InfosetInputter} to read an infoset represented as XML from a
java.io.InputStream
+ * <p>
+ * Read in an infoset in the form of XML text from a java.io.InputStream
+ *
+ * @param is the java.io.InputStream to read the XML text from
+ * @return InfosetInputter
+ */
+ public static InfosetInputter newXMLTextInfosetInputter(InputStream is) {
+ return new org.apache.daffodil.runtime1.infoset.XMLTextInfosetInputter(is);
+ }
+
+ /**
+ * {@link InfosetInputter} to read an infoset represented as JSON from a
java.io.InputStream
+ * <p>
+ * Read in an infoset in the form of json text from a java.io.InputStream
+ *
+ * @param is the java.io.InputStream to read the json text from
+ * @return InfosetInputter
+ */
+ public static InfosetInputter newJsonInfosetInputter(InputStream is) {
+ return new org.apache.daffodil.runtime1.infoset.JsonInfosetInputter(is);
+ }
+
+ /**
+ * {@link InfosetInputter} to read an infoset represented as an
org.jdom2.Document
+ *
+ * @param document the org.jdom2.Document infoset
+ * @return InfosetInputter
+ */
+ public static InfosetInputter newJDOMInfosetInputter(org.jdom2.Document
document) {
+ return new
org.apache.daffodil.runtime1.infoset.JDOMInfosetInputter(document);
+ }
+
+ /**
+ * {@link InfosetInputter} to read an infoset represented as an
org.w3c.dom.Document
+ *
+ * @param document the org.w3c.dom.Document infoset. Note that w3c
+ * Documents are not guaranteed to be thread-safe, even if
all
+ * users only read/traverse it. It is up to the user to
ensure
+ * that the Document passed into the W3CDOMInfosetInputter is
+ * not read or written by other threads while the
+ * W3CDOMInfosetInputter has access to it.
+ * @return InfosetInputter
+ */
+ public static InfosetInputter newW3CDOMInfosetInputter(org.w3c.dom.Document
document) {
+ return new
org.apache.daffodil.runtime1.infoset.W3CDOMInfosetInputter(document);
+ }
+
+ /**
+ * Create an InputSourceDataInputStream from a java.io.InputStream
+ *
+ * @param is input stream to create from
+ * @return InputSourceDataInputStream from a java.io.InputStream
+ */
+ public static InputSourceDataInputStream
newInputSourceDataInputStream(InputStream is) {
+ return org.apache.daffodil.io.InputSourceDataInputStream.apply(is);
+ }
+
+ /**
+ * Create an InputSourceDataInputStream from a java.nio.ByteBuffer
+ *
+ * @param bb byte buffer to create from
+ * @return InputSourceDataInputStream from a java.nio.ByteBuffer
+ */
+ public static InputSourceDataInputStream
newInputSourceDataInputStream(ByteBuffer bb) {
Review Comment:
There are interface level comments in InputSourceDataInputStream.java that
provide examples for how to create an InputSourceDataInputream, but it the
example use the constructors that no longer exist. Those should be updated.
I also wonder if those comments in ISDIS.java should just be removed to
these fatory funtions, since these functions are what people are more likely to
see. The comments in the ISDIS.java file can maybe just reference the factory
functions that could be used?
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]