XML made simple   
Home   Support   Contact  

   xml to edi 850
   xml schema editor
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
   xml editor

Chapter 4: Import and Export XML into Schemas

A very important feature of a good XML Schema editor is the ability to import an instance document and create the schema for you. Also, it can be handy to generate a sample Instance Document from a schema. xmlDraft does both of these.

Importing an XML Document

xmlDraft allows the user to import any XML document and generate a basic XML schema for you. For example, if you were to import the following document:

Address XML document as seen in xmlHack, the Simple XML Editor

This is the schema that would be generated:

Imported Schema in xmlDraft, the Smart XML Schema Editor

The document is rather simple, a framework of the Instance document, but enough to start working with. This is the bare minimum I would expect from an XML Schema editor, and more is planned for xmlDraft.

Exporting a Sample XML Document

In addition to importing XML, there are times when it would be nice to have a blank, sample XML document of a particular schema. For example, when generating a Stylesheet, you typically work off of a "template", meaning an XML document that doesn't really contain data, just the nodes. If you have a Schema, then creating said sample document is a nice feature indeed.

Fortunately, xmlDraft does this as well. Let's look at this Schema:

Book Schema in xmlDraft, the Smart XML Schema Editor

A rather simple schema representing a Book. Notice that there is a globally referenced complexType. When we export it, we get the following XML document:

Book XML exported into xmlHack, the Simple XML Editor

Simple, yes, but now gives us a great starting point to work with. Very handy as well when dealing with larger, more complex schemas.

<- Return Continue ->