Re: [xsl] XSLT 3.0 processor accepting non well-formed XML inputs

Subject: Re: [xsl] XSLT 3.0 processor accepting non well-formed XML inputs
From: "Dimitre Novatchev dnovatchev@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 2 Mar 2019 04:21:07 -0000
The definition of well-formedness was created more than 20 years ago,
when we thought that Hamlet.xml (200KB) was a particularly "big" XML
document.

To me this definition kinda presupposes that the complete XML document
and its data model would be constructed and held in memory -- as a
first phase of processing. Not being able to contain the whole
document in memory leads to not being able to say that the XML
document is well-formed. The bigger the document, the lesser
meaningful such definition/requirement becomes. In fact, if we accept
that there could be infinitely large (continuously streaming)
documents, then the well-formedness requirement becomes almost
completely meaningless -- but no one can argue against the usefulness
of being able to continuously process an infinite stream formatted
like XML. Other models also become not too meaningful, like some of
the XPath axes ...

If we want to stream XML documents, this inevitably forces another
dimension to us -- the time dimension. Even Dr. Kay is speaking about
micro-seconds vs. seconds.

Theoretically one could introduce the concept of transaction in
streamed XML processing and abort/rollback the transaction the first
time when well-formedness or another irregularity, like schema
invalidity is encountered. However even this loses meaning when
processing infinite streams -- the transaction becomes "long
transaction" and actually "unlimited time transaction" and this seems
not to have any good, meaningful use.

And if the streamed XML processing also produces as result streams of
data to the outside observers, then it becomes impossible to "undo"
the effects of such "transaction".

Taking all this into account, will it be useful to relax some
requirements toward the streamed XML, so that people will not have to
spend time over such seeming "issues", because in the relaxed terms
these will simply become non-existent?

Cheers,
Dimitre

On Fri, Mar 1, 2019 at 3:43 AM Michael Kay mike@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Ethics to me is about building systems that don't harm people. It's not
about conforming to rules and regulations.
>
> In practice it is often useful to be able to extract information from the
start of an XML document (e.g. an attribute of the root element) without
reading gigabytes of data that follow. Most XML parsers therefore provide an
option for the application to terminate parsing as soon as they have obtained
the information they need. We can debate whether a conformant XML parser is
permitted to provide such an option; in practice it really doesn't matter:
parsers will provide such an option because it is needed.
>
> This rule in the XSLT spec for streaming is just warning you that if your
stylesheet does something like
>
> <xsl:source-document href="big.xml">
>   <xsl:sequence select="string(/*/@version)"/>
> </xsl:source-document>
>
> then it may succeed even though big.xml contains errors after the first
start tag. Is it "ethical" to provide such an option? Absolutely. In some
cases, extracting the data in microseconds rather than seconds might save
lives.
>
> It's the responsibility of the application designer to decide the right
trade-offs between performance, security, reliability, and other system
qualities.
>
> Michael Kay
> Saxonica
>
> > On 1 Mar 2019, at 11:23, Mukul Gandhi gandhi.mukul@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Hi all,
> >    I've got some chance to try XSLT 3.0's streaming features, and have
found them useful. I've a slight question as below,
> >
> > The XSLT 3.0 spec, in the section "2.12 Streamed Validation" says
following,
> >
> > <quote>
> > A streamed transformation that only accesses part of the input document
(for example, a header at the start of a document) is not required to continue
reading once the data it needs has been read. This means that XML
well-formedness or validity errors occurring in the unread part of the input
stream may go undetected.
> > </quote>
> >
> > As per above quoted text, is it ethical for an XSLT (3.0) processor to
provide a functionality that's based on a non well-formed input XML document?
> >
> >
> >
> >
> > --
> > Regards,
> > Mukul Gandhi
> >
> > alt email : mukulgandhi@xxxxxxx
> >
> > XSL-List info and archive
> > EasyUnsubscribe (by email)
>



--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
To achieve the impossible dream, try going to sleep.
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
-------------------------------------
Sanity is madness put to good use.
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.

Current Thread