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
