W3C home > Mailing lists > Public > xmlschema-dev@w3.org > August 2007

RE: redefining or restricting children of a predefined element

From: Mario Madunic <hajduk@imag.net>
Date: Mon, 20 Aug 2007 15:32:47 -0700
Message-ID: <1187649167.46ca168f8185a@members.uniserve.com>
To: Michael Kay <mike@saxonica.com>
Cc: xmlschema-dev@w3.org

Thanks Michael,

I'll go and make the necessary changes and the cozy up with a copy of XML Schema
1.1. I'm guessing I can't do this by defining a datatype via simple or complex
type, define the emphasis type as said named type, and them restrict there. This
is where I actually ran into trouble.

Marijan (Mario) Madunic

Quoting Michael Kay <mike@saxonica.com>:

> 
> The only way you can do this within XML Schema 1.0 is to have a local
> element emphasis within the content model of web, whose own content model is
> a restriction of the content model of the global web element.
> 
> Yes, that's not a very attractive proposition.
> 
> In XML Schema 1.1 you can have the complex type of web contain
> 
> <xs:assert test="not(.//web)"/>
> 
> Michael Kay
> http://www.saxonica.com/
> 
> 
> > -----Original Message-----
> > From: xmlschema-dev-request@w3.org 
> > [mailto:xmlschema-dev-request@w3.org] On Behalf Of Mario Madunic
> > Sent: 20 August 2007 16:51
> > To: xmlschema-dev@w3.org
> > Subject: redefining or restricting children of a predefined element
> > 
> > 
> > Any help with the following will be greatly apreciated.
> > 
> > I would like to change the emphasis child of web to not 
> > contain an instance of web itself. This is the sort of 
> > recursion I want to avoid. I've looked at redefine and 
> > restriction but seem to be missing something. I do not want 
> > to define a new emphasis element within web as it is already 
> > defined and want to do the restriction within web itself 
> > (<xs:element ref="emphasis" /> and used throughout the schema).
> > 
> > 
> > Here is a copy of the elements in question without the 
> > include statements. The child model is much bigger, children 
> > have been removed for brevity :) 
> > 
> > <xs:element name="web" id="web">
> >   <xs:complexType mixed="true">
> >     <xs:choice minOccurs="0" maxOccurs="unbounded">
> >       <xs:element ref="emphasis" />
> >       <xs:element ref="imageInline" />
> >       <xs:element ref="strong" />
> >     </xs:choice>
> >     <xs:attributeGroup ref="attributeStandardInlineGroup" />
> >     <xs:attribute name="uri" type="xs:anyURI" use="optional" />
> >     <xs:attribute ref="target" use="optional" />
> >   </xs:complexType>
> > </xs:element>
> > 
> > <xs:element name="emphasis" id="emphasis">
> >   <xs:complexType mixed="true">
> >     <xs:choice minOccurs="0" maxOccurs="unbounded">
> >       <xs:element ref="email" />
> >       <xs:element ref="strong" />
> >       <xs:element ref="web" />
> >     </xs:choice>
> >     <xs:attributeGroup ref="attributeInlineGroup" />
> >   </xs:complexType>
> > </xs:element>
> > 
> > Marijan (Mario) Madunic
> > 
> > 
> > 
> 
> 
> 
Received on Monday, 20 August 2007 22:33:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:00 GMT