Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: [xml-dev] Substituting elements in a group for the group when redefining

From: "Allison Bloodworth" <abloodworth@--------.--->
To: "'George Cristian Bina'" <george@---------.--->,<xml-dev@-----.---.--->
Date: 10/5/2006 6:58:00 PM
Thanks again, George. I can't count the times you've helped me on this list!
You are just fantastic.

I hadn't noticed the extra sequence tags in your first message. I am not
sure what the closed sequence tag means or corresponds to (I'd love to
understand if you can explain it), but I believe that the third sequence tag
corresponds to the one inside the <xs:group name="ContactInfo"> element. I'm
not sure why you made it minOccurs="0", but I'm guessing that may be because
the group was minOccurs="0" in the ContactInfo element (<xs:group
ref="ev:ContactInfo" minOccurs="0"/>).

The problem is I don't want it to be minOccurs="0" because I want to make
"PhoneNumbers" required. I can make "PhoneNumbers" required in the
"ContactInfo" group, but if the sequence that contains it isn't required of
course the element isn't required. If I remove minOccurs="0" from this
<xs:sequence> then I get the error about there not being a complete
functional mapping between the particles (which makes no sense to me because
minOccurs="1" is more restricted than minOccurs="0").

I am so close! Any other ideas?

-----Original Message-----
From: George Cristian Bina [mailto:george@o...] 
Sent: Wednesday, October 04, 2006 5:07 AM
To: Allison Bloodworth
Cc: xml-dev@l...
Subject: Re: [xml-dev] Substituting elements in a group for the group when
redefining

Hi Allison,

As I said, all you have to do is to write the redefined type as

<xs:complexType name="PublicEventContactType">
     <xs:complexContent>
         <xs:restriction base="ev:PublicEventContactType">
             <xs:sequence>
                 <xs:sequence/>
                 <xs:sequence minOccurs="0">
                     <xs:element ref="ev:ContactName" minOccurs="0"/>
                     <xs:element ref="ev:ProfessionalAffiliations" 
minOccurs="0"/>
                     <xs:element ref="ev:Phones" minOccurs="0"/>
                     <xs:element ref="ev:EmailAddresses" minOccurs="0"/>
                     <xs:element ref="ev:Addresses" minOccurs="0"/>
                     <xs:element ref="ev:PreferredContactMethod" 
minOccurs="0"/>
                 </xs:sequence>
             </xs:sequence>
         </xs:restriction>
     </xs:complexContent>
</xs:complexType>

Below there are the documents I tested with:

test.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified"
   targetNamespace="http://www.example.com/ev" 
xmlns:ev="http://www.example.com/ev">

   <xs:element name="ContactName"/>
   <xs:element name="ProfessionalAffiliations"/>
   <xs:element name="Phones"/>
   <xs:element name="EmailAddresses"/>
   <xs:element name="Addresses"/>
   <xs:element name="WebPages"/>
   <xs:element name="PreferredContactMethod"/>
   <xs:group name="ContactInfo">
     <xs:sequence>
       <xs:element ref="ev:ContactName" minOccurs="0"/>
       <xs:element ref="ev:ProfessionalAffiliations" minOccurs="0"/>
       <xs:element ref="ev:Phones" minOccurs="0"/>
       <xs:element ref="ev:EmailAddresses" minOccurs="0"/>
       <xs:element ref="ev:Addresses" minOccurs="0"/>
       <xs:element ref="ev:WebPages" minOccurs="0"/>
       <xs:element ref="ev:PreferredContactMethod" minOccurs="0"/>
     </xs:sequence>
   </xs:group>

   <xs:element name="PublicEventContactID"/>
   <xs:element name="PublicEventContactTypes"/>
   <xs:element name="PublicEventContactParentID"/>
   <xs:complexType name="PublicEventContactType">
     <xs:sequence>
       <xs:element ref="ev:PublicEventContactID" minOccurs="0"/>
       <xs:group ref="ev:ContactInfo" minOccurs="0"/>
       <xs:element ref="ev:PublicEventContactTypes" minOccurs="0"/>
       <xs:element ref="ev:PublicEventContactParentID" minOccurs="0"/>
     </xs:sequence>
   </xs:complexType>
</xs:schema>

redef.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://www.example.com/ev"
     xmlns:ev="http://www.example.com/ev">
     <xs:redefine schemaLocation="test.xsd">
         <xs:complexType name="PublicEventContactType">
             <xs:complexContent>
                 <xs:restriction base="ev:PublicEventContactType">
                     <xs:sequence>
                         <xs:sequence/>
                         <xs:sequence minOccurs="0">
                             <xs:element ref="ev:ContactName" 
