- From: Lachlan Hunt <lhunt07@postoffice.csu.edu.au>
- Date: Thu, 20 Nov 2003 03:51:29 +1100
- To: Robert Koberg <rob@koberg.com>
- Cc: W3C HTML List <www-html@w3.org>
Robert Koberg wrote: > On Nov 19, 2003, at 7:45 AM, Christian Wolfgang Hujer wrote: > >> Am Mittwoch, 19. November 2003 12:47 schrieb Lachlan Hunt: >> >>> Actually, what I should have asked previously is: Is there anyway, >>> using an XML Schema, to specify that the content model is to be >>> inherited from its parent element?. >>> ie. No matter where <script> and <noscript> elements occur, we don't >>> want elements inside <noscript> that would not normally be allowed to >>> occur within the parent element. >> > I am jumping in late (just saw the thread), you can use a complexType > to get inheritance. For example: > > <xs:complexType name="BaseNode"> > <xs:sequence> > <xs:group ref="name:core.elems"/> > </xs:sequence> > <xs:attributeGroup ref="name:core.attrs"/> > </xs:complexType> > > <xs:complexType name="ParentNode"> > <xs:complexContent> > <xs:extension base="name:BaseNode"> > <xs:sequence> > <xs:element ref="name:ChildNode"/> > </xs:sequence> > </xs:extension> > </xs:complexContent> > </xs:complexType> > > <xs:complexType name="ChildNode"> > <xs:complexContent> > <xs:extension base="name:BaseNode"> > <xs:sequence> > <xs:element ref="name:SomethingElse"/> > </xs:sequence> > </xs:extension> > </xs:complexContent> > </xs:complexType> > > Is that what you are talking about? That could be, I haven't learnt about schemas yet, so I cant check myself. I'll use examples to demonstrate what I asked, so you or someone else can check for me. Please ignore the fact that there isn't actually and <script> elements used with the <noscript> elements here. Example 1: <!ELEMENT p (PCDATA | Inline | List | blockcode | blockquote | pre | table)*> <!-- Legal --> <p>This is a paragraph with <noscript><pre>block content</pre></noscript></p> <!-- Illegal --> <p>This is a paragraph with <noscript><p>nested paragraph</p></noscript></p> Example 2: <!ELEMENT span (PCDATA | Inline)*> <!-- Legal --> <span>this is a span with <noscript><strong>inline content</strong></noscript></span> <!-- Illegal --> <span>this is a span with <noscript><pre>block content</pre></noscript></span> The noscript element should inherit the content model of its parent. For example 1, the content model will become equivalent to: <!ELEMENT noscript (PCDATA | Inline | List | blockcode | blockquote | pre | table)*> And, for example 2, the content model will become equivalent to: <!ELEMENT noscript (PCDATA | Inline)*> So, basically, I'm asking, is it possible to have a dynamic content model for an element? CYA ...Lachy
Received on Wednesday, 19 November 2003 11:51:24 UTC