Hi Sandy,
I'm sorry for the confusion, It is incredible how difficult the XML schema
terminology is, I really don't seem to be able to express myself.
What I'd like to get is the actual type of the validated data instance
(the type annotation).
for example, consider the following schema fragment:
<xsd:simpleType name="valList">
<xsd:list>
<xsd:simpleType>
<xsd:union memberTypes="xsd:int xsd:float xsd:string"/>
</xsd:simpleType>
</xsd:list>
</xsd:simpleType>
<xsd:attribute name="index" type="valList" default="0"/>
given an instance:
<someElement index = "1 two 3.5 5 seventytwo"/>
I'd like to obtain the list of types: "int string float int string". From
what I've seen in Xerces there isn't currently any way of getting there...
Thank you very much for your help, cheers,
- Fabio
On Monday, June 17, 2002, at 07:36 AM, [EMAIL PROTECTED] wrote:
> So you meant getting the member type that's used to validate an instance
> data. In that case, no method defined on the XS???Type??? interfaces can
> help, because they only expose properties of the types. But such
> information is available via PSVI. "AttributePSVI" and "ElementPSVI" (both
> derived from "ItemPSVI") have a method called "getMemberTypeDefinition",
> which, in the case the value was validated against a union type, returns
> the member type that actually validated the value.
>
> But if you have a list type, whose item type is the first union in your
> example (first "int", then "string"), and your value looks like "a 1 b 2"
> ,
> then after validation, the actual value will look like
> {string("a"), int(1), string("b"), int(2)}
> But there is no way to know which member type was used to validate a
> certain item in the list, because the spec didn't require us to do so.
>
> Cheers,
> Sandy Gao
> Software Developer, IBM Canada
> (1-905) 413-3255
> [EMAIL PROTECTED]
>
>
>
>
> Fabio Riccardi
> <[EMAIL PROTECTED] To: [EMAIL PROTECTED]
> org
> m> cc:
> Subject: Re:
> XSListSimpleType missing [was: [PSVI] full support
> 06/15/2002 is available]
> 02:08 AM
> Please respond
> to
> xerces-j-dev
>
>
>
>
>
> The way XML Schema is defined, it depends on how you declare the type:
>
> <xsd:union>
> <xsd:simpleType>
> <xsd:restriction base="xsd:int"/>
> </xsd:simpleType>
> <xsd:simpleType>
> <xsd:restriction base="xsd:string"/>
> </xsd:simpleType>
> </xsd:union>
>
> will match '1' as an int, instead:
>
> <xsd:union>
> <xsd:simpleType>
> <xsd:restriction base="xsd:string"/>
> </xsd:simpleType>
> <xsd:simpleType>
> <xsd:restriction base="xsd:int"/>
> </xsd:simpleType>
> </xsd:union>
>
> will always return a string.
>
> I've actually tried this in Xerces and it produces the correct actualValue
> according to the input. Returning the actual type shouldn't be difficult
> at all...
>
> - Fabio
>
> On Friday, June 14, 2002, at 09:15 PM, Andy Clark wrote:
>
>> Fabio Riccardi wrote:
>>> From what I can understand of the spec:
>>> "getMemberTypes()" returns the list of the types in the union
>>> declaration.
>>> At least this is what is currently being returned...
>>> "getItemType()" should instead return the actual validated type of the
>>> particular instance of the elements of the list.
>>
>> If the datatype is a union of xsd:string and xsd:integer,
>> what types should be returned from the following?
>>
>> <example value='1'/>
>>
>> "1" can be considered an integer and a string. Which
>> type should be reported for this data value? I don't
>> think it's wise for the parser to "guess" which one
>> is intended.
>>
>> -- Andy Clark * [EMAIL PROTECTED]
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]