Intro
 FAQ
 Features
 Limitations
 The basics

 XSD vs Dingo
 Class Diagram
 NUnit Tests
 Java code
 SourceForge

 Plugins
 Custom Builders
 Tutorial
 quicktips

 Samples
   conversion
   dashSchema
   contact
   foobar
   geneology

 Links
  NUnit

Conversion

Files in contact sample:

  • ecommerce.cs - address book class
  • SalesRates.cs - sales rate class
  • stageRate.cs - contact class
  • conversion.csproj - VS.NET project file
  • conversion.sln - solution for project
  • Test - simple test class to load the sample data
  • Test2 - simple test class to load the sample data
  • xml - directory containing the schema and sample data
Step-by-step Instructions

  1. Open a DOS shell
  2. change to "Dingo/bin/" directory. Example: cd c:\Dingo\bin\
  3. copy sales.xsd to the bin directory
  4. copy substitution.xml from xml/ directory to bin/
  5. compile the schema with "dingo sales.xsd" command
  6. copy the generated files to "Dingo/samples/conversion/" directory and replace the existing files. The files should be the same.
  7. open the contact project
  8. open Test.cs class in VS.NET
  9. build the project
  10. open a second DOS shell
  11. change to "Dingo/samples/conversion/bin/" directory
  12. run the test with "conversion.exe" command
Two schemas are provided with this example.

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="ecommerce">
		<xs:annotation>
			<xs:documentation>Comment describing your root element</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="SalesRates" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="SalesRates">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="SalesRateID" type="xs:string"/>
				<xs:element name="Rate" type="xs:double"/>
				<xs:element name="Region" type="xs:string"/>
				<xs:element name="StageRate" type="stageRate" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="stageRate">
		<xs:sequence>
			<xs:element name="name" type="xs:string"/>
			<xs:element name="rate" type="xs:double"/>
		</xs:sequence>
	</xs:complexType>
</xs:schema>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:element name="ecommerce">
		<xs:annotation>
			<xs:documentation>Comment describing your root element</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="SalesRates" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="SalesRates">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="SalesRateID" type="xs:string"/>
				<xs:element name="Rate" type="xs:double"/>
				<xs:element name="Region" type="xs:string"/>
				<xs:element ref="stageRate" maxOccurs="unbounded"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="stageRate">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="name" type="xs:string"/>
				<xs:element name="rate" type="xs:double"/>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>
		

The primary difference between the two is the second uses elements with a local complexType. The first example references stageRate as a complexType. In both cases, the mapping in substitution.xml is "stageRate".

SourceForge.net Logo
Copyright 2004 Peter Lin