OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

sca-assembly message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [sca-assembly] Issue 14 - more on XML Schema....



Ashok,

I find the statement "the derivation of simple types from xs:anyType is not clearly
spelled out" somewhat surprising.

The following (which will probably appear as an attachment in most email systems) is
from the XML Schema Spec, Part 2:

3 Built-in datatypes
Diagram of built-in type hierarchy


This diagram clearly shows that "anyType" is the root of the datatype hierarchy, containing both all
simple Types and all complex Types.

The following statement about anyType is in Part 1 of the XML Schema spec, section 3.4.7:

"The mixed content specification together with the lax wildcard and attribute specification produce the
defining property for the ·ur-type definition·, namely that every type definition is (eventually) a restriction
of the ·ur-type definition·: its permissions and requirements are (nearly) the least restrictive possible. "

...note the statement "every type definition is a restriction" ...of the anyType, since this section is a
definition of anyType.

So, I contend that an element defined in the SCA schema like:

<xs:element name="value" type="xs:anyType"/>

...can literally have any content, including simple types, complex types and mixed content.

...and that an instance of value can then restrict the type using the xs:type attribute:

<value xs:type="ns:foo"> ...whatever type foo allows...   </value>

since the type ns:foo is necessarily a restriction of anyType, by definition.


...but I'm no XML expert and my brain hurts now...

Yours,  Mike.

Strategist - Emerging Technologies, SCA & SDO.
Co Chair OASIS SCA Assembly TC.
IBM Hursley Park, Mail Point 146, Winchester, SO21 2JN, Great Britain.
Phone & FAX: +44-1962-818014    Mobile: +44-7802-467431  
Email:  mike_edwards@uk.ibm.com



ashok malhotra <ashok.malhotra@oracle.com>

09/04/2008 13:38
Please respond to
ashok.malhotra@oracle.com

To
Anish Karmarkar <Anish.Karmarkar@oracle.com>
cc
"'OASIS Assembly'" <sca-assembly@lists.oasis-open.org>
Subject
Re: [sca-assembly] Issue 14





Hi Anish:

If you are using a Schema 1.0 processor you need to use xs:anySimpleType
instead of xs:anyAtomicType.

In theory, you can define <value> as xs:anyType and then use xsi:type to
specify a complexType or a simpleType.
The problem is that the derivation of simple types from xs:anyType is
not clearly spelled out and so some processors
may not accept it.  My proposal was conservative.  If we find that most
Schema processors accept it this design then
let's go for it.

In your solution below, you had to specify a simpleType with content
that is a restriction of xs:string or a complexType
with simple content of type xs:string.  If you want to go in this
direction you would have to define types for each Schema datatype.
I was hoping to avoid that.

Ashok

Anish Karmarkar wrote:
> Ashok,
>
> I didn't see a xs:anyAtomicType at
> http://www.w3.org/TR/xmlschema-2/#built-in-datatypes
> Is this something that is in the next version of schema?
>
> I was trying to find out about the restriction that you are talking
> about in schema. I couldn't. Can you send me a pointer? Thx.
>
> I tried the following using XMLSpy 2006 sp2 --
>
> XSD:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> targetNamespace="http://example.org/test"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>     <xs:element name="value" type="xs:anyType"/>
>     <xs:simpleType name="st">
>         <xs:restriction base="xs:string"></xs:restriction>
>     </xs:simpleType>
>     <xs:complexType name="ct">
>         <xs:simpleContent>
>             <xs:extension base="xs:string">
>               <xs:attribute name="attr" type="xs:string"/>
>             </xs:extension>
>         </xs:simpleContent>
>     </xs:complexType>
> </xs:schema>
>
> XML instance with simple type:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <value xmlns="http://example.org/test"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://example.org/test
>                            assembly_issue_14.xsd"
>        xsi:type="st">
> some string value
> </value>
>
> XML instance with complex type:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <value xmlns="http://example.org/test"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://example.org/test
>                            assembly_issue_14.xsd"
>        xsi:type="ct"
>        attr="some attr value">
> some element value
> </value>
>
> It worked the way I was hoping to work. Validating both the XML
> documents above and not validating XML documents that do not conform
> to the declared xsi:type value.
>
> -Anish
> --
>
> ashok malhotra wrote:
>> Here is a proposal that will work.
>>
>> Define an element called <ComplexValue> that has Schema type xs:anyType.
>> Use xsi:Type to indicate the precise complex type used.
>>
>> Define an element called <SimpleValue> that has Schema type
>> xs:anyAtomicType.
>> Use xsi:Type to indicate the precise type used.
>>
>> I'll talk with my Schema colleagues to see if we can get away with a
>> single value type.


--
All the best, Ashok

---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that
generates this mail.  You may a link to this group and all your TCs in OASIS
at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php








Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 741598.
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU








[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]