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


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


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