Difference between revisions of "EclipseLink/Examples/SDO/MetadataXMLSchema"

From Eclipsepedia

Jump to: navigation, search
(Introspect Metadata - Types)
Line 14: Line 14:
  
 
==Introspect Metadata - Types==
 
==Introspect Metadata - Types==
 +
Once the XML schema has been processed the types are available from TypeHelper.
 +
<source lang="java">
 +
Type addressType = TypeHelper.INSTANCE.getType("http://www.example.org/customer-example", "address-type");
 +
</source>

Revision as of 13:45, 24 February 2009

Overview

The following example will demonstrate how to use EclipseLink's SDO functionality to:

  • Define a set of SDO Types from an XML Schema

Initializing the Types from XML Schema

The first thing that needs to be done in an SDO application is to set up the metadata for the Types and Properties. This is most commonly done by loading an XML schema, although it may also be done programmatically.

FileInputStream xsdInputStream = new FileInputStream("Customer.xsd");
XSDHelper.INSTANCE.define(xsdInputStream, null);

Introspect Metadata - Types

Once the XML schema has been processed the types are available from TypeHelper.

Type addressType = TypeHelper.INSTANCE.getType("http://www.example.org/customer-example", "address-type");