Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » key/keyref does not validate with recursion?
key/keyref does not validate with recursion? [message #485136] Thu, 10 September 2009 15:22 Go to next message
Toan is currently offline Toan
Messages: 36
Registered: July 2009
Member
Hi everyone,
Is it true that key/keyref does not validate with recursion? I have this
question because that when I validate the following xml file, the
validation of an element defined with recursion doesn't work. Following is
xml and the corresponding xsd file. Thanks in advance!
Toan.

xsd file :

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="CompositeType" type="CompositeType" />
<xsd:element name="Model" type="Model">
<!-- CompositeTypeKey/KeyRef -->
<xsd:key name="CompositeTypeKey">
<xsd:selector
xpath=".//CompositeType" />
<xsd:field xpath="./typeName" />
</xsd:key>
<xsd:keyref name="CompositeTypeRef" refer="CompositeTypeKey">
<xsd:selector
xpath=".//Attribute/CompositeTypeReference" />
<xsd:field xpath="." />
</xsd:keyref>
</xsd:element>

<xsd:complexType name="CompositeType">
<xsd:sequence>
<xsd:element minOccurs="0" name="typeName"
type="xsd:string" />
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="Attribute" type="Attribute" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Attribute">
<xsd:sequence>
<xsd:element minOccurs="0" name="name" type="xsd:string" />
<xsd:choice minOccurs="1">
<xsd:element minOccurs="1" maxOccurs="1"
name="CompositeType" type="CompositeType" />
<xsd:element minOccurs="1" maxOccurs="1"
name="CompositeTypeReference" type="xsd:string" />
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Model">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="CompositeType" type="CompositeType" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>

xml file :

<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="test.xsd" >
<CompositeType>
<typeName>Bozo</typeName>
</CompositeType>
<CompositeType>
<typeName>MyData</typeName>
<Attribute>
<name>b</name>
<CompositeTypeReference>Bozo</CompositeTypeReference>
</Attribute>
<Attribute>
<name>d</name>
<CompositeType>
<typeName>CustomData</typeName>
</CompositeType>
</Attribute>
<Attribute>
<name>n</name>
<CompositeType>
<typeName>NewData</typeName>
<Attribute>
<name>m</name>
<CompositeTypeReference>My</CompositeTypeReference>
</Attribute>
<Attribute>
<name>c</name>
<CompositeTypeReference>Custom</CompositeTypeReference>
</Attribute>
</CompositeType>
</Attribute>
</CompositeType>
</Model>

Notice that when validate if the validation of recursion works, there will
be two errors at :
<CompositeTypeReference>My</CompositeTypeReference>
<CompositeTypeReference>Custom</CompositeTypeReference>
because the right references are :
<CompositeTypeReference>MyData</CompositeTypeReference>
<CompositeTypeReference>CustomData</CompositeTypeReference >
Re: key/keyref does not validate with recursion? [message #485151 is a reply to message #485136] Thu, 10 September 2009 15:37 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26050
Registered: July 2009
Senior Member
Toan,

It's probably better to ask this question on a Xerces forum because the
XSD model doesn't provide support validation of XML instances only
support for validating XSD instances themselves.

Toan wrote:
> Hi everyone,
> Is it true that key/keyref does not validate with recursion? I have
> this question because that when I validate the following xml file, the
> validation of an element defined with recursion doesn't work.
> Following is xml and the corresponding xsd file. Thanks in advance!
> Toan.
>
> xsd file :
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:element name="CompositeType" type="CompositeType" />
> <xsd:element name="Model" type="Model">
> <!-- CompositeTypeKey/KeyRef -->
> <xsd:key name="CompositeTypeKey">
> <xsd:selector
> xpath=".//CompositeType" />
> <xsd:field xpath="./typeName" />
> </xsd:key>
> <xsd:keyref name="CompositeTypeRef" refer="CompositeTypeKey">
> <xsd:selector
> xpath=".//Attribute/CompositeTypeReference" />
> <xsd:field xpath="." />
> </xsd:keyref>
> </xsd:element>
>
> <xsd:complexType name="CompositeType">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="typeName"
> type="xsd:string" />
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="Attribute" type="Attribute" />
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="Attribute">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="name" type="xsd:string" />
> <xsd:choice minOccurs="1">
> <xsd:element minOccurs="1" maxOccurs="1"
> name="CompositeType" type="CompositeType" />
> <xsd:element minOccurs="1" maxOccurs="1"
> name="CompositeTypeReference" type="xsd:string" />
> </xsd:choice>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="Model">
> <xsd:sequence>
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="CompositeType" type="CompositeType" />
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
> xml file :
>
> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
> <Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="test.xsd" >
> <CompositeType>
> <typeName>Bozo</typeName>
> </CompositeType>
> <CompositeType>
> <typeName>MyData</typeName>
> <Attribute>
> <name>b</name>
> <CompositeTypeReference>Bozo</CompositeTypeReference>
> </Attribute>
> <Attribute>
> <name>d</name>
> <CompositeType>
> <typeName>CustomData</typeName>
> </CompositeType>
> </Attribute>
> <Attribute>
> <name>n</name>
> <CompositeType>
> <typeName>NewData</typeName>
> <Attribute>
> <name>m</name>
> <CompositeTypeReference>My</CompositeTypeReference>
> </Attribute>
> <Attribute>
> <name>c</name>
> <CompositeTypeReference>Custom</CompositeTypeReference>
> </Attribute>
> </CompositeType>
> </Attribute>
> </CompositeType>
> </Model>
>
> Notice that when validate if the validation of recursion works, there
> will be two errors at :
> <CompositeTypeReference>My</CompositeTypeReference>
> <CompositeTypeReference>Custom</CompositeTypeReference>
> because the right references are :
> <CompositeTypeReference>MyData</CompositeTypeReference>
> <CompositeTypeReference>CustomData</CompositeTypeReference >
>
>
Re: key/keyref does not validate with recursion? [message #485282 is a reply to message #485151] Fri, 11 September 2009 07:55 Go to previous messageGo to next message
Toan is currently offline Toan
Messages: 36
Registered: July 2009
Member
Ed,
I'm sorry because I don't know the link of Xerces forum in order to post
this question. Can you please inform it to me? Thanks.
Toan.

Ed Merks wrote:

> Toan,

> It's probably better to ask this question on a Xerces forum because the
> XSD model doesn't provide support validation of XML instances only
> support for validating XSD instances themselves.

> Toan wrote:
>> Hi everyone,
>> Is it true that key/keyref does not validate with recursion? I have
>> this question because that when I validate the following xml file, the
>> validation of an element defined with recursion doesn't work.
>> Following is xml and the corresponding xsd file. Thanks in advance!
>> Toan.
>>
>> xsd file :
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> <xsd:element name="CompositeType" type="CompositeType" />
>> <xsd:element name="Model" type="Model">
>> <!-- CompositeTypeKey/KeyRef -->
>> <xsd:key name="CompositeTypeKey">
>> <xsd:selector
>> xpath=".//CompositeType" />
>> <xsd:field xpath="./typeName" />
>> </xsd:key>
>> <xsd:keyref name="CompositeTypeRef" refer="CompositeTypeKey">
>> <xsd:selector
>> xpath=".//Attribute/CompositeTypeReference" />
>> <xsd:field xpath="." />
>> </xsd:keyref>
>> </xsd:element>
>>
>> <xsd:complexType name="CompositeType">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" name="typeName"
>> type="xsd:string" />
>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>> name="Attribute" type="Attribute" />
>> </xsd:sequence>
>> </xsd:complexType>
>> <xsd:complexType name="Attribute">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" name="name" type="xsd:string" />
>> <xsd:choice minOccurs="1">
>> <xsd:element minOccurs="1" maxOccurs="1"
>> name="CompositeType" type="CompositeType" />
>> <xsd:element minOccurs="1" maxOccurs="1"
>> name="CompositeTypeReference" type="xsd:string" />
>> </xsd:choice>
>> </xsd:sequence>
>> </xsd:complexType>
>> <xsd:complexType name="Model">
>> <xsd:sequence>
>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>> name="CompositeType" type="CompositeType" />
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:schema>
>>
>> xml file :
>>
>> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
>> <Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:noNamespaceSchemaLocation="test.xsd" >
>> <CompositeType>
>> <typeName>Bozo</typeName>
>> </CompositeType>
>> <CompositeType>
>> <typeName>MyData</typeName>
>> <Attribute>
>> <name>b</name>
>> <CompositeTypeReference>Bozo</CompositeTypeReference>
>> </Attribute>
>> <Attribute>
>> <name>d</name>
>> <CompositeType>
>> <typeName>CustomData</typeName>
>> </CompositeType>
>> </Attribute>
>> <Attribute>
>> <name>n</name>
>> <CompositeType>
>> <typeName>NewData</typeName>
>> <Attribute>
>> <name>m</name>
>> <CompositeTypeReference>My</CompositeTypeReference>
>> </Attribute>
>> <Attribute>
>> <name>c</name>
>> <CompositeTypeReference>Custom</CompositeTypeReference>
>> </Attribute>
>> </CompositeType>
>> </Attribute>
>> </CompositeType>
>> </Model>
>>
>> Notice that when validate if the validation of recursion works, there
>> will be two errors at :
>> <CompositeTypeReference>My</CompositeTypeReference>
>> <CompositeTypeReference>Custom</CompositeTypeReference>
>> because the right references are :
>> <CompositeTypeReference>MyData</CompositeTypeReference>
>> <CompositeTypeReference>CustomData</CompositeTypeReference >
>>
>>
Re: key/keyref does not validate with recursion? [message #485361 is a reply to message #485282] Fri, 11 September 2009 13:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26050
Registered: July 2009
Senior Member
Toan,

I don't know either, but I find Google searches quite effective. No
doubt it's at Apache somewhere...


Toan wrote:
> Ed,
> I'm sorry because I don't know the link of Xerces forum in order to
> post this question. Can you please inform it to me? Thanks.
> Toan.
>
> Ed Merks wrote:
>
>> Toan,
>
>> It's probably better to ask this question on a Xerces forum because
>> the XSD model doesn't provide support validation of XML instances
>> only support for validating XSD instances themselves.
>
>> Toan wrote:
>>> Hi everyone,
>>> Is it true that key/keyref does not validate with recursion? I have
>>> this question because that when I validate the following xml file,
>>> the validation of an element defined with recursion doesn't work.
>>> Following is xml and the corresponding xsd file. Thanks in advance!
>>> Toan.
>>>
>>> xsd file :
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>> <xsd:element name="CompositeType" type="CompositeType" />
>>> <xsd:element name="Model" type="Model">
>>> <!-- CompositeTypeKey/KeyRef -->
>>> <xsd:key name="CompositeTypeKey">
>>> <xsd:selector
>>> xpath=".//CompositeType" />
>>> <xsd:field xpath="./typeName" />
>>> </xsd:key>
>>> <xsd:keyref name="CompositeTypeRef" refer="CompositeTypeKey">
>>> <xsd:selector
>>> xpath=".//Attribute/CompositeTypeReference" />
>>> <xsd:field xpath="." />
>>> </xsd:keyref>
>>> </xsd:element>
>>>
>>> <xsd:complexType name="CompositeType">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="0" name="typeName"
>>> type="xsd:string" />
>>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>>> name="Attribute" type="Attribute" />
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> <xsd:complexType name="Attribute">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="0" name="name" type="xsd:string" />
>>> <xsd:choice minOccurs="1">
>>> <xsd:element minOccurs="1" maxOccurs="1"
>>> name="CompositeType" type="CompositeType" />
>>> <xsd:element minOccurs="1" maxOccurs="1"
>>> name="CompositeTypeReference" type="xsd:string" />
>>> </xsd:choice>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> <xsd:complexType name="Model">
>>> <xsd:sequence>
>>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>>> name="CompositeType" type="CompositeType" />
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> </xsd:schema>
>>>
>>> xml file :
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
>>> <Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:noNamespaceSchemaLocation="test.xsd" >
>>> <CompositeType>
>>> <typeName>Bozo</typeName>
>>> </CompositeType>
>>> <CompositeType>
>>> <typeName>MyData</typeName>
>>> <Attribute>
>>> <name>b</name>
>>> <CompositeTypeReference>Bozo</CompositeTypeReference>
>>> </Attribute>
>>> <Attribute>
>>> <name>d</name>
>>> <CompositeType>
>>> <typeName>CustomData</typeName>
>>> </CompositeType>
>>> </Attribute>
>>> <Attribute>
>>> <name>n</name>
>>> <CompositeType>
>>> <typeName>NewData</typeName>
>>> <Attribute>
>>> <name>m</name>
>>> <CompositeTypeReference>My</CompositeTypeReference>
>>> </Attribute>
>>> <Attribute>
>>> <name>c</name>
>>> <CompositeTypeReference>Custom</CompositeTypeReference>
>>> </Attribute>
>>> </CompositeType>
>>> </Attribute>
>>> </CompositeType>
>>> </Model>
>>>
>>> Notice that when validate if the validation of recursion works,
>>> there will be two errors at :
>>> <CompositeTypeReference>My</CompositeTypeReference>
>>> <CompositeTypeReference>Custom</CompositeTypeReference>
>>> because the right references are :
>>> <CompositeTypeReference>MyData</CompositeTypeReference>
>>> <CompositeTypeReference>CustomData</CompositeTypeReference >
>>>
>>>
>
>
Re: key/keyref does not validate with recursion? [message #485376 is a reply to message #485361] Fri, 11 September 2009 14:15 Go to previous message
Toan is currently offline Toan
Messages: 36
Registered: July 2009
Member
Hi Ed,
Ok, I'll search, thanks anyway.
Toan.

Ed Merks wrote:

> Toan,

> I don't know either, but I find Google searches quite effective. No
> doubt it's at Apache somewhere...


> Toan wrote:
>> Ed,
>> I'm sorry because I don't know the link of Xerces forum in order to
>> post this question. Can you please inform it to me? Thanks.
>> Toan.
>>
>> Ed Merks wrote:
>>
>>> Toan,
>>
>>> It's probably better to ask this question on a Xerces forum because
>>> the XSD model doesn't provide support validation of XML instances
>>> only support for validating XSD instances themselves.
>>
>>> Toan wrote:
>>>> Hi everyone,
>>>> Is it true that key/keyref does not validate with recursion? I have
>>>> this question because that when I validate the following xml file,
>>>> the validation of an element defined with recursion doesn't work.
>>>> Following is xml and the corresponding xsd file. Thanks in advance!
>>>> Toan.
>>>>
>>>> xsd file :
>>>>
>>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>> <xsd:element name="CompositeType" type="CompositeType" />
>>>> <xsd:element name="Model" type="Model">
>>>> <!-- CompositeTypeKey/KeyRef -->
>>>> <xsd:key name="CompositeTypeKey">
>>>> <xsd:selector
>>>> xpath=".//CompositeType" />
>>>> <xsd:field xpath="./typeName" />
>>>> </xsd:key>
>>>> <xsd:keyref name="CompositeTypeRef" refer="CompositeTypeKey">
>>>> <xsd:selector
>>>> xpath=".//Attribute/CompositeTypeReference" />
>>>> <xsd:field xpath="." />
>>>> </xsd:keyref>
>>>> </xsd:element>
>>>>
>>>> <xsd:complexType name="CompositeType">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="0" name="typeName"
>>>> type="xsd:string" />
>>>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>>>> name="Attribute" type="Attribute" />
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> <xsd:complexType name="Attribute">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="0" name="name" type="xsd:string" />
>>>> <xsd:choice minOccurs="1">
>>>> <xsd:element minOccurs="1" maxOccurs="1"
>>>> name="CompositeType" type="CompositeType" />
>>>> <xsd:element minOccurs="1" maxOccurs="1"
>>>> name="CompositeTypeReference" type="xsd:string" />
>>>> </xsd:choice>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> <xsd:complexType name="Model">
>>>> <xsd:sequence>
>>>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>>>> name="CompositeType" type="CompositeType" />
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> </xsd:schema>
>>>>
>>>> xml file :
>>>>
>>>> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
>>>> <Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xsi:noNamespaceSchemaLocation="test.xsd" >
>>>> <CompositeType>
>>>> <typeName>Bozo</typeName>
>>>> </CompositeType>
>>>> <CompositeType>
>>>> <typeName>MyData</typeName>
>>>> <Attribute>
>>>> <name>b</name>
>>>> <CompositeTypeReference>Bozo</CompositeTypeReference>
>>>> </Attribute>
>>>> <Attribute>
>>>> <name>d</name>
>>>> <CompositeType>
>>>> <typeName>CustomData</typeName>
>>>> </CompositeType>
>>>> </Attribute>
>>>> <Attribute>
>>>> <name>n</name>
>>>> <CompositeType>
>>>> <typeName>NewData</typeName>
>>>> <Attribute>
>>>> <name>m</name>
>>>> <CompositeTypeReference>My</CompositeTypeReference>
>>>> </Attribute>
>>>> <Attribute>
>>>> <name>c</name>
>>>> <CompositeTypeReference>Custom</CompositeTypeReference>
>>>> </Attribute>
>>>> </CompositeType>
>>>> </Attribute>
>>>> </CompositeType>
>>>> </Model>
>>>>
>>>> Notice that when validate if the validation of recursion works,
>>>> there will be two errors at :
>>>> <CompositeTypeReference>My</CompositeTypeReference>
>>>> <CompositeTypeReference>Custom</CompositeTypeReference>
>>>> because the right references are :
>>>> <CompositeTypeReference>MyData</CompositeTypeReference>
>>>> <CompositeTypeReference>CustomData</CompositeTypeReference >
>>>>
>>>>
>>
>>
Re: key/keyref does not validate with recursion? [message #604359 is a reply to message #485136] Thu, 10 September 2009 15:37 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26050
Registered: July 2009
Senior Member
Toan,

It's probably better to ask this question on a Xerces forum because the
XSD model doesn't provide support validation of XML instances only
support for validating XSD instances themselves.

Toan wrote:
> Hi everyone,
> Is it true that key/keyref does not validate with recursion? I have
> this question because that when I validate the following xml file, the
> validation of an element defined with recursion doesn't work.
> Following is xml and the corresponding xsd file. Thanks in advance!
> Toan.
>
> xsd file :
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:element name="CompositeType" type="CompositeType" />
> <xsd:element name="Model" type="Model">
> <!-- CompositeTypeKey/KeyRef -->
> <xsd:key name="CompositeTypeKey">
> <xsd:selector
> xpath=".//CompositeType" />
> <xsd:field xpath="./typeName" />
> </xsd:key>
> <xsd:keyref name="CompositeTypeRef" refer="CompositeTypeKey">
> <xsd:selector
> xpath=".//Attribute/CompositeTypeReference" />
> <xsd:field xpath="." />
> </xsd:keyref>
> </xsd:element>
>
> <xsd:complexType name="CompositeType">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="typeName"
> type="xsd:string" />
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="Attribute" type="Attribute" />
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="Attribute">
> <xsd:sequence>
> <xsd:element minOccurs="0" name="name" type="xsd:string" />
> <xsd:choice minOccurs="1">
> <xsd:element minOccurs="1" maxOccurs="1"
> name="CompositeType" type="CompositeType" />
> <xsd:element minOccurs="1" maxOccurs="1"
> name="CompositeTypeReference" type="xsd:string" />
> </xsd:choice>
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="Model">
> <xsd:sequence>
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="CompositeType" type="CompositeType" />
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
> xml file :
>
> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
> <Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:noNamespaceSchemaLocation="test.xsd" >
> <CompositeType>
> <typeName>Bozo</typeName>
> </CompositeType>
> <CompositeType>
> <typeName>MyData</typeName>
> <Attribute>
> <name>b</name>
> <CompositeTypeReference>Bozo</CompositeTypeReference>
> </Attribute>
> <Attribute>
> <name>d</name>
> <CompositeType>
> <typeName>CustomData</typeName>
> </CompositeType>
> </Attribute>
> <Attribute>
> <name>n</name>
> <CompositeType>
> <typeName>NewData</typeName>
> <Attribute>
> <name>m</name>
> <CompositeTypeReference>My</CompositeTypeReference>
> </Attribute>
> <Attribute>
> <name>c</name>
> <CompositeTypeReference>Custom</CompositeTypeReference>
> </Attribute>
> </CompositeType>
> </Attribute>
> </CompositeType>
> </Model>
>
> Notice that when validate if the validation of recursion works, there
> will be two errors at :
> <CompositeTypeReference>My</CompositeTypeReference>
> <CompositeTypeReference>Custom</CompositeTypeReference>
> because the right references are :
> <CompositeTypeReference>MyData</CompositeTypeReference>
> <CompositeTypeReference>CustomData</CompositeTypeReference >
>
>
Re: key/keyref does not validate with recursion? [message #604360 is a reply to message #485151] Fri, 11 September 2009 07:55 Go to previous message
Toan is currently offline Toan
Messages: 36
Registered: July 2009
Member
Ed,
I'm sorry because I don't know the link of Xerces forum in order to post
this question. Can you please inform it to me? Thanks.
Toan.

Ed Merks wrote:

> Toan,

> It's probably better to ask this question on a Xerces forum because the
> XSD model doesn't provide support validation of XML instances only
> support for validating XSD instances themselves.

> Toan wrote:
>> Hi everyone,
>> Is it true that key/keyref does not validate with recursion? I have
>> this question because that when I validate the following xml file, the
>> validation of an element defined with recursion doesn't work.
>> Following is xml and the corresponding xsd file. Thanks in advance!
>> Toan.
>>
>> xsd file :
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>> <xsd:element name="CompositeType" type="CompositeType" />
>> <xsd:element name="Model" type="Model">
>> <!-- CompositeTypeKey/KeyRef -->
>> <xsd:key name="CompositeTypeKey">
>> <xsd:selector
>> xpath=".//CompositeType" />
>> <xsd:field xpath="./typeName" />
>> </xsd:key>
>> <xsd:keyref name="CompositeTypeRef" refer="CompositeTypeKey">
>> <xsd:selector
>> xpath=".//Attribute/CompositeTypeReference" />
>> <xsd:field xpath="." />
>> </xsd:keyref>
>> </xsd:element>
>>
>> <xsd:complexType name="CompositeType">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" name="typeName"
>> type="xsd:string" />
>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>> name="Attribute" type="Attribute" />
>> </xsd:sequence>
>> </xsd:complexType>
>> <xsd:complexType name="Attribute">
>> <xsd:sequence>
>> <xsd:element minOccurs="0" name="name" type="xsd:string" />
>> <xsd:choice minOccurs="1">
>> <xsd:element minOccurs="1" maxOccurs="1"
>> name="CompositeType" type="CompositeType" />
>> <xsd:element minOccurs="1" maxOccurs="1"
>> name="CompositeTypeReference" type="xsd:string" />
>> </xsd:choice>
>> </xsd:sequence>
>> </xsd:complexType>
>> <xsd:complexType name="Model">
>> <xsd:sequence>
>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>> name="CompositeType" type="CompositeType" />
>> </xsd:sequence>
>> </xsd:complexType>
>> </xsd:schema>
>>
>> xml file :
>>
>> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
>> <Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:noNamespaceSchemaLocation="test.xsd" >
>> <CompositeType>
>> <typeName>Bozo</typeName>
>> </CompositeType>
>> <CompositeType>
>> <typeName>MyData</typeName>
>> <Attribute>
>> <name>b</name>
>> <CompositeTypeReference>Bozo</CompositeTypeReference>
>> </Attribute>
>> <Attribute>
>> <name>d</name>
>> <CompositeType>
>> <typeName>CustomData</typeName>
>> </CompositeType>
>> </Attribute>
>> <Attribute>
>> <name>n</name>
>> <CompositeType>
>> <typeName>NewData</typeName>
>> <Attribute>
>> <name>m</name>
>> <CompositeTypeReference>My</CompositeTypeReference>
>> </Attribute>
>> <Attribute>
>> <name>c</name>
>> <CompositeTypeReference>Custom</CompositeTypeReference>
>> </Attribute>
>> </CompositeType>
>> </Attribute>
>> </CompositeType>
>> </Model>
>>
>> Notice that when validate if the validation of recursion works, there
>> will be two errors at :
>> <CompositeTypeReference>My</CompositeTypeReference>
>> <CompositeTypeReference>Custom</CompositeTypeReference>
>> because the right references are :
>> <CompositeTypeReference>MyData</CompositeTypeReference>
>> <CompositeTypeReference>CustomData</CompositeTypeReference >
>>
>>
Re: key/keyref does not validate with recursion? [message #604364 is a reply to message #485282] Fri, 11 September 2009 13:45 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26050
Registered: July 2009
Senior Member
Toan,

I don't know either, but I find Google searches quite effective. No
doubt it's at Apache somewhere...


Toan wrote:
> Ed,
> I'm sorry because I don't know the link of Xerces forum in order to
> post this question. Can you please inform it to me? Thanks.
> Toan.
>
> Ed Merks wrote:
>
>> Toan,
>
>> It's probably better to ask this question on a Xerces forum because
>> the XSD model doesn't provide support validation of XML instances
>> only support for validating XSD instances themselves.
>
>> Toan wrote:
>>> Hi everyone,
>>> Is it true that key/keyref does not validate with recursion? I have
>>> this question because that when I validate the following xml file,
>>> the validation of an element defined with recursion doesn't work.
>>> Following is xml and the corresponding xsd file. Thanks in advance!
>>> Toan.
>>>
>>> xsd file :
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>> <xsd:element name="CompositeType" type="CompositeType" />
>>> <xsd:element name="Model" type="Model">
>>> <!-- CompositeTypeKey/KeyRef -->
>>> <xsd:key name="CompositeTypeKey">
>>> <xsd:selector
>>> xpath=".//CompositeType" />
>>> <xsd:field xpath="./typeName" />
>>> </xsd:key>
>>> <xsd:keyref name="CompositeTypeRef" refer="CompositeTypeKey">
>>> <xsd:selector
>>> xpath=".//Attribute/CompositeTypeReference" />
>>> <xsd:field xpath="." />
>>> </xsd:keyref>
>>> </xsd:element>
>>>
>>> <xsd:complexType name="CompositeType">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="0" name="typeName"
>>> type="xsd:string" />
>>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>>> name="Attribute" type="Attribute" />
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> <xsd:complexType name="Attribute">
>>> <xsd:sequence>
>>> <xsd:element minOccurs="0" name="name" type="xsd:string" />
>>> <xsd:choice minOccurs="1">
>>> <xsd:element minOccurs="1" maxOccurs="1"
>>> name="CompositeType" type="CompositeType" />
>>> <xsd:element minOccurs="1" maxOccurs="1"
>>> name="CompositeTypeReference" type="xsd:string" />
>>> </xsd:choice>
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> <xsd:complexType name="Model">
>>> <xsd:sequence>
>>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>>> name="CompositeType" type="CompositeType" />
>>> </xsd:sequence>
>>> </xsd:complexType>
>>> </xsd:schema>
>>>
>>> xml file :
>>>
>>> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
>>> <Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:noNamespaceSchemaLocation="test.xsd" >
>>> <CompositeType>
>>> <typeName>Bozo</typeName>
>>> </CompositeType>
>>> <CompositeType>
>>> <typeName>MyData</typeName>
>>> <Attribute>
>>> <name>b</name>
>>> <CompositeTypeReference>Bozo</CompositeTypeReference>
>>> </Attribute>
>>> <Attribute>
>>> <name>d</name>
>>> <CompositeType>
>>> <typeName>CustomData</typeName>
>>> </CompositeType>
>>> </Attribute>
>>> <Attribute>
>>> <name>n</name>
>>> <CompositeType>
>>> <typeName>NewData</typeName>
>>> <Attribute>
>>> <name>m</name>
>>> <CompositeTypeReference>My</CompositeTypeReference>
>>> </Attribute>
>>> <Attribute>
>>> <name>c</name>
>>> <CompositeTypeReference>Custom</CompositeTypeReference>
>>> </Attribute>
>>> </CompositeType>
>>> </Attribute>
>>> </CompositeType>
>>> </Model>
>>>
>>> Notice that when validate if the validation of recursion works,
>>> there will be two errors at :
>>> <CompositeTypeReference>My</CompositeTypeReference>
>>> <CompositeTypeReference>Custom</CompositeTypeReference>
>>> because the right references are :
>>> <CompositeTypeReference>MyData</CompositeTypeReference>
>>> <CompositeTypeReference>CustomData</CompositeTypeReference >
>>>
>>>
>
>
Re: key/keyref does not validate with recursion? [message #604366 is a reply to message #485361] Fri, 11 September 2009 14:15 Go to previous message
Toan is currently offline Toan
Messages: 36
Registered: July 2009
Member
Hi Ed,
Ok, I'll search, thanks anyway.
Toan.

Ed Merks wrote:

> Toan,

> I don't know either, but I find Google searches quite effective. No
> doubt it's at Apache somewhere...


> Toan wrote:
>> Ed,
>> I'm sorry because I don't know the link of Xerces forum in order to
>> post this question. Can you please inform it to me? Thanks.
>> Toan.
>>
>> Ed Merks wrote:
>>
>>> Toan,
>>
>>> It's probably better to ask this question on a Xerces forum because
>>> the XSD model doesn't provide support validation of XML instances
>>> only support for validating XSD instances themselves.
>>
>>> Toan wrote:
>>>> Hi everyone,
>>>> Is it true that key/keyref does not validate with recursion? I have
>>>> this question because that when I validate the following xml file,
>>>> the validation of an element defined with recursion doesn't work.
>>>> Following is xml and the corresponding xsd file. Thanks in advance!
>>>> Toan.
>>>>
>>>> xsd file :
>>>>
>>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>>> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
>>>> <xsd:element name="CompositeType" type="CompositeType" />
>>>> <xsd:element name="Model" type="Model">
>>>> <!-- CompositeTypeKey/KeyRef -->
>>>> <xsd:key name="CompositeTypeKey">
>>>> <xsd:selector
>>>> xpath=".//CompositeType" />
>>>> <xsd:field xpath="./typeName" />
>>>> </xsd:key>
>>>> <xsd:keyref name="CompositeTypeRef" refer="CompositeTypeKey">
>>>> <xsd:selector
>>>> xpath=".//Attribute/CompositeTypeReference" />
>>>> <xsd:field xpath="." />
>>>> </xsd:keyref>
>>>> </xsd:element>
>>>>
>>>> <xsd:complexType name="CompositeType">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="0" name="typeName"
>>>> type="xsd:string" />
>>>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>>>> name="Attribute" type="Attribute" />
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> <xsd:complexType name="Attribute">
>>>> <xsd:sequence>
>>>> <xsd:element minOccurs="0" name="name" type="xsd:string" />
>>>> <xsd:choice minOccurs="1">
>>>> <xsd:element minOccurs="1" maxOccurs="1"
>>>> name="CompositeType" type="CompositeType" />
>>>> <xsd:element minOccurs="1" maxOccurs="1"
>>>> name="CompositeTypeReference" type="xsd:string" />
>>>> </xsd:choice>
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> <xsd:complexType name="Model">
>>>> <xsd:sequence>
>>>> <xsd:element maxOccurs="unbounded" minOccurs="0"
>>>> name="CompositeType" type="CompositeType" />
>>>> </xsd:sequence>
>>>> </xsd:complexType>
>>>> </xsd:schema>
>>>>
>>>> xml file :
>>>>
>>>> <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
>>>> <Model xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>>> xsi:noNamespaceSchemaLocation="test.xsd" >
>>>> <CompositeType>
>>>> <typeName>Bozo</typeName>
>>>> </CompositeType>
>>>> <CompositeType>
>>>> <typeName>MyData</typeName>
>>>> <Attribute>
>>>> <name>b</name>
>>>> <CompositeTypeReference>Bozo</CompositeTypeReference>
>>>> </Attribute>
>>>> <Attribute>
>>>> <name>d</name>
>>>> <CompositeType>
>>>> <typeName>CustomData</typeName>
>>>> </CompositeType>
>>>> </Attribute>
>>>> <Attribute>
>>>> <name>n</name>
>>>> <CompositeType>
>>>> <typeName>NewData</typeName>
>>>> <Attribute>
>>>> <name>m</name>
>>>> <CompositeTypeReference>My</CompositeTypeReference>
>>>> </Attribute>
>>>> <Attribute>
>>>> <name>c</name>
>>>> <CompositeTypeReference>Custom</CompositeTypeReference>
>>>> </Attribute>
>>>> </CompositeType>
>>>> </Attribute>
>>>> </CompositeType>
>>>> </Model>
>>>>
>>>> Notice that when validate if the validation of recursion works,
>>>> there will be two errors at :
>>>> <CompositeTypeReference>My</CompositeTypeReference>
>>>> <CompositeTypeReference>Custom</CompositeTypeReference>
>>>> because the right references are :
>>>> <CompositeTypeReference>MyData</CompositeTypeReference>
>>>> <CompositeTypeReference>CustomData</CompositeTypeReference >
>>>>
>>>>
>>
>>
Previous Topic:key/keyref does not validate with recursion?
Next Topic:Unable to load mixed content when loading an ecore model derived from an xml schema
Goto Forum:
  


Current Time: Fri Sep 19 01:54:08 GMT 2014

Powered by FUDForum. Page generated in 0.02273 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software