[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.tools.emf] Re: "Initialize by loading" & DocumentRoot

Fabrice,

The version I use locally is like this and I don't see any problems.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:lib="http://www.example.com/Library" targetNamespace="http://www.example.com/Library">

  <xsd:element name="library" type="lib:Library"/>

  <xsd:complexType name="Library">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="books" type="lib:Book"/>
      <xsd:element maxOccurs="unbounded" minOccurs="0" name="writers" type="lib:Writer"/>
      <xsd:element ref="lib:library"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Book">
    <xsd:sequence>
      <xsd:element name="title" type="xsd:string"/>
      <xsd:element name="pages" type="xsd:int"/>
      <xsd:element name="category" type="lib:BookCategory"/>
      <xsd:element ecore:opposite="books" ecore:reference="lib:Writer" name="author" type="xsd:anyURI"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="Writer">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
      <xsd:element ecore:reference="lib:Book" maxOccurs="unbounded" minOccurs="0" name="books" type="xsd:anyURI"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:simpleType name="BookCategory">
    <xsd:restriction base="xsd:NCName">
      <xsd:enumeration value="Mystery"/>
      <xsd:enumeration value="ScienceFiction"/>
      <xsd:enumeration value="Biography"/>
    </xsd:restriction>
  </xsd:simpleType>

</xsd:schema>



Fabrice Dubach wrote:
Ed,

Thanks for your helps.
You juste have to add an element declaration in the xsd before loading it, 
for exemple :
<xsd:element name="library" type="lib:Library"/>

Fabrice  Dubach