postheadericon How to Create an XML Schema

An XML Schema defines the structure of your XML document. As opposed to XML DTDs (document type definitions) XML Schemas are more powerful and support both data types and namespaces. Knowing how to create an XML Schema will ensure proper functioning of your XML document

How to Create an XML Schema

1 Purchase an XML editing software program that allows you to create XML schemas, if you do not already have such software.

How to Create an XML Schema

2 Install the software on your computer and restart, if necessary.

How to Create an XML Schema

3 Familiarize yourself with your XML editor’s workspace, as well as with user resources that are available.

How to Create an XML Schema

4 Create elements for your XML Schema. Your schema must include the schema element as its root element. This element may also contain attributes. Elements must include a start and end tag and may include other elements, text, attributes or any combination of these. The names of your XML elements must not start with a number or special character and cannot start with “xml.” Ensure all elements are properly nested. Use short, descriptive names for your elements.

How to Create an XML Schema

5 Define which XML Schema elements are child elements.

How to Create an XML Schema

6 Create your XML Schema attributes. Attributes provide additional information about the elements contained within your XML document. Attributes must appear within quotes. Attributes can contain only one value. Do not include tree structures in your attributes.

How to Create an XML Schema

7 Create your XML Schema types to define the content of your elements and attributes.

How to Create an XML Schema

8 Save your work.

How to Create an XML Schema

9 Check your XML Schema to be sure XML elements and XML attributes are properly named and that there are no other errors.

How to Create an XML Schema

10 Correct any errors you identify.

How to Create an XML Schema

11 Validate your XML Schema using your XML editor’s validation tool.

How to Create an XML Schema

12 Correct any errors identified during validation.

How to Create an XML Schema

13 Save your work.

How to Create an XML Schema

14 Open the XML file or files for which you have created the XML Schema.

How to Create an XML Schema

15 Include a reference to your XML Schema within your XML file or files.

How to Create an XML Schema

16 Save your XML file.

Leave a Reply