[LC-2186] RE: [EXI LC comment] datatype representation map for a specific element

Hi Shimizu-san,

In order for only the content of element "b" but not "c" to be encoded
as your original representation, please define a new type derived from
xsd:float and use that type for element "b" so that the type can be
captured in the datatype representation map such as follows.

<datatypeRepresentationMap xmlns:mytypes="http://example.org/mytypes" xmlns:myenc="http://example.org/myenc">
  <mytypes:myfloat/>
  <myenc:myfloat/>
</datatypeRepresentationMap/>

where the type mytypes:myfloat would be defined such as follows.

<xsd:simpleType name="myfloat">
  <xsd:restriction base="xsd:float"/>
</xsd:simpleType>

<xsd:element name="b" type="mytypes:myfloat"/>


The first items in datatype representation map entry pairs identify types.
Types are in general considered more inherent to data than elements are.
For example, each atomic data value in a list has its immediate datatype,
whereas the containing element only indicates the list datatype. Thus, types
allow for finer control over the use of custom datatype representation. The
use of types in datatype representation map also has the beauty of insulating
element names from the nuisances of datatype representations. For example,
you can define two local elements of the same names, yet can allow them to
be encoded using different datatype representations by associating them with
different datatypes. This all comes with the slight burden of the need for
defining approproate types in the schema. It should be worth noting that when
you have a good reason for using different representations for two elements,
in general, they carry somewhat different semantics or expectation at some
level, which should justify the effort and the need to define a new type for
use in the datatype representation map for differentiating them.

Thanks!

-taki


-----Original Message-----
From: public-exi-comments-request@w3.org [mailto:public-exi-comments-request@w3.org] On Behalf Of SHIMIZU Wataru
Sent: Thursday, November 06, 2008 11:14 PM
To: public-exi-comments@w3.org
Cc: youenn.fablet@crf.canon.fr; fujisawa.jun@canon.co.jp
Subject: [LC-2186] [EXI LC comment] datatype representation map for a specific element


Hello EXI WG,

According to the specification, if I use a user-defined datatype
representation, I have to specify a datatype representation map. How do
I use my original encoding only for the specific element or attribute?

For example, I want to use my original float encoding only for b
elements.

<a>
  <b>1.2</b>  <!-- xsd:float -->
  <c>3.4</c>  <!-- xsd:float -->
</a>

If I define a datatype representation map as follows, c element will
aslo be encoded with myfloat encoding.

<datatypeRepresentationMap xmlns:myenc="http://example.org/myenc">
  <xsd:float/>
  <myenc:myfloat/>
</datatypeRepresentationMap/>

--
Wataru Shimizu
<shimizu.wataru@canon.co.jp>

Received on Wednesday, 15 April 2009 19:32:36 UTC