[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Elements declaration with same name in same complexType a

  • From: "Shlomo Yona" <S.Yona@F...>
  • To: "Michael Kay" <mike@s...>,<xml-dev@l...>
  • Date: Tue, 29 May 2007 07:38:02 -0700

RE:  Elements declaration with same name in same  complexType a

Thanks a lot.

This does indeed help.

 

Shlomo.

 


From: Michael Kay [mailto:mike@s...]
Sent:
â 29 îàé 2007 16:55
To: Shlomo Yona; xml-dev@l...
Subject: RE: Elements declaration with same name in same complexType and name qualification

 

Yes, it's valid. It would be valid even if you changed the third particle to

 

<xsd:element name="b" form="unqualified" type="xsd:int"/>

 

because although the two "b" elements now have different types, they also have different names - one is qualified and the other isn't.

 

The clause that I think you are worried about is:

 

Schema Component Constraint: Element Declarations Consistent

If the http://www.w3.org/TR/xmlschema-1/#particles contains, either directly, indirectly (that is, within the http://www.w3.org/TR/xmlschema-1/#particles of a contained model group, recursively) or http://www.w3.org/TR/xmlschema-1/#key-impl-cont two or more element declaration particles with the same http://www.w3.org/TR/xmlschema-1/#e-name and http://www.w3.org/TR/xmlschema-1/#e-target_namespace, then all their type definitions must be the same top-level definition,

 

and in this case, your two element declaration particles have a different {target namespace}, so the rule doesn't apply.

 

If you change the content model to

 

                     <xsd:sequence>

                                <xsd:element name="b"/>

                                <xsd:element name="c"/>

                                <xsd:element name="b"/>

                        </xsd:sequence>

 

Then it's still valid because the two "b" elements both have the same type. (It's not 100% clear that xs:anyType is a "top-level" type definition - the term "top-level" doesn't seem to be defined anywhere - but the rule as quoted above is followed by further explanation which makes it clear). 

 

Michael Kay

http://www.saxonica.com/

 


From: Shlomo Yona [mailto:S.Yona@F...]
Sent: 29 May 2007 14:13
To: xml-dev@l...
Subject: Elements declaration with same name in same complexType and name qualification

Hello,

 

Is the following considered valid or not?

 

Schema:

 

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="foo" xmlns="foo">

        <xsd:element name="a">

                <xsd:complexType>

                        <xsd:sequence>

                                <xsd:element name="b"/>

                                <xsd:element name="c"/>

                                <xsd:element name="b" form="unqualified"/>

                        </xsd:sequence>

                </xsd:complexType>

        </xsd:element>

</xsd:schema>

 

 

Instance:

 

<bar:a xmlns:bar="foo">

      <bar:b/>

      <bar:c/>

      <b/>

</bar:a>

 

I think it should be valid because the two local declarations of the element b have the same data type, anyType, in this case. I could not feel confident with my understanding, though, as I did not read that this is OK in the standard.

 

Thanks.

 

Shlomo.



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


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.