After talking to Steve Brodsky, we concluded that this would likely not be 
consistent with the future direction
of the SDO spec. The mapping from XSD to SDO types would likely go in the 
XSDHelper or possibly in a 
yet to be defined SPI interface.

So for now I added an SDOUtil method, SDOUtil.getXSDSDOType(), as 
described earlier in this thread.

Sebastien, to get the Java class you should do something like this:

    Class javaDecimal = 
SDOUtil.getXSDSDOType("decimal").getInstanceClass();

Frank.


Frank Budinsky/Toronto/[EMAIL PROTECTED] wrote on 02/27/2006 02:29:23 PM:

> Jeremy Boynes <[EMAIL PROTECTED]> wrote on 02/27/2006 01:54:35 PM:
> 
> > Frank Budinsky wrote:
> > > Sebastien was asking me about how to find the Java implementation 
> class 
> > > for a given XMLSchema built-in type (e.g., xsd:decimal). The SDO 
spec 
> > > includes a table on page 95 that shows how XSD types map to SDO 
Types 
> and 
> > > consequently to Java instanceClass (3 column table). Note that the 
> mapping 
> > > from the second to third column (SDO Type to Java class) is provided 

> by 
> > > the commonj.sdo.Type.getInstanceClass() method. But, unfortunately, 
> there 
> > > is currently no API defined in the SDO spec that implements the 
first 
> to 
> > > second column mapping (XSD type to SDO type). Therefore there is no 
> > > standard way to do it.
> > > 
> > 
> > I'm confused - isn't this the function of the TypeHelper e.g.
> >   String XSDNS = "http://www.w3.org/2001/XMLSchema";;
> >   Type xsdDecimal = typeHelper.getType(XSDNS, "decimal");
> 
> Not quite. SDO defines a mapping of XSD simple types onto a simple set 
of 
> backend-independent SDO Types.
> 
> For example, according to the SDO spec, the type xsd:decimal maps to the 

> built-in SDO Type for which getURI() returns "commonj.sdo", getName() 
> returns "Decimal", and getInstanceClass() returns java.math.BigDecimal.
> 
> Assuming that someone "define"d the schema-for-schema namespace and then 

> called the typeHelper as you suggest, it would return a Type 
(xsdDecimal) 
> for which xsdDecimal.getURI() would return 
> "http://www.w3.org/2001/XMLSchema"; and xsdDecimal.getName() would return 

> "decimal". xsdDecimal.getInstanceClass() would return java.lang.String 
> (the default) I think.
> 
> That said, I wonder if the SDO spec could be changed to specify 
TypeHelper 
> performs this mapping automatically for the built-in xsd types? It might 

> be odd, though, to get back a Type that doesn't have the name and uri, 
> that was specified in the getType() call.
> 
> Frank.
> 
> > 
> > --
> > Jeremy
> 

Reply via email to