Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: inheritance problem (newbie)

From: George Cristian Bina <george@----.-->
To: Jan Limpens <jan.limpens@-----.--->
Date: 9/17/2004 5:52:00 PM
Hi Jan,

 > don't know what to do now. I already stole the idea from
 > http://www.xmlpatterns.com/ExtensibleContentModelMain.shtml, but as it
 > seems this is not working...

That sample seems to be based on an older version of XML Schema, see:

<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema"

while the current version defines http://www.w3.org/2001/XMLSchema as 
the XML Schema namespace.

You probably want something along the lines:

base.xsd:
=========
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
targetNamespace="http://limpens.com/blogbase"
     xmlns="http://limpens.com/blogbase" elementFormDefault="qualified">
     <xs:element name="BlogInfo">
         <xs:complexType>
             <xs:sequence>
                 <xs:element name="BlogTitle" type="xs:string"/>
                 <xs:element name="BlogDescription" type="xs:string"/>
                 <xs:element ref="Entry" minOccurs="0" 
maxOccurs="unbounded"/>
             </xs:sequence>
             <xs:attribute name="lang" type="xs:language"/>
         </xs:complexType>
     </xs:element>
     <xs:complexType name="EntryType">
         <xs:sequence>
             <xs:element name="Title"/>
             <xs:element name="Body">
                 <xs:complexType>
                     <xs:sequence>
                         <xs:element name="Para" maxOccurs="unbounded"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
         </xs:sequence>
         <xs:attribute name="lang" type="xs:language"/>
         <xs:attribute name="pubdate" type="xs:dateTime"/>
     </xs:complexType>
     <xs:element name="Entry" type="EntryType"/>
     <xs:element name="Blog">
         <xs:complexType>
             <xs:sequence>
                 <xs:element ref="BlogInfo"/>
             </xs:sequence>
         </xs:complexType>
     </xs:element>
</xs:schema>

derived.xsd
===========
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     targetNamespace="http://limpens.com/blog/illustrationblog" 
xmlns="http://limpens.com/blog/illustrationblog"
     elementFormDefault="qualified" xmlns:bb="http://limpens.com/blogbase">

     <xs:import namespace="http://limpens.com/blogbase" 
schemaLocation="base.xsd"/>

     <xs:element name="ImageEntry" type="ImageEntryType"/>

     <xs:complexType name="ImageEntryType">
         <xs:complexContent>
             <xs:extension base="bb:EntryType">
                 <xs:sequence>
                     <xs:element name="SlideShow">
                         <xs:complexType>
                             <xs:sequence>
                                 <xs:element name="Image" 
maxOccurs="unbounded">
                                     <xs:complexType>
                                         <xs:sequence>
                                             <xs:element name="ImageTitle"/>
                                             <xs:element 
name="ImageDescription"/>
                                             <xs:element name="ImageUrl"/>
                                         </xs:sequence>
                                     </xs:complexType>
                                 </xs:element>
                             </xs:sequence>
                         </xs:complexType>
                     </xs:element>
                 </xs:sequence>
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>
</xs:schema>


sample.xml
==========
<?xml version="1.0" encoding="UTF-8"?>
<ImageEntry xmlns="http://limpens.com/blog/illustrationblog"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://limpens.com/blog/illustrationblog 
file:/F:/test/derived.xsd">
     <Title xmlns="http://limpens.com/blogbase"></Title>
     <Body xmlns="http://limpens.com/blogbase">
         <Para></Para>
     </Body>
     <SlideShow>
         <Image>
             <ImageTitle></ImageTitle>
             <ImageDescription></ImageDescription>
             <ImageUrl></ImageUrl>
         </Image>
     </SlideShow>
</ImageEntry>

Hope that helps,
George
-----------------------------------------------
George Cristian Bina
<oXygen/> XML Editor & XSLT Editor/Debugger
www.---.com

From nobody@w... Fri Sep 17 12:05:25 2004
Received: from wiggum.w3.org ([128.30.52.23])
	by frink.w3.org with esmtp (Exim 4.34)
	id 1C8HUT-0004h


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