[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Issues with xs:error in the XPath 3.0 and XDM 3.0 Recommendations.


Subject: Re: [xsl] Issues with xs:error in the XPath 3.0 and XDM 3.0 Recommendations.
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 20 Apr 2014 12:04:48 -0700

So, my understanding of the xs:error type is that it serves similar
role to an $Error token in a grammar definition language. The purpose
of $Error is to signal an error when none of the legal alternatives is
materialized in the process of parsing.

$Error is definitely not a non-terminal symbol, because it isn't the
LHS of any production. It *may* be classified thus as a terminal
symbol, though $Error is never going to be produced by the lexical
analyzer.

Therefore, $Error stands for "all possible terminal symbols, with the
exception of the ones that are legally allowed in a given production"

Even if this is correct, I am still amused how this can be classified
as a type of the language :)

Cheers,
Dimitre

On Sat, Apr 19, 2014 at 8:29 PM, Dimitre Novatchev <dnovatchev@xxxxxxxxx> wrote:
>  Thank you for these examples.
>
> On Sat, Apr 19, 2014 at 7:38 PM, Graydon <graydon@xxxxxxxxx> wrote:
>> On Sat, Apr 19, 2014 at 06:42:01PM -0700, Dimitre Novatchev scripsit:
>>> To put it in other words:  Why was the xs:error type introduced (in
>>> XML Schema)? What purpose does it serve? What problems does it solve?
>>
>> http://lists.w3.org/Archives/Public/xmlschema-dev/2009Jul/0045.html (and
>> the rest of the thread) may be of interest.
>>
>> xs:error would appear to be a result of conditional type assignment and
>> to allow
>>
>> <element name="element" type="element">
>>      <alternative test="@name" type="localElement"/>
>>      <alternative test="@ref" type="elementRef"/>
>>      <alternative type="error"/>
>> </element>
>>
>> as a way to define the schema "element" element, so that it must have a
>> name or a ref.  This is not something XSD 1.0 would allow.
>>
>> There's also a case where you're using subset V of large shared
>> vocabulary P, and want to forbid element E in V when it is optional in P;
>>
>> <override schemaLocation="main.path.to.V">
>>      <element name="E" type="error"/>
>>      <!--* other elements can be excluded here by the same method ... *-->
>> </override>
>>
>> That thread also has the cheerful acknowledgement that anything you can
>> do in XSD 1.1 with xs:error you can also do with assertions, but
>> xs:error is preferred for style and legibility.
>>
>> -- Graydon
>>
>
>
>
> --
> 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? :)
> -------------------------------------
> I finally figured out the only reason to be alive is to enjoy it.



-- 
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? :)
-------------------------------------
I finally figured out the only reason to be alive is to enjoy it.


Current Thread
Keywords