RE: [EXI] Clarification required regarding use of types

Hi Santhanakrishnan,

It is xs:string instead of not TypeUri that has named sub-types in your
example. Therefore, a production of event AT(xsi:type) should be added to
to MyString_0, not to MyUri_0.

This is so as to pemit the use of xsi:type with MyString element,
such as shown below.

<MyString xsi:type="TypeUri">urn:foo</MyString>

When there are two productions one with event CH and the other with event
AT(xsi:type) that share the same left-hand-side non-terminal, both
productions are still useful. Since xsi:type is supposed to be the first
attribute, and if it occurs, grammar jump occurs immediately. If the first
attribute is not xsi:type, no grammar jump occur for the element and the
production of CH event is there to be invoked next.

Hope it helps,

-taki


________________________________

From: santhanakrishnan [mailto:santhana@huawei.com]
Sent: Thursday, May 15, 2008 7:15 AM
To: 'Taki Kamiya'; public-exi@w3.org
Subject: RE: [EXI] Clarification required regarding use of types



Hi Taki

    Thank u very much for your explanation. Please confirm my understanding.

For the below schema definition

<xs:element name="MyString" type="xs:string" minOccurs="0"/>

<xs:element name="MyUri" type="TypeUri" minOccurs="0"/>



The element MyString would be defined as

MyString_0:

       xs:string_0



Grammar for xs:string

xs:string_0:

       CH [schema-valid-value] xs:string_1

xs:string_1:

       EE



MyString will become like this finally

MyString_0:

       CH [schema-valid-value] xs:string_1

Assuming strict mode as type of MyString does not have a named sub type I would not add the AT(xsi:type) production to its
definition.

But for element MyUri, I would have to define as

MyUri_0:

       TypeUri_0

Applying from TypeUri grammar

MyUri_0:

       CH [schema-valid-value] Type_Uri_1

As type of MyUri has named sub type I would add the AT(xsi:type) production to its definition.

Finally MyUri would be defined as

MyUri_0:

       CH [schema-valid-value] Type_Uri_1

       AT(xsi:type) MyUri_0

Am I correct till here?

The CH production in MyUri_0 does not add much value here as the proper grammar would be loaded when AT(xsi:type) event occurs.

Please confirm my understanding here. If I still have some misunderstanding, any explanation with good example will help me a lot.



Regards

Santhanakrishnan



-----Original Message-----
From: public-exi-request@w3.org [mailto:public-exi-request@w3.org] On Behalf Of Taki Kamiya
Sent: Thursday, May 15, 2008 5:56 AM
To: santhana@huawei.com; public-exi@w3.org
Subject: RE: [EXI] Clarification required regarding use of types





Hi Santhanakrishnan,



In schema-informed grammars, there are two kinds of CH events

for use with simple types, which are CH [schema-valid value] and

CH [schema-invalid value].



Character data that matched CH [schema-valid value] is represented

in EXI stream as a typed value using one of the EXI built-in datatypes.

See "Table 7-1 Built-in EXI Datatypes" for the relationship between

schema datatypes and EXI built-in datatypes, which you can find at:

http://www.w3.org/TR/exi/#builtInEXITypes



In the case of the production "TypeUri_0: CH [schema-valid-value] TypeUri_1",

because the production was generated from simple type "TypeUri",

when character data matches that production, the character data is

represented according to schema type "TypeUri". Because TypeUri

is derived from xsd:string, it is represented using EXI built-in datatype

"String".



xsi:type causes to switch the grammar to the one generated from

the type that it refers to, if the type is given definition in the schema.

See XML Schema specification for the semantics of xsi:type at:

http://www.w3.org/TR/xmlschema-1/#xsi_type

EXI processes xsi:type in order to permit any schema-valid document

to be represented as an EXI stream. Without being aware of xsi:type,

schema-valid documents that use xsi:type would not be able to be

represented by EXI. When strict option is true, a production of xsi:type

is added only when the schema permits the its use, that is, when

the type of the element has named subtypes. When strict option is

false, that production is always added to the element grammar.



Hope it helps,



-taki





________________________________



From: public-exi-request@w3.org [mailto:public-exi-request@w3.org] On Behalf Of santhanakrishnan

Sent: Wednesday, May 14, 2008 7:30 AM

To: john.schneider@agiledelta.com; public-exi@w3.org

Subject: RE: [EXI] Clarification required regarding use of types







Hi John



Thank you very much for your clarification

Some parts are still not clear to me.



Consider the following case.



Suppose I have the following schema definition.

(shown below is a segment of schema)



    .....



    <xs:simpleType name="TypeUri" final="list restriction">

           <xs:restriction base="xs:anyURI"/>

    </xs:simpleType>



    <xs:element name="MyUri" type="TypeUri" minOccurs="0"/>



    <xs:element name="MyString" type="xs:string" minOccurs="0"/>



    .....







For this I would have a grammar like this.



For Simple Type Definition TypeUri



TypeUri_0:

           CH [schema-valid-value] TypeUri_1



TypeUri_1:

           EE



TypeUri_Empty_0:

           EE







For element MyUri



MyUri_0:

           TypeUri_0







For element MyString



MyString_0:

           xs:string_0



As there is no grammar available for xs:string we will define one like this



xs:string_0:

           CH [schema-valid-value] xs:string_1



xs:string_0:

           EE



xs:string_Empty_0:

           EE







After all this grammar definitions still there is some ambiguity in the definition

of TypeUri. It is lacking the schema basic type information unlike the xs:string

type. Only when I know the schema basic type I can perform the low level

encoding/decoding of the value as per that.



Also the specification talks about adding production AT(xsi:type) to the

element grammar when it is of some named sub type. What is the significance

of this AT(xsi:type) event ?  How and when it has to be generated ?



Please clarify me in this regard and help me in resolving the confusion.





Thanks in advance,



Santhanakrishnan

Received on Thursday, 15 May 2008 15:50:42 UTC