You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@daffodil.apache.org by Mike Beckerle <mb...@apache.org> on 2022/07/11 19:19:28 UTC
CLI -I sax feature - remove?
In the CLI, there is the -I option to specify infoset-type.
One of the choices is 'sax'.
This is a mistake I think. This is really "XML text by way of calling the
SAX API". It's effectively a testing mode for us.
SAX usage is inherently an API.
I believe we should remove this feature from the CLI, because it creates a
lot of confusion. It requires test-mode things to be in the main-libraries
where the CLI can find them.
If we require SAX to be used as it is intended, from applications calling
Daffodil via APIs, then all this "xml text to/from SAX-event" code all ends
up in src/test where it belongs.
Thoughts?
RE: CLI -I sax feature - remove?
Posted by "Interrante, John A (GE Research, US)" <Jo...@ge.com>.
+1 from me. Sounds like the right way to go.
-----Original Message-----
From: Mike Beckerle <mb...@apache.org>
Sent: Monday, July 11, 2022 3:19 PM
To: dev@daffodil.apache.org
Subject: EXT: CLI -I sax feature - remove?
WARNING: This email originated from outside of GE. Please validate the sender's email address before clicking on links or attachments as they may not be safe.
In the CLI, there is the -I option to specify infoset-type.
One of the choices is 'sax'.
This is a mistake I think. This is really "XML text by way of calling the SAX API". It's effectively a testing mode for us.
SAX usage is inherently an API.
I believe we should remove this feature from the CLI, because it creates a lot of confusion. It requires test-mode things to be in the main-libraries where the CLI can find them.
If we require SAX to be used as it is intended, from applications calling Daffodil via APIs, then all this "xml text to/from SAX-event" code all ends up in src/test where it belongs.
Thoughts?
Re: CLI -I sax feature - remove?
Posted by Steve Lawrence <sl...@apache.org>.
By this argument, should we also remove JDOM, W3CDOM, and Scala XML
infoset outputters from the CLI? These are also effectively API's as
well. The CLI just takes the results and converts them to a string for
output.
Maybe the CLI only cares about outputting to XML using the XML Text
Infoset Outputter, and there shouldn't even be an option for other
outputters?
One counter argument, the -I command is useful from a testing
perspective to make sure we are building the API objects correctly, with
the assumption that to .toString of those objects is correct. But our
TDML runner already does that, so maybe we can just rely on those tests
and this isn't necessary.
If we do remove the -I option, what are thoughts on keeping the option
for the performance subcommand? This is a quick way to test the overhead
of different InfosetOutputter's and is something we have done in the
past multiple times. Note that for the performance subcommand, the
non-text InfosetOutputters don't actually convert to a string, so it
only measures the speed to create the API objects.
The exception is with SAX, which does covert the SAX events to text
during the performance subcommand (using the
DaffodilParseOutputStreamContentHandler). That is probably wrong, since
that measures the speed of creating SAX events AND whatever the
ContentHandler does, which it most cases will not be the same as what
this content handler does. We really just want a measure of how long it
takes Daffodil to parse data and convert it to SAX events.
This is further complicated for the performance --unparse option, where
the SAX performance includes the time to parse the infoset AND convert
to SAX events for Daffodil to unparse. Ideally parsing the infoset would
not be included since that is overhead that most SAX implementations
won't have, or would at least be outside of Daffodil. One way to resolve
this is to preprocess the infoset into a list of "events" (similar to
TestInfosetEvent in TestJavaAPI.scala), and use a custom XMLReader that
uses that list for creating SAX events to unparse. Adds a bit of
complication though.
I'd suggest the changes should be:
1. Remove the -I option from the parse/unparse subcommands only, and
always use the XMLTextInfosetInputter/Outputter
2. Keep the -I option the same for the performance subcommand, with
these two changes:
2a. Change SAX performance --parse so that it outputs to a "null"
content handler
2b. Change SAX performance --unparse so that we preprocess the infoset
and convert to a list of "events". A custom XMLReader is used to feed
these events to Daffodil for unparsing.
On 7/11/22 3:19 PM, Mike Beckerle wrote:
> In the CLI, there is the -I option to specify infoset-type.
>
> One of the choices is 'sax'.
>
> This is a mistake I think. This is really "XML text by way of calling the
> SAX API". It's effectively a testing mode for us.
>
> SAX usage is inherently an API.
>
> I believe we should remove this feature from the CLI, because it creates a
> lot of confusion. It requires test-mode things to be in the main-libraries
> where the CLI can find them.
>
> If we require SAX to be used as it is intended, from applications calling
> Daffodil via APIs, then all this "xml text to/from SAX-event" code all ends
> up in src/test where it belongs.
>
> Thoughts?
>
RE: CLI -I sax feature - remove?
Posted by "Thompson, Dave" <dt...@owlcyberdefense.com>.
Roger that.
From: Mike Beckerle <mb...@apache.org>
Sent: Monday, July 11, 2022 4:52 PM
To: Thompson, Dave <dt...@owlcyberdefense.com>
Cc: dev@daffodil.apache.org; Adams, Joshua <ja...@owlcyberdefense.com>
Subject: Re: CLI -I sax feature - remove?
(I'd swear I replied to this already, but not in the thread so... rinse, repeat)
I do realize we didn't add it by mistake. We purposefully added it. I just think that design choice can be viewed, with 20/20 hindsight, as incorrect at this point.
On Mon, Jul 11, 2022 at 3:35 PM Thompson, Dave <dt...@owlcyberdefense.com>> wrote:
The -I sax option wasn't a mistake. It was added for the SAX parse/unparsed update Lola worked back in 2020 and 2021.
Dave
-----Original Message-----
From: Adams, Joshua <ja...@owlcyberdefense.com>>
Sent: Monday, July 11, 2022 3:26 PM
To: dev@daffodil.apache.org<ma...@daffodil.apache.org>; mbeckerle@apache.org<ma...@apache.org>
Subject: Re: CLI -I sax feature - remove?
Funnily enough I was just having a conversation with Dave Thompson about this very thing. When I mentioned that we will have a "-I exi" option for the command line tool, which from Daffodil's perspective will be just like using SAX, he asked if he will need to specify the "-I sax" option, or if that option will just go away.
I am in full agreement of removing the "-I sax" option as, like you said, SAX usage is inherently an API and I can't think of an easy way to pass a SAX ContentHandler over the command line. Adding an EXI option to the Daffodil CLI tool can kill 2 birds with one stone in that we will be adding support for EXI as well as demonstrating how to pass in your own SAX ContentHandler.
Josh
________________________________
From: Mike Beckerle <mb...@apache.org>>
Sent: Monday, July 11, 2022 3:19 PM
To: dev@daffodil.apache.org<ma...@daffodil.apache.org> <de...@daffodil.apache.org>>
Subject: CLI -I sax feature - remove?
In the CLI, there is the -I option to specify infoset-type.
One of the choices is 'sax'.
This is a mistake I think. This is really "XML text by way of calling the SAX API". It's effectively a testing mode for us.
SAX usage is inherently an API.
I believe we should remove this feature from the CLI, because it creates a lot of confusion. It requires test-mode things to be in the main-libraries where the CLI can find them.
If we require SAX to be used as it is intended, from applications calling Daffodil via APIs, then all this "xml text to/from SAX-event" code all ends up in src/test where it belongs.
Thoughts?
Re: CLI -I sax feature - remove?
Posted by Mike Beckerle <mb...@apache.org>.
(I'd swear I replied to this already, but not in the thread so... rinse,
repeat)
I do realize we didn't add it by mistake. We purposefully added it. I just
think that design choice can be viewed, with 20/20 hindsight, as incorrect
at this point.
On Mon, Jul 11, 2022 at 3:35 PM Thompson, Dave <
dthompson@owlcyberdefense.com> wrote:
> The -I sax option wasn't a mistake. It was added for the SAX
> parse/unparsed update Lola worked back in 2020 and 2021.
>
> Dave
>
>
> -----Original Message-----
> From: Adams, Joshua <ja...@owlcyberdefense.com>
> Sent: Monday, July 11, 2022 3:26 PM
> To: dev@daffodil.apache.org; mbeckerle@apache.org
> Subject: Re: CLI -I sax feature - remove?
>
> Funnily enough I was just having a conversation with Dave Thompson about
> this very thing. When I mentioned that we will have a "-I exi" option for
> the command line tool, which from Daffodil's perspective will be just like
> using SAX, he asked if he will need to specify the "-I sax" option, or if
> that option will just go away.
>
> I am in full agreement of removing the "-I sax" option as, like you said,
> SAX usage is inherently an API and I can't think of an easy way to pass a
> SAX ContentHandler over the command line. Adding an EXI option to the
> Daffodil CLI tool can kill 2 birds with one stone in that we will be adding
> support for EXI as well as demonstrating how to pass in your own SAX
> ContentHandler.
>
> Josh
> ________________________________
> From: Mike Beckerle <mb...@apache.org>
> Sent: Monday, July 11, 2022 3:19 PM
> To: dev@daffodil.apache.org <de...@daffodil.apache.org>
> Subject: CLI -I sax feature - remove?
>
> In the CLI, there is the -I option to specify infoset-type.
>
> One of the choices is 'sax'.
>
> This is a mistake I think. This is really "XML text by way of calling the
> SAX API". It's effectively a testing mode for us.
>
> SAX usage is inherently an API.
>
> I believe we should remove this feature from the CLI, because it creates a
> lot of confusion. It requires test-mode things to be in the main-libraries
> where the CLI can find them.
>
> If we require SAX to be used as it is intended, from applications calling
> Daffodil via APIs, then all this "xml text to/from SAX-event" code all ends
> up in src/test where it belongs.
>
> Thoughts?
>
RE: CLI -I sax feature - remove?
Posted by "Thompson, Dave" <dt...@owlcyberdefense.com>.
The -I sax option wasn't a mistake. It was added for the SAX parse/unparsed update Lola worked back in 2020 and 2021.
Dave
-----Original Message-----
From: Adams, Joshua <ja...@owlcyberdefense.com>
Sent: Monday, July 11, 2022 3:26 PM
To: dev@daffodil.apache.org; mbeckerle@apache.org
Subject: Re: CLI -I sax feature - remove?
Funnily enough I was just having a conversation with Dave Thompson about this very thing. When I mentioned that we will have a "-I exi" option for the command line tool, which from Daffodil's perspective will be just like using SAX, he asked if he will need to specify the "-I sax" option, or if that option will just go away.
I am in full agreement of removing the "-I sax" option as, like you said, SAX usage is inherently an API and I can't think of an easy way to pass a SAX ContentHandler over the command line. Adding an EXI option to the Daffodil CLI tool can kill 2 birds with one stone in that we will be adding support for EXI as well as demonstrating how to pass in your own SAX ContentHandler.
Josh
________________________________
From: Mike Beckerle <mb...@apache.org>
Sent: Monday, July 11, 2022 3:19 PM
To: dev@daffodil.apache.org <de...@daffodil.apache.org>
Subject: CLI -I sax feature - remove?
In the CLI, there is the -I option to specify infoset-type.
One of the choices is 'sax'.
This is a mistake I think. This is really "XML text by way of calling the SAX API". It's effectively a testing mode for us.
SAX usage is inherently an API.
I believe we should remove this feature from the CLI, because it creates a lot of confusion. It requires test-mode things to be in the main-libraries where the CLI can find them.
If we require SAX to be used as it is intended, from applications calling Daffodil via APIs, then all this "xml text to/from SAX-event" code all ends up in src/test where it belongs.
Thoughts?
Re: CLI -I sax feature - remove?
Posted by Mike Beckerle <mb...@apache.org>.
SAX and EXI are related by SAX being the efficient way to talk to an EXI
library "without having to know anything about EXI".
SAX is the common API that multiple EXI libraries will all support, so
enables daffodil to support multiple EXI libraries without embedding one in
our code base.
(StAX *might* also be supported, unclear. SAX is far more common.)
Since at least one of the important EXI implementations is closed source,
this lack of being tied to any EXI implementation is important for our
users I think.
RE taking features out of the CLI. I'm not opposed to having sensible
testing capabilities in the CLI. Maybe we just need to document them
separately.
But it does drag many things into our dependencies that wouldn't otherwise
be there. Though only for the daffodil-cli module, so maybe that's ok.
I think tying our CLI to one specific EXI implementation with a compatible
open-source license is "acceptable", but not preferred. I'd rather it
accommodated the selection of an EXI implementation by some dynamic means
using standard APIs like SAX.
I think it has become clear that we need to have an EXI features discussion
and capture the goals and requirements.
I will start a separate thread on this.
On Mon, Jul 18, 2022 at 9:49 AM Steve Lawrence <sl...@apache.org> wrote:
> I would argue having a -I exi capability is useful, the output would
> just be a EXI blob of data rather than XML text. This could then be fed
> into things that understand the EXI data format.
>
> It's also not clear to me how EXI and SAX are related. For the new EXI
> infoset outputter, I assume we would directly use the EXI library API to
> create an EXI blob?
>
>
> On 7/11/22 3:25 PM, Adams, Joshua wrote:
> > Funnily enough I was just having a conversation with Dave Thompson about
> this very thing. When I mentioned that we will have a "-I exi" option for
> the command line tool, which from Daffodil's perspective will be just like
> using SAX, he asked if he will need to specify the "-I sax" option, or if
> that option will just go away.
> >
> > I am in full agreement of removing the "-I sax" option as, like you
> said, SAX usage is inherently an API and I can't think of an easy way to
> pass a SAX ContentHandler over the command line. Adding an EXI option to
> the Daffodil CLI tool can kill 2 birds with one stone in that we will be
> adding support for EXI as well as demonstrating how to pass in your own SAX
> ContentHandler.
> >
> > Josh
> > ________________________________
> > From: Mike Beckerle <mb...@apache.org>
> > Sent: Monday, July 11, 2022 3:19 PM
> > To: dev@daffodil.apache.org <de...@daffodil.apache.org>
> > Subject: CLI -I sax feature - remove?
> >
> > In the CLI, there is the -I option to specify infoset-type.
> >
> > One of the choices is 'sax'.
> >
> > This is a mistake I think. This is really "XML text by way of calling the
> > SAX API". It's effectively a testing mode for us.
> >
> > SAX usage is inherently an API.
> >
> > I believe we should remove this feature from the CLI, because it creates
> a
> > lot of confusion. It requires test-mode things to be in the
> main-libraries
> > where the CLI can find them.
> >
> > If we require SAX to be used as it is intended, from applications calling
> > Daffodil via APIs, then all this "xml text to/from SAX-event" code all
> ends
> > up in src/test where it belongs.
> >
> > Thoughts?
> >
>
>
Re: CLI -I sax feature - remove?
Posted by Steve Lawrence <sl...@apache.org>.
I would argue having a -I exi capability is useful, the output would
just be a EXI blob of data rather than XML text. This could then be fed
into things that understand the EXI data format.
It's also not clear to me how EXI and SAX are related. For the new EXI
infoset outputter, I assume we would directly use the EXI library API to
create an EXI blob?
On 7/11/22 3:25 PM, Adams, Joshua wrote:
> Funnily enough I was just having a conversation with Dave Thompson about this very thing. When I mentioned that we will have a "-I exi" option for the command line tool, which from Daffodil's perspective will be just like using SAX, he asked if he will need to specify the "-I sax" option, or if that option will just go away.
>
> I am in full agreement of removing the "-I sax" option as, like you said, SAX usage is inherently an API and I can't think of an easy way to pass a SAX ContentHandler over the command line. Adding an EXI option to the Daffodil CLI tool can kill 2 birds with one stone in that we will be adding support for EXI as well as demonstrating how to pass in your own SAX ContentHandler.
>
> Josh
> ________________________________
> From: Mike Beckerle <mb...@apache.org>
> Sent: Monday, July 11, 2022 3:19 PM
> To: dev@daffodil.apache.org <de...@daffodil.apache.org>
> Subject: CLI -I sax feature - remove?
>
> In the CLI, there is the -I option to specify infoset-type.
>
> One of the choices is 'sax'.
>
> This is a mistake I think. This is really "XML text by way of calling the
> SAX API". It's effectively a testing mode for us.
>
> SAX usage is inherently an API.
>
> I believe we should remove this feature from the CLI, because it creates a
> lot of confusion. It requires test-mode things to be in the main-libraries
> where the CLI can find them.
>
> If we require SAX to be used as it is intended, from applications calling
> Daffodil via APIs, then all this "xml text to/from SAX-event" code all ends
> up in src/test where it belongs.
>
> Thoughts?
>
Re: CLI -I sax feature - remove?
Posted by "Adams, Joshua" <ja...@owlcyberdefense.com>.
Funnily enough I was just having a conversation with Dave Thompson about this very thing. When I mentioned that we will have a "-I exi" option for the command line tool, which from Daffodil's perspective will be just like using SAX, he asked if he will need to specify the "-I sax" option, or if that option will just go away.
I am in full agreement of removing the "-I sax" option as, like you said, SAX usage is inherently an API and I can't think of an easy way to pass a SAX ContentHandler over the command line. Adding an EXI option to the Daffodil CLI tool can kill 2 birds with one stone in that we will be adding support for EXI as well as demonstrating how to pass in your own SAX ContentHandler.
Josh
________________________________
From: Mike Beckerle <mb...@apache.org>
Sent: Monday, July 11, 2022 3:19 PM
To: dev@daffodil.apache.org <de...@daffodil.apache.org>
Subject: CLI -I sax feature - remove?
In the CLI, there is the -I option to specify infoset-type.
One of the choices is 'sax'.
This is a mistake I think. This is really "XML text by way of calling the
SAX API". It's effectively a testing mode for us.
SAX usage is inherently an API.
I believe we should remove this feature from the CLI, because it creates a
lot of confusion. It requires test-mode things to be in the main-libraries
where the CLI can find them.
If we require SAX to be used as it is intended, from applications calling
Daffodil via APIs, then all this "xml text to/from SAX-event" code all ends
up in src/test where it belongs.
Thoughts?