Featured Post

Applying Email Validation to a JavaFX TextField Using Binding

This example uses the same controller as in a previous post but adds a use case to support email validation.  A Commons Validator object is ...

Saturday, December 18, 2010

XML Modeling with Sparx Systems Enterprise Architect

A modeling tool is essential when creating XML-based data structures using XML Schema (XSD). It's important to be able to read the XSD -- and have the ability to create one by text editor -- but working with a graphical tool avoids spelling errors and type mismatches.

I use Sparx Systems Enterprise Architect (EA), Professional Edition, to create XSDs. Enterprise Architect is a robust tool for all sorts of modeling activities. I also use EA for Java class modeling, ETL data flow diagrams, RDBMS E-R modeling, and DDL script generation.

EA's XSD modeling features are based on UML class diagrams. Out-of-the-box, a standard UML class diagram can generate an XML Schema. However, you'll likely want to annotate the top-level package with an 'XSDschema' stereotype to provide for namespaces.

For more control over the generation of the XSD, use the XML Schema toolbox to build a UML-based diagram. The toolbox will automatically apply stereotypes like XSDcomplexType for exposing sequences and other custom types. I also give each UML member variable an XSDAttribute stereotype to use XML attributes; without XSDAttribute, EA will create a separate element for each member variable.

See a screen shot of a class' attributes with the XSDAttribute applied.

NOTE: XSDAttribute wasn't initially displayed in my stereotype drop down. I typed in XSDAttribute manually. EA generates the XSD using attributes for AddressType and XSDAttribute appears in the drop down now.

Creating XML is simple, but for complex data exchange over a long span of time, describing XML with an XSD is crucial. If you model in XSD, you should know the syntax and the standard. But for managing the versions, namespaces, and different schemas in a less error prone fashion, find a tool like EA.

This post is replicated from http://my.opera.com/walkerca/blog/xml-with-ea.

1 comment:

  1. Thanks for sharing nice information. You can Discuss two aspect of EA Modeling And EA Tools.