Creating and generating an XML Schema

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  UML Diagrams > Additional Diagrams > XML Schema Diagrams >

Creating and generating an XML Schema

You would generally import a schema, edit it in UModel, and output the changes. It is however possible to generate a schema from scratch. This will only be described in broad detail however.

 

 

To create a new schema in UModel:

1.Create a new package in the Model Tree e.g. MY-Schemas.

xsd-sc1

2.Right-click the new package and select the menu option Code Engineering | Set as XSD namespace root. You are asked if you want to assign the XSD profile if this is the first XSD Namespace root in the project.
3.Click OK to assign the profile.
4.Right-click the new package and select New Element | Package.
5.Double-click in the package name field and change it to the namespace you want to use, e.g. http://www.my-ns.com.
6.Click the <<namespace>> check box in the Properties tab, to define this as the target namespace.

xsd-sc2

7.Right-click the namespace package and select New diagram | XML Schema diagram. You will be prompted if you want to add the Schema diagram to a new XSD Schema.
8.Click Yes to add the new diagram.

xsd-sc3

You can now create your schema using the icons in the XML Schema icon bar.

 

 

To generate the XML schema:

1.Drag the XSDSchema onto a component to create a Component Realization.
2.Make sure that you set the code language of the component to XSD1.0, and enter a path for the generated schema to be placed in, e.g. C:\schemacode\MySchema.xsd.

xsd-sc4

3.Select the menu option Project | Overwrite Program Code from UModel project, and click OK to generate the schema.

xsd-sc5


© 2019 Altova GmbH