Note that there are some explanatory texts on larger screens.

plurals
  1. POXSD extend a complex type
    text
    copied!<p>I'm trying to extend an existing complextype in a XSD file.</p> <p>I have created a new xsd file and included it at the end of all the master XSD files includes.</p> <p>The problem I'm having is that it seems to add my extension but it removes the existing elements other than those defined in asset_abstract</p> <p>Is what I'm trying to do possible?</p> <p>Code I don't want to modify</p> <pre><code>&lt;xs:complexType name="Feature_Cadastre_Lot" abstract="false"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;Represents the boundary of a titled, or proposed lot&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="asset_abstract"&gt; &lt;xs:sequence minOccurs="1" maxOccurs="1"&gt; &lt;xs:element name="LotNo" type="String_32" minOccurs="1" maxOccurs="1" nillable="false"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;The lot number as described on the originating survey plan&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:element&gt; &lt;xs:element name="PlanNo" type="String_32" minOccurs="1" maxOccurs="1" nillable="false"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;The plan number of the originating survey plan.&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:element&gt; &lt;xs:element name="CancelledLotPlan" type="String_32" minOccurs="1" maxOccurs="1" nillable="true"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;The lot on plan cancelled by this boundary if applicable.&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:element&gt; &lt;xs:element name="TitledArea_sqm" type="Float_Positive_NonZero" minOccurs="1" maxOccurs="1" nillable="false"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;The area in square metres enclosed by the boundary, as described by the survey plan.&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:element&gt; &lt;xs:element name="Geometry" type="geometry_area_multipatch_simple" minOccurs="1" maxOccurs="1" nillable="false"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;The geometry of this feature in coordinate space. May contain holes and islands. Boundaries must consist of straight lines.&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; </code></pre> <p></p> <p>Code I can import to extend the scheme.</p> <pre><code> &lt;xs:complexType name="Feature_Cadastre_Lot"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="asset_abstract"&gt; &lt;xs:sequence&gt; &lt;xs:element name="LMS_ID_1" type="String_32" minOccurs="1" maxOccurs="1" nillable="false"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;The Land Management System ID as defined by the LMS Team&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:element&gt; &lt;xs:element name="LMS_ID_2" type="String_32" minOccurs="1" maxOccurs="1" nillable="false"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;The Land Management System ID as defined by the LMS Team&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; </code></pre> <p></p> <p>OK I've created a bare bones exmaple and I still can't get it to work now using visual studio as I wanna make sure its not the tool :) , I still can't get it too work as yours is :( I must be missing something.</p> <p>Basically I've added 2 files Master.xsd and local.xsd Master wraps the remote project I can't / don't want to modify direct and local.xsd is where all our site specific stuff (redefining as it is called).</p> <p>Master.xsd</p> <pre><code> &lt;?xml version="1.0"?&gt; &lt;xs:schema version="1.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xs:include schemaLocation="project.xsd"&gt; &lt;/xs:include&gt; &lt;xs:include schemaLocation="local.xsd"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;A File I can add my overwrites to&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:include&gt; &lt;/xs:schema&gt; </code></pre> <p>project.xsd</p> <pre><code> &lt;?xml version="1.0"?&gt; &lt;xs:schema version="1.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xs:include schemaLocation="remote.xsd"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;A File that contains the complexType I want to add elments to. But not modify otherwise&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:include&gt; &lt;xs:element name="Master_Project"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;The Project.&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="ProjectData"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="ExistingElement" type="ExistingElementType"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;An Existing Element That I would Like To Add To.&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre> <p>local.xsd</p> <pre><code> &lt;?xml version="1.0"?&gt; &lt;xs:schema version="1.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xs:redefine schemaLocation="./remote.xsd"&gt; &lt;xs:complexType name="ExistingElementType"&gt; &lt;xs:complexContent&gt; &lt;xs:extension base="ExistingElementType"&gt; &lt;xs:sequence&gt; &lt;xs:element name="newTest"/&gt; &lt;/xs:sequence&gt; &lt;/xs:extension&gt; &lt;/xs:complexContent&gt; &lt;/xs:complexType&gt; &lt;/xs:redefine&gt; &lt;/xs:schema&gt; </code></pre> <p>remote.xsd</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;xs:schema version="1.0.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xs:complexType name="ExistingElementType"&gt; &lt;xs:sequence&gt; &lt;xs:element name="someProperty"/&gt; &lt;xs:element name="someSecondProperty"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:schema&gt; </code></pre> <p>And where I do all the redefining eventually.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload