Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Element ordering not according to XSD (with several files)
Element ordering not according to XSD (with several files) [message #1060658] Mon, 27 May 2013 10:42
kon f is currently offline kon f
Messages: 33
Registered: March 2012
Member
Hey,

I found this post. I extended the example being able to include several xsd files (useful if the schema is big and needs to be spread over several xsd files). I use include because I want to contribute to the same namespace.

On the given example, I just moved the type definition to a separate xsd file.

schema.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://www.roded.com/xsdtestcase" xmlns="http://www.roded.com/xsdtestcase">
	<xs:include schemaLocation="type.xsd" />
	<xs:element name="XSDTestCaseModel" type="XSDTestCaseModelType" />
</xs:schema>


type.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	targetNamespace="http://www.roded.com/xsdtestcase" xmlns="http://www.roded.com/xsdtestcase"
	elementFormDefault="qualified">
	<xs:complexType name="XSDTestCaseModelType">
		<xs:sequence>
			<xs:element name="ValueA" type="xs:string"></xs:element>
			<xs:element name="ValueB" type="xs:string"></xs:element>
			<xs:element name="ValueC" type="xs:string"></xs:element>
		</xs:sequence>
	</xs:complexType>
</xs:schema>


IXSDTestCaseModel
package com.modelity.eclipse.structures.sapphire.report.xsdtestcase;

import org.eclipse.sapphire.modeling.IModelElement;
import org.eclipse.sapphire.modeling.ModelElementType;
import org.eclipse.sapphire.modeling.Value;
import org.eclipse.sapphire.modeling.ValueProperty;
import org.eclipse.sapphire.modeling.annotations.GenerateImpl;
import org.eclipse.sapphire.modeling.annotations.Label;
import org.eclipse.sapphire.modeling.xml.annotations.XmlNamespace;
import org.eclipse.sapphire.modeling.xml.annotations.XmlSchema;

@GenerateImpl
@XmlNamespace(uri = "http://www.roded.com/xsdtestcase")
@XmlSchema(namespace = "http://www.roded.com/xsdtestcase", location = "http://www.roded.com/xsdtestcase/1.0")
public interface IXSDTestCaseModel extends IModelElement {

    ModelElementType TYPE = new ModelElementType(IXSDTestCaseModel.class);

    // *** ValueA ***
    @Label(standard = "ValueA")
    ValueProperty PROP_VALUE_A = new ValueProperty(TYPE, "ValueA");

    Value<String> getValueA();

    void setValueA(String value);

    // *** ValueB ***
    @Label(standard = "ValueB")
    ValueProperty PROP_VALUE_B = new ValueProperty(TYPE, "ValueB");

    Value<String> getValueB();

    void setValueB(String value);

    // *** ValueA ***
    @Label(standard = "ValueC")
    ValueProperty PROP_VALUE_C = new ValueProperty(TYPE, "ValueC");

    Value<String> getValueC();

    void setValueC(String value);
}


plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension point="org.eclipse.ui.editors">
  <editor
    id="com.modelity.eclipse.structures.sapphire.report.xsdtestcase.IXSDTestCaseModel"
    name="test case xsd"
    filenames="xsdtestcase.xml"
    default="true">
    <class class="org.eclipse.sapphire.ui.swt.xml.editor.SapphireEditorForXml">
      <parameter name="sdef" value="com.modelity.eclipse.structures.sapphire.report.xsdtestcase.testcasemodel"/>
    </class>
  </editor>
</extension>
<extension
      point="org.eclipse.wst.xml.core.catalogContributions">
   <catalogContribution>
      <system
            systemId="http://www.roded.com/xsdtestcase/1.0"
            uri="schema/schema.xsd">
      </system>
   </catalogContribution>
</extension>
</plugin>


Am I doing something wrong? Thank you!

Kon
Previous Topic:Heterogeneous list with no common property
Goto Forum:
  


Current Time: Tue May 28 03:22:20 EDT 2013

Powered by FUDForum. Page generated in 0.07295 seconds