minOccurs="0"/>
                             <xs:element 
ref="ev:ProfessionalAffiliations" minOccurs="0"/>
                             <xs:element ref="ev:Phones" minOccurs="0"/>
                             <xs:element ref="ev:EmailAddresses" 
minOccurs="0"/>
                             <xs:element ref="ev:Addresses" minOccurs="0"/>
                             <xs:element ref="ev:PreferredContactMethod" 
minOccurs="0"/>
                         </xs:sequence>
                     </xs:sequence>
                 </xs:restriction>
             </xs:complexContent>
         </xs:complexType>
     </xs:redefine>
</xs:schema>

oXygen uses Xerces as the default processor. The Xerces version used in 
a specific oXygen version is listed in Help->About -- Components.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
www.---.com


Allison Bloodworth wrote:
> Hi George, 
> 
> Thanks much for your help. I'm using Oxygen 6.2 and I thought it used
Xerces
> 2.7.1 by default for validation, but I'm unable to find where to verify
that
> in Oxygen. I created full documents that I tried to validate in Oxygen and
> got the same errors: 
> 
> Description: E rcase-Recurse.2: There is not a complete functional mapping
> between the particles.
> URL: http://www.w3.org/TR/xmlschema-1/#rcase-Recurse
> 
> Description: E derivation-ok-restriction.5.4.2: Error for type
> 'PublicEventContactType'.  The particle of the type is not a valid
> restriction of the particle of the base.
> URL: http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction
> 
> How can I tell what XML processor Oxygen is using?
> 
> If I do validation of an instance at the command line using Xerces, I get
> the same thing:
> 
> java sax.Counter -v -s -f RedefineRestrictionTest.xml
> [Error] RedefineRestrictionTest2.xsd:4:51: rcase-Rcurse.2: There is not a
> complete functional mapping between the particles.
> [Error] RedefineRestrictionTest2.xsd:4:51:
derivation-ok-restriction.5.4.2:
> Error for type 'PublicEventContactType'. The particle is not a valid
> restriction of the particle of the base.
> RedefineRestrictionTest2.xml: 360 ms (7 elems, 1 attrs, 0 spaces, 55
chars)
> 
> How was the document you used (which was valid) different?
> 
> Here are the documents I used to validate:
> 
> Original:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ev="urn:cde.berkeley.edu:babl:events:1.00"
> targetNamespace="urn:cde.berkeley.edu:babl:events:1.00"
> elementFormDefault="qualified" attributeFormDefault="unqualified">
>     <xs:element name="ContactName" type="xs:string"/>
>     <xs:element name="ProfessionalAffiliations" type="xs:string"/>
>     <xs:element name="Phones" type="xs:string"/>
>     <xs:element name="EmailAddresses" type="xs:string"/>
>     <xs:element name="Addresses" type="xs:string"/>
>     <xs:element name="WebPages" type="xs:string"/>
>     <xs:element name="PreferredContactMethod" type="xs:string"/>
>     <xs:element name="PublicEventContactID" type="xs:string"/>
>     <xs:element name="PublicEventContactTypes" type="xs:string"/>
>     <xs:element name="PublicEventContactParentID" type="xs:string"/>    
>     <xs:group name="ContactInfo"> 
>         <xs:sequence> 
>             <xs:element ref="ev:ContactName" minOccurs="0"/> 
>             <xs:element ref="ev:ProfessionalAffiliations" minOccurs="0"/> 
>             <xs:element ref="ev:Phones" minOccurs="0"/> 
>             <xs:element ref="ev:EmailAddresses" minOccurs="0"/> 
>             <xs:element ref="ev:Addresses" minOccurs="0"/> 
>             <xs:element ref="ev:WebPages" minOccurs="0"/> 
>             <xs:element ref="ev:PreferredContactMethod" minOccurs="0"/> 
>         </xs:sequence> 
>     </xs:group> 
>     <xs:complexType name="PublicEventContactType"> 
>         <xs:sequence> 
>             <xs:element ref="ev:PublicEventContactID" minOccurs="0"/> 
>             <xs:group ref="ev:ContactInfo" minOccurs="0"/> 
>             <xs:element ref="ev:PublicEventContactTypes" minOccurs="0"/> 
>             <xs:element ref="ev:PublicEventContactParentID"
minOccurs="0"/> 
>         </xs:sequence> 
>     </xs:complexType> 
> </xs:schema>
> 
> Redefine:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:ev="urn:cde.berkeley.edu:babl:events:1.00"
> targetNamespace="urn:cde.berkeley.edu:babl:events:1.00"
> elementFormDefault="qualified" attributeFormDefault="unqualified">    
>     <xs:redefine schemaLocation="RedefineRestrictionTest1.xsd">
>     <xs:complexType name="PublicEventContactType"> 
>         <xs:complexContent> 
>             <xs:restriction base="ev:PublicEventContactType"> 
>                 <xs:sequence> 
>                     <!-- REMOVING THIS ELEMENT <xs:element
> ref="ev:PublicEventContactID" minOccurs="0"/> -->
>                     
>                     <xs:element ref="ev:ContactName" minOccurs="0"/> 
>                     <xs:element ref="ev:ProfessionalAffiliations"
> minOccurs="0"/> 
>                     <xs:element ref="ev:Phones" minOccurs="0"/> 
>                     <xs:element ref="ev:EmailAddresses" minOccurs="0"/> 
>                     <xs:element ref="ev:Addresses" minOccurs="0"/> 
>                     <!-- REMOVING THIS ELEMENT <xs:element
ref="ev:WebPages"
> minOccurs="0"/> -->
>                     
>                     <xs:element ref="ev:PreferredContactMethod"
> minOccurs="0"/> 
>                     <!-- REMOVING THIS ELEMENT <xs:element
> ref="ev:PublicEventContactTypes" minOccurs="0">
>                         
>                         </xs:element> --> 
>                     <!-- REMOVING THIS ELEMENT <xs:element
> ref="ev:PublicEventContactParentID" minOccurs="0">
>                         
>                         </xs:element> --> 
>                 </xs:sequence> 
>             </xs:restriction> 
>         </xs:complexContent> 
>     </xs:complexType> 
>    </xs:redefine>
> </xs:schema>
> 
> Instance:
> <?xml version="1.0" encoding="UTF-8"?>
> <PublicEventContact xmlns="urn:cde.berkeley.edu:babl:events:1.00"
>      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>      xsi:schemaLocation="urn:cde.berkeley.edu:babl:events:1.00
> RedefineRestrictionTest2.xsd">
>     <ContactName>Blah</ContactName>
>     <ProfessionalAffiliations>Blah</ProfessionalAffiliations>
>     <Phones>Blah</Phones>
>     <EmailAddresses>Blah</EmailAddresses>
>     <Addresses>Blah</Addresses>
>     <PreferredContactMethod>Blah</PreferredContactMethod>
> </PublicEventContact>
> 
> Thanks again, 
> Allison
> 
> -----Original Message-----
> From: George Cristian Bina [mailto:george@o...] 
> Sent: Tuesday, October 03, 2006 1:02 AM
> To: Allison Bloodworth
> Cc: xml-dev@l...
> Subject: Re: [xml-dev] Substituting elements in a group for the group when
> redefining
> 
> Hi Allison,
> 
> Xerces is happy with this equivalent model:
> 
> <xs:restriction base="ev:PublicEventContactType">
>      <xs:sequence>
>          <xs:sequence/>
>          <xs:sequence minOccurs="0">
>              <xs:element ref="ev:ContactName" minOccurs="0"/>
>              <xs:element ref="ev:ProfessionalAffiliations" minOccurs="0"/>
>              <xs:element ref="ev:Phones" minOccurs="0"/>
>              <xs:element ref="ev:EmailAddresses" minOccurs="0"/>
>              <xs:element ref="ev:Addresses" minOccurs="0"/>
>              <xs:element ref="ev:PreferredContactMethod" minOccurs="0"/>
>          </xs:sequence>
>      </xs:sequence>
> </xs:restriction>
> 
> The algorithm for determining if a type is a valid restriction of other 
> type as described in the spec is complicated and does not match always 
> what the intuition tells you that is a valid restriction.
> XSV and Saxon AFAIK implement a better algorithm for checking 
> restrictions, [1] I believe. This new algorithm probably will be 
> specified in XML Schema 1.1 - I think some people on the list can 
> confirm/infirm that.
> 
> [1] http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html
> 
> Best Regards,
> George
> ---------------------------------------------------------------------
> George Cristian Bina
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> www.---.com
> 
> 
> Allison Bloodworth wrote:
>> Hi, 
>>
>> I tried to search the archives at http://lists.xml.org/archives/xml-dev/
> on
>> this but got a message saying: The requested URL /cgi-bin/htsearch was
not
>> found on this server. I also did a search of the internet but
> unfortunately
>> am having trouble finding info on this situation the XML Schema spec.
>>
>> I would like to redefine an element (PublicEventContactType) that is
> defined
>> in a schema as containing a group called ContactInfo. I don't want to
>> redefine the group itself, as those changes would apply to a lot of other
>> elements where I don't want the change made, but just within this
>> PublicEventContactType element itself. You would think that this would be
>> something that XML Schema would support, but I am getting an error
message
>> from XMLSpy">XMLSpy 2005 saying, "The content model of complex type
>> 'ev:PublicEventContactType' is not a valid restriction of the content
> model
>> of complex type 'ev:PublicEventContactType' and a similar error in Oxygen
>> 6.2. 
>>
>> Is this really not possible? You would think I could substitute the
> elements
>> in the group for the group in the redefine...I do understand that I could
>> remove them here and put them back in in an extension, but that would
>> require another schema.
>>
>> Original:
>> 	<xs:group name="ContactInfo">
>> 		<xs:sequence>
>> 			<xs:element ref="ev:ContactName" minOccurs="0"/>
>> 			<xs:element ref="ev:ProfessionalAffiliations"
>> minOccurs="0"/>
>> 			<xs:element ref="ev:Phones" minOccurs="0"/>
>> 			<xs:element ref="ev:EmailAddresses" minOccurs="0"/>
>> 			<xs:element ref="ev:Addresses" minOccurs="0"/>
>> 			<xs:element ref="ev:WebPages" minOccurs="0"/>
>> 			<xs:element ref="ev:PreferredContactMethod"
>> minOccurs="0"/>
>> 		</xs:sequence>
>> 	</xs:group>
>> 	<xs:complexType name="PublicEventContactType">
>> 		<xs:sequence>
>> 			<xs:element ref="ev:PublicEventContactID"
>> minOccurs="0"/>
>> 			<xs:group ref="ev:ContactInfo" minOccurs="0"/>
>> 			<xs:element ref="ev:PublicEventContactTypes"
>> minOccurs="0"/>
>> 			<xs:element ref="ev:PublicEventContactParentID"
>> minOccurs="0">
>> 		</xs:sequence>
>> 	</xs:complexType>
>>
>> Redefine:
>> 		<xs:complexType name="PublicEventContactType">
>> 			<xs:complexContent>
>> 				<xs:restriction
>> base="ev:PublicEventContactType">
>> 					<xs:sequence>
>> 						<!-- REMOVING THIS ELEMENT
>> <xs:element ref="ev:PublicEventContactID" minOccurs="0"/> -->
>> 						<xs:element
>> ref="ev:ContactName" minOccurs="0"/>
>> 						<xs:element
>> ref="ev:ProfessionalAffiliations" minOccurs="0"/>
>> 						<xs:element ref="ev:Phones"
>> minOccurs="0"/>
>> 						<xs:element
>> ref="ev:EmailAddresses" minOccurs="0"/>
>> 						<xs:element
>> ref="ev:Addresses" minOccurs="0"/>
>> 						<!-- REMOVING THIS ELEMENT
>> <xs:element ref="ev:WebPages" minOccurs="0"/> -->
>> 						<xs:element
>> ref="ev:PreferredContactMethod" minOccurs="0"/>
>> 						<!-- REMOVING THIS ELEMENT
>> <xs:element ref="ev:PublicEventContactTypes" minOccurs="0">
>> 						</xs:element> -->
>> 						<!-- REMOVING THIS ELEMENT
>> <xs:element ref="ev:PublicEventContactParentID" minOccurs="0">
>> 						</xs:element> -->
>> 					</xs:sequence>
>> 				</xs:restriction>
>> 			</xs:complexContent>
>> 		</xs:complexType> 
>>
>> Thanks for your help,
>>
>> Allison Bloodworth
>> Principal Administrative Analyst
>> Technology Program Office
>> University of California, Berkeley
>> (415) 377-8243
>> abloodworth@b...
>>
>>
>>
>>
>> _______________________________________________________________________
>>
>> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
>> to support XML implementation and development. To minimize
>> spam in the archives, you must subscribe before posting.
>>
>> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
>> Or unsubscribe: xml-dev-unsubscribe@l...
>> subscribe: xml-dev-subscribe@l...
>> List archive: http://lists.xml.org/archives/xml-dev/
>> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
>>
> 
> _______________________________________________________________________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l...
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 
> 
> 
> _______________________________________________________________________
> 
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> 
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@l...
> subscribe: xml-dev-subscribe@l...
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php
> 

_______________________________________________________________________

XML-DEV is a publicly archived, unmoderated list hosted by OASIS
to support XML implementation and development. To minimize
spam in the archives, you must subscribe before posting.

[Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
Or unsubscribe: xml-dev-unsubscribe@l...
subscribe: xml-dev-subscribe@l...
List archive: http://lists.xml.org/archives/xml-dev/
List Guidelines: http://www.oasis-open.org/maillists/guidelines.php


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent