Documentation

gitHub

XSD of logical models

Important note: the purpose of this functionality is NOT to provide full compatibility with XSD syntax, but just to import models from other ER tools.  As a a result, Hackolade does not currently support, among other things, mixed content types, deriving types by restriction, or XSD import and include.

 

If you have logical or physical models in ER/Studio Architect, erwin, InfoSphere, PowerDesigner, or others, you may want to import them into Hackolade.  

 

To do so, you need to first export your model to an XSD schema.  Please refer to your ER tool's documentation for more info.  

 

Then, go to Tools > Reverse-Engineer > XSD Schema and choose the file exported.

 

Image

 

The structure of an XSD can be imported either as an entity in the Entity Relationship Diagram, or alternatively as a model definition so it could be re-used in the model:

 

Image

If you wish to force the destination of the reverse-engineering operation, you may specify the container in which the entities should be inserted.

 

Your next steps might be to start denormalizing and embedding, using this Hackolade function.  

 

By default ERwin does not export primary key and foreign key constraints.  It is suggested to use the parameters below when exporting models to XSD:

Image

 

XSDs can be imported:

- as entities in the ER diagram (not available for Swagger or OpenAPI targets)

- as model definitions

 

XML Schema Definition conversion in Hackolade

 

An XSD defines the structure of an XML document. It specifies the elements and attributes that can appear in an XML document and the type of data these elements and attributes can contain.

XSD Elements

Element structures can be of simpleType or complexType, depending on whether the element is a leaf element or a parent element.

 

XSD elements can be of type simpleType, complexType, or anyType:

  • an element of type simpleType contains only text. It cannot have attributes and elements. 
  • an element of type complexType can contain text, elements, and attributes. An element of type complexType is parent to all the elements and attributes contained within it. 
  • an any element in an XSD specifies that any well-formed XML is allowed in its place in XML instance.

 

XSD attributes are always of type simpleType.

 

Elements can be local or global. An element declared as the direct child of an XML schema is called a global element and can be used throughout the schema. Elements declared within a complexType definition are local elements. So, you cannot use these elements anywhere else in the schema. 

 

XSD Attributes

XSD attributes are always of type simpleType.

 

Attributes are stored as member of the object created for the parent element.  An attribute group defines an association between a name and a set of attribute declarations. You can reuse the attribute groups in complexType definitions.

 

An attribute group defines an association between a name and a set of attribute declarations. Attribute groups can be reused in complexType definitions.

 

 

XSD Type Definitions

XSD Type definitions are used to create new simpleType data type or complexType data type. A type definition that is used as a base for creating new definitions is known as the base type definition. A simpleType or complexType type can be either named or anonymous. A named simpleType or complexType is always defined globally. You can define a named simpleType or complexType and refer it in schema document as type of an element. An anonymous simpleType or complexType type does not have a name. So, an anonymous simpleType or complexType type cannot be referenced.

 

A simpleType type is derived from an XML schema built-in data type.  A complexType type definition contains a set of element declarations, element references, and attribute declarations.A complexType type is first defined in the schema, and then the elements and attributes of this complexType type.

 

Below is the data type conversion from XSD to JSON Schema.  Some additional granularity is possible with some targets.

 

XML Schema TypeJSON Schema Representation
anySimpleTypestring, number, integer, boolean, null
anyTypestring, number, integer, boolean, null, object, array
stringstring
normalizedStringstring
tokenstring
languagestring
Namestring
NCNamestring
IDstring
IDREFstring
IDREFSarray of strings
ENTITYstring
ENTITIESarray of strings
NMTOKENstring
NMTOKENSarray of strings
booleanboolean
base64Binarybinary | string
hexBinarystring
floatnumber
doublenumber
decimalnumber
integerinteger
nonPositiveIntegerinteger
negativeIntegerinteger
longinteger
intinteger
shortinteger
byteinteger
nonNegativeIntegerinteger
unsignedLonginteger
unsignedIntinteger
unsignedShortinteger
unsignedByteinteger
positiveIntegerinteger
anyURIstring with "format":"uri"
QNameobject with "namespaceURI", "localPart", "prefix"
durationstring with ‘format: “duration”
dateTimestring with "format":"date-time"
datestring with "format":"date"
timestring with "format":"time"