com.espertech.esper.event.xml
Class SchemaUtil

java.lang.Object
  extended by com.espertech.esper.event.xml.SchemaUtil

public class SchemaUtil
extends java.lang.Object

Utility class for querying schema information via Xerces implementation classes.

Author:
pablo

Constructor Summary
SchemaUtil()
           
 
Method Summary
static SchemaItem findPropertyMapping(SchemaElementComplex def, java.lang.String property)
          Finds an apropiate definition for the given property, starting at the * given definition.
static SchemaElementComplex findRootElement(SchemaModel schema, java.lang.String namespace, java.lang.String elementName)
          Returns the root element for a given schema given a root element name and namespace.
static java.lang.String serialize(org.w3c.dom.Node doc)
          Serialize the given node.
static javax.xml.namespace.QName simpleTypeToQName(short type)
          Returns the XPathConstants type for a given Xerces type definition.
static java.lang.Class toReturnType(javax.xml.namespace.QName resultType, java.lang.Class optionalCastToType)
          Returns the native type based on XPathConstants qname and an optional cast-to type, if provided.
static java.lang.Class toReturnType(SchemaItem item)
          Returns the Class-type of the schema item.
static java.lang.Class toReturnType(short xsType, java.lang.String typeName, java.lang.Integer optionalFractionDigits)
          Returns the type for a give short type and type name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaUtil

public SchemaUtil()
Method Detail

toReturnType

public static java.lang.Class toReturnType(SchemaItem item)
Returns the Class-type of the schema item.

Parameters:
item - to to determine type for
Returns:
type

toReturnType

public static java.lang.Class toReturnType(short xsType,
                                           java.lang.String typeName,
                                           java.lang.Integer optionalFractionDigits)
Returns the type for a give short type and type name.

Parameters:
xsType - XSSimplyType type
typeName - type name in XML standard
optionalFractionDigits - fraction digits if any are defined
Returns:
equivalent native type

toReturnType

public static java.lang.Class toReturnType(javax.xml.namespace.QName resultType,
                                           java.lang.Class optionalCastToType)
Returns the native type based on XPathConstants qname and an optional cast-to type, if provided.

Parameters:
resultType - qname
optionalCastToType - null or cast-to type
Returns:
return type

simpleTypeToQName

public static javax.xml.namespace.QName simpleTypeToQName(short type)
Returns the XPathConstants type for a given Xerces type definition.

Parameters:
type - is the type
Returns:
XPathConstants type

findRootElement

public static SchemaElementComplex findRootElement(SchemaModel schema,
                                                   java.lang.String namespace,
                                                   java.lang.String elementName)
Returns the root element for a given schema given a root element name and namespace.

Parameters:
schema - is the schema to interrogate
namespace - is the namespace of the root element
elementName - is the name of the root element
Returns:
declaration of root element

findPropertyMapping

public static SchemaItem findPropertyMapping(SchemaElementComplex def,
                                             java.lang.String property)
Finds an apropiate definition for the given property, starting at the * given definition. First look if the property es an attribute. If not, look at simple and then child element definitions.

Parameters:
def - the definition to start looking
property - the property to look for
Returns:
schema element or null if not found

serialize

public static java.lang.String serialize(org.w3c.dom.Node doc)
Serialize the given node.

Parameters:
doc - node to serialize
Returns:
serialized node string

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com