DLESE Tools
v1.6.0

org.dlese.dpc.xml.schema
Class XSDatatypeManager

java.lang.Object
  extended by org.dlese.dpc.xml.schema.XSDatatypeManager

public class XSDatatypeManager
extends Object

Provides Map-like interface to XSdatatypes - including built-ins and those datatypes defined by a Schema - used to validate element values within a schema-based document. XSdatatypes validate a value against a defined datatype, whether it is built-in or derived. Built-in data types are supplied by Sun's XSDatatype library, data types specified by a particular schema are derived by extending the built-in types (see deriveType()).

Author:
ostwald

Constructor Summary
XSDatatypeManager()
          Constructor for the XSDatatypeManager object
XSDatatypeManager(GlobalDefMap globalDefMap)
          Constructor for the XSDatatypeManager object
 
Method Summary
 void addDerivedType(com.sun.msv.datatype.xsd.XSDatatype dt)
          Adds a derived XSDatatype to the map of derived types
 boolean checkValid(String typeName, String value)
          Checks a value against it's datatype.
 boolean checkValid(com.sun.msv.datatype.xsd.XSDatatype dt, String v)
          validates a String value against an XSDatatype.
 com.sun.msv.datatype.xsd.XSDatatype deriveByUnion(SimpleType def)
          Description of the Method
 void destroy()
          Description of the Method
 Map getDerivedTypes()
           
 String getSchemaNSPrefix()
           
 com.sun.msv.datatype.xsd.XSDatatype getTypeByName(String typeName)
          Gets a XSDatatype class used to validate a value against a datatype declared or defined in an XML Schema.
 com.sun.msv.datatype.xsd.XSDatatype getTypeByNameOLD(String typeName)
           
static void main(String[] args)
          The main program for the XSDatatypeManager class
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSDatatypeManager

public XSDatatypeManager()
Constructor for the XSDatatypeManager object


XSDatatypeManager

public XSDatatypeManager(GlobalDefMap globalDefMap)
Constructor for the XSDatatypeManager object

Parameters:
globalDefMap - Description of the Parameter
Method Detail

getDerivedTypes

public Map getDerivedTypes()

addDerivedType

public void addDerivedType(com.sun.msv.datatype.xsd.XSDatatype dt)
Adds a derived XSDatatype to the map of derived types

Parameters:
dt - The XSDatatype to be added

getSchemaNSPrefix

public String getSchemaNSPrefix()

getTypeByName

public com.sun.msv.datatype.xsd.XSDatatype getTypeByName(String typeName)
Gets a XSDatatype class used to validate a value against a datatype declared or defined in an XML Schema. XSDatatypes are found either in the derivedTypes map or in the DatatypeFactory (which returns XSDatatyps for built-in types)

Parameters:
typeName - XSDatatype name
Returns:
The XSDatatype object if found, or null

getTypeByNameOLD

public com.sun.msv.datatype.xsd.XSDatatype getTypeByNameOLD(String typeName)

checkValid

public boolean checkValid(String typeName,
                          String value)
                   throws Exception
Checks a value against it's datatype. If a validator (XSDatatype) can't be found for the given typeName, a message is printed and false is returned. This is a pretty weak way of dealing with this problem, since in other cases, an error is thrown to signify an invalid value.

date values are intercepted and handled by MetadataUtils.parseUnionDateType(String)

Parameters:
typeName - Description of the Parameter
value - Description of the Parameter
Returns:
Description of the Return Value
Throws:
Exception - Description of the Exception

checkValid

public boolean checkValid(com.sun.msv.datatype.xsd.XSDatatype dt,
                          String v)
                   throws Exception
validates a String value against an XSDatatype. If the value is not valid an Exception is thrown describing the error.

Parameters:
dt - Description of the Parameter
v - Description of the Parameter
Returns:
Description of the Return Value
Throws:
Exception - Description of the Exception

deriveByUnion

public com.sun.msv.datatype.xsd.XSDatatype deriveByUnion(SimpleType def)
                                                  throws Exception
Description of the Method

Parameters:
def - Description of the Parameter
Returns:
Description of the Return Value
Throws:
Exception - Description of the Exception

main

public static void main(String[] args)
                 throws Exception
The main program for the XSDatatypeManager class

Parameters:
args - The command line arguments
Throws:
Exception - Description of the Exception

destroy

public void destroy()
Description of the Method


DLESE Tools
v1.6.0