W3C home > Mailing lists > Public > public-exi@w3.org > May 2008

RE: [EXI] Clarification required regarding use of types

From: santhanakrishnan <santhana@huawei.com>
Date: Thu, 15 May 2008 19:44:31 +0530
To: 'Taki Kamiya' <tkamiya@us.fujitsu.com>, public-exi@w3.org
Message-id: <005c01c8b695$ff349e80$4a18120a@china.huawei.com>
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 14:15:49 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:52:42 UTC