Skip Headers

Oracle9i XML API Reference - XDK and Oracle XML DB
Release 2 (9.2)

Part Number A96616-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

6
XML Schema Processing

The full functionality of XML Schema Processor for Java is contained in the oracle.XML.parser.schema package.

This chapter discusses the following topics:


XMLSchema Class


Description of XMLSchema

This class contains a set of Schema for different target namespaces. They are used by XSDParser for instance XML documents validation and by XSDBuilder as imported schemas.


Syntax of XMLSchema

public class XMLSchemaNode extends oracle.xml.parser.schema.XSDNode
 
oracle.xml.parser.schema.XSDNode
  |
  +--oracle.xml.parser.schema.XMLSchemaNode


Methods of XMLSchema

Table 6-1 Summary of Methods of XML Schema
Constructor Description

XMLSchema()

XMLSchema constructor.

getAllTargetNS()

Returns all the Target Name space defined in the schema.

getSchemaByTargetNS()

Returns schemaNode for the given namespace.

getSchemaTargetNS()

Returns the top level schema's target Namespace.

getXMLSchemaNodeTable()

Returns XMLSchemaNode table.

getXMLSchemaURLS()

Returns XMLSchema URLs.

printSchema()

Print schema information.

XMLSchema()

Description

XMLSchema constructor. Throws XSDException. The options are described in the following table.

Syntax Description

public XMLSchema()

Default constructor.

public XMLSchema(int n);

Constructs schema given initial size of schemanode set.


Parameter Description

n

Initial size of schemanode set

getAllTargetNS()

Description

Returns all the Target Name space defined in the schema.

Syntax

public java.lang.String[] getAllTargetNS();

getSchemaByTargetNS()

Description

Returns schemaNode for the given namespace.

Syntax

public XMLSchemaNode getSchemaByTargetNS( String namespace);

Parameter Description

namespace

Target namespace of the required schema.

getSchemaTargetNS()

Description

Returns the top level schema's target Namespace. In case there are more than one top level schema, the last one being built is returned.

Syntax

public String getSchemaTargetNS();

getXMLSchemaNodeTable()

Description

Returns XMLSchemaNode table as a hashtable.

Syntax

public java.util.Hashtable getXMLSchemaNodeTable();

getXMLSchemaURLS()

Description

Returns XMLSchema URLs as an array.

Syntax

public java.lang.String[] getXMLSchemaURLS();

printSchema()

Description

Print schema information. The options are described in the following table.

Syntax Description

public void printSchema();

Prints schema information.

public void printSchema(

boolean all);

Prints schema information, including build-ins.


Parameter Description

all

Flag to indicate that all information, including build-ins, should be printed


XMLSchemaNode


Description of XMLSchemaNode

This class contains sets of top level Schema components in a target namespace.


Syntax of XMLSchemaNode

public class XMLSchemaNode extends oracle.xml.parser.schema.XSDNode
 
oracle.xml.parser.schema.XSDNode
  |
  +--oracle.xml.parser.schema.XMLSchemaNode


Methods of XMLSchemaNode

Table 6-2 Summary of Methods of XMLSchemaNode
Method Description

XMLSchemaNode()

XMLSchema constructor.

getAttributeDeclarations()

Returns all the top level attributes in the schema.

getComplexTypeSet()

Returns all the top level complex type elements in the schema.

getComplexTypeTable()

Returns the complex type definitions.

getElementSet()

Returns all the top level elements in the schema.

getSimpleTypeSet()

Returns all the top level simpleType elements in the schema.

getSimpleTypeTable()

Returns the simple type definitions.

getTargetNS()

Returns targetNS of the schema.

getTypeDefinitionTable()

Returns the type definitions.

XMLSchemaNode()

Description

XMLSchema constructor.

Syntax

public  XMLSchemaNode();

getAttributeDeclarations()

Description

Returns all the top level attributes in the schema as an array.

Syntax

public XSDAttribute getAttributeDeclarations();

getComplexTypeSet()

Description

Returns all the top level complex type elements in the schema as an array.

Syntax

public XSDNode getComplexTypeSet();

getComplexTypeTable()

Description

Returns the complex type definitions as a hashtable.

Syntax

public java.util.Hashtable getComplexTypeTable();

getElementSet()

Description

Returns all the top level elements in the schema as an array.

Syntax

public XSDNode getElementSet();

getSimpleTypeSet()

Description

Returns all the top level simpleType elements in the schema as an array.

Syntax

public XSDNode getSimpleTypeSet();

getSimpleTypeTable()

Description

Returns the simple type definitions, in a hashtable.

Syntax

public java.util.Hashtable getSimpleTypeTable();

getTargetNS()

Description

Returns targetNS of the schema. Overrides XSDNode.getTargetNS() in class XSDNode.

Syntax

public String getTargetNS();

getTypeDefinitionTable()

Description

Returns the type definitions as a hashtable.

Syntax

public java.util.Hashtable getTypeDefinitionTable();

XSDAttribute Class


Description of XSDAttribute

This class represents Schema Attribute declaration.


Syntax of XSDAttribute

public class XSDAttribute extends oracle.xml.parser.schema.XSDNode
 
oracle.xml.parser.schema.XSDNode
  |
  +--oracle.xml.parser.schema.XSDAttribute


Methods of XSDAttribute

Table 6-3 Summary of Methods of XSDAttribute  
Method Description

getDefaultVal()

Returns the value of 'default' attributes in case of element, and the value of 'value' attributes based on 'use' attribute.

getFixedVal()

Returns the value of 'fixed' attribute in case of element, and the value of 'value' attribute based on 'use' attribute.

getName()

Returns the name of the node.

getRefLocalname()

Returns he local name of the resolved 'ref' attribute.

getRefNamespace()

Returns the namespace of the resolved 'ref' attribute.

getRefState()

Returns refState.

getTargetNS()

Returns target namespace.

getType()

Returns the node type.

isRequired()

Checks if the attribute is required.

getDefaultVal()

Description

Returns the value of 'default' attr in case of element, and the value of 'value' attr based on 'use' attribute.

Syntax

public String getDefaultVal();

getFixedVal()

Description

Returns the default value of 'fixed' attr in case of element, and the value of 'value' attr based on 'use' attribute.

Syntax

public java.lang.String getFixedVal();

getName()

Description

Returns the name of the node. Overrides XSDNode.getName() in class XSDNode.

Syntax

public String getName();

getRefLocalname()

Description

Returns the refLocal name of the resolved 'ref' attribute

Syntax

public String getRefLocalname();

getRefNamespace()

Description

Returns the RefNamespace of the resolved 'ref' attribute.

Syntax

public String getRefNamespace();

getRefState()

Description

Returns refState value. The return value is one of the following: TYPE_UNRESOLVED, TYPE_RESOLVED, REF_UNRESOLVED, REF_RESOLVED.

Syntax

public int getRefState();

getTargetNS()

Description

Returns target namespace. XSDNode.getTargetNS() in class XSDNode.

Syntax

public String getTargetNS();

getType()

Description

Returns the node type which is either simpleTypeor complexType.

Syntax

public XSDNode getType();

isRequired()

Description

Checks if the attribute is required.

Syntax

public boolean isRequired();

XSDBuilder Class


Description of XSDBuilder

Builds an XMLSchema object from XMLSchema document. XMLSchema object is a set of objects (Infoset items) corresponding to top-level schema declarations & definitions. Schema document is 'XML' parsed and converted to a DOM tree. This schema DOM tree is 'Schema' parsed in a following order: (if any) builds a schema object and makes it visible. (if any) is replaced by corresponding DOM tree. Top-level declarations & definitions are registered as a current schema infoset items. Finally, top-level tree elements (infoset items) are 'Schema' parsed. The result XMLSchema object is a set (infoset) of objects (top-level input elements). Object's contents is a tree with nodes corresponding to low-level element/group decls/refs preceded by node/object of type SNode containing cardinality information (min/maxOccurs).


Syntax of XSDBuilder

public class XSDBuilder

Methods of XSDBuilder

Table 6-4 Summary of Methods of XSDBuilder  
Method Description

XSDBuilder()

Class constructor.

build()

Builds an XMLSchema object or document.

getObject()

Returns XML schema object.

setEntityResolver()

Sets an EntityResolver for resolving imports/include.

setError()

Sets XMLError object.

setLocale()

Sets locale for error reporting.

XSDBuilder()

Description

XSDBuilder constructor.

Syntax

public XSDBuilder() throws XSDException;

build()

Description

Build and returns an XMLSchema object/document. An Exception is thrown if Builder fails to build an XMLSchema object. The options are described in the following table.

Syntax Description

public Object build(

InputStream in,

URL baseurl);

Builds an XMLSchema object from an input stream and a URL.

public Object build(

Reader r,

URL baseurl);

Builds an XMLSchema object from a reader and a URL.

public Object build(

String sysId);

Builds an XMLSchema object from system id.

public Object build(

String ns,

String sysid);

Builds an XMLSchema object from a namespace and system id.

public Object build(

String ns,

URL sysid);

Builds an XMLSchema object from a namespace and URL.

public Object build(

URL schemaurl);

Builds an XMLSchema object from a URL.

public Object build(

XMLDocument schemaDoc);

Builds XMLSchema from XML document.

public Object build(

XMLDocument[] schemaDocs,

URL baseurl);

Builds XMLSchema from an array of XML documents and a URL.

public Object build(

XMLDocument doc,

String fragment,

String ns,

URL sysid);

Build an XMLSchema object from XML document, a fragment, namespace, and system id.

public Object build(

XMLDocument schemaDoc,

URL baseurl);

Build XMLSchema from XML document and URL.

Parameter Description

baseurl

URL used to resolve any relative refs; used for any import/include in document

doc

XMLdocument contain the schema element

fragment

Fragment ID of the schema element

in

Inputstream of Schema

ns

Schema target namespace used to validate targetNamespace

r

Reader of Schema

schemaDoc

XMLDocument

schemaDocs

Array of XMLDocuments

sysId

Schema location

url

URL of Schema

getObject()

Description

Returns XML schema object.

Syntax

public Object getObject();

setEntityResolver()

Description

Sets an EntityResolver for resolving imports/include. See also org.xml.sax.EintityResolver.

Syntax

public void setEntityResolver( org.xml.sax.entityResolver entResolver);

Parameter Description

entResolver

EntityResolver

setError()

Description

Sets XMLError object.

Syntax

public void setError( XMLError er);


Parameter Description

er

XMLError object

setLocale()

Description

Sets locale for error reporting.

Syntax

public void setLocale(L ocale locale);

Parameter Description

locale

Locale object


XSDComplexType Class


Description of XSDComplexType

This class represents the Schema ComplexType definition.


Syntax of XSDComplexType

public class XSDComplexType extends oracle.xml.parser.schema.XSDNode
 
oracle.xml.parser.schema.XSDNode
  |
  +--oracle.xml.parser.schema.XSDComplexType


Methods XSDComplexType

Table 6-5 Summary of Methods of XSDComplexType  
Method Description

getAttributeDeclarations()

Returns attribute declarations of this complex type.

getAttributeWildcard()

Returns attribute wildcard of this complex type.

getBaseType()

Returns the base type of this complextype.

getContent()

Returns content of XSDComplexType.

getDerivationMethod()

Returns information on how was this type derived from its parent type.

getElementSet()

Returns an array of all the local elements inside a complexType element.

getGroup()

Returns the attribute group or the child & attribute group.

getRefLocalname()

Returns the local name of resolved 'base' attr.

getTypeGroup()

Returns type group of Complex Type.

init()

Initializes complex type.

isAbstract()

Returns TRUE if the Complex Type is abstract.

getAttributeDeclarations()

Description

Returns attribute declarations of this complex type; does not include wild card array of attribute declarations.

Syntax

public XSDAttribute getAttributeDeclarations();

getAttributeWildcard()

Description

Returns attribute wildcard of this complex type.

Syntax

public oracle.xml.parser.schema.XSDAny getAttributeWildcard();

Returns

The attribute wildcard if has one

getBaseType()

Description

Returns the base type of this complextype.

Syntax

public XSDNode getBaseType();

getContent()

Description

Returns content of XSDComplexType.

Syntax

public int getContent();

getDerivationMethod()

Description

Returns information on how was this type derived from its parent type. One of EXTENSION_DERIVATION or RESTRICTION_DERIVATION.

Syntax

public short getDerivationMethod();

getElementSet()

Description

Returns an array of all the local elements inside a complexType element.

Syntax

public XSDNode getElementSet();

getGroup()

Description

Returns the attribute group or the child & attribute group.

Syntax

public XSDGroup getGroup();

getRefLocalname()

Description

Returns the local name of resolved 'base' attr.

Syntax

public java.lang.String getRefLocalname();

getTypeGroup()

Description

Returns type group of Complex Type.

Syntax

public XSDGroup getTypeGroup();

init()

Description

Initializes complex type.

Syntax

public static void init();

isAbstract()

Description

Returns TRUE if the Complex Type is abstract.

Syntax

public boolean isAbstract();

XSDConstrainingFacet Class


Description of XSDConstrainingFacet

This class represents Schema Constraining facet for Data Type.


Syntax of XSDConstrainingFacet

public class XSDConstrainingFacet extends java.lang.Object implements 
oracle.xml.parser.schema.XSDTypeConstants
 
java.lang.Object
  |
  +--oracle.xml.parser.schema.XSDConstrainingFacet


Implemented Interfaces of XSDConstrainingFacet

XSDTypeConstants


Methods of XSDConstrainingFacet

Table 6-6 Summary of Methods of XSDConstrainingFacet  
Method Description

getFacetId()

Returns the facet id.

getLexicalEnumeration()

Returns the LEXICAL enumeration of the constraining facet.

getLexicalValue()

Returns the LEXICAL value of the constraining facet.

getName()

Returns the name of the constraining facet.

isFixed()

Checks whether facet is fixed and cannot be changed.

setFixed()

Sets if the facet is fixed and cannot be changed.

validateFacet()

Validates the value against the constraint facet.

getFacetId()

Description

Returns the facet id.

Syntax

public int getFacetId();

getLexicalEnumeration()

Description

Returns the LEXICAL enumeration of the constraining facet.

Syntax

public java.util.Vector getLexicalEnumeration();

getLexicalValue()

Description

Returns the LEXICAL value of a constraining facet.

Syntax

public String getLexicalValue();

getName()

Description

Returns the name of the constraining facet.

Syntax

public String getName();

isFixed()

Description

Checks whether facet is fixed and cannot be changed. Returns TRUE for fixed, FALSE otherwise.

Syntax

public boolean isFixed();

setFixed()

Description

Sets whether facet is fixed and cannot be changed. TRUE for fixed, FALSE otherwise.

Syntax

public void setFixed( boolean fixed);

Parameter Description

value

Value being validated.

validateFacet()

Description

Validates the value against the constraint facet.

Syntax

public void validateFacet( XSDDataValue value);

Parameter Description

value

Value being validated.


XSDDataValue Class


Description of XSDDataValue

This class represents data values for Schema Simple Type.


Syntax of XSDDataValue

public class XSDDataValue extends java.lang.Object implements 
oracle.xml.parser.schema.XSDTypeConstants
 
java.lang.Object
  |
  +--oracle.xml.parser.schema.XSDDataValue


Implemented Interfaces of XSDDataValue

XSDTypeConstants


Methods of XSDDataValue

Table 6-7 Summary of Methods of XSDDataValue  
Method Description

compareTo()

Compares two values returns -1 for smaller, 0 for equal, and 1 for greater.

getLength()

Returns the length of STRING/BINARY value.

getLexicalValue()

Returns LEXICAL value from the XSDDataValue class.

getPrecision()

Returns the precision of decimal value.

getScale()

Returns the scale of decimal value.

compareTo()

Description

Compares two values; returns -1 for smaller, 0 for equal, and 1 for greater. Throws XSDException if the data values are not comparable.

Syntax

public int compareTo( XSDDataValue val);

getLength()

Description

Gets the length of STRING/BINARY value. Throws XSDException if the data value is not of String/Binary type.

Syntax

public int getLength();

getLexicalValue()

Description

Returns LEXICAL value from the XSDDataValue class.

Syntax

public String getLexicalValue();

getPrecision()

Description

Returns the precision of decimal value. Throws XSDException if the data values are not decimal type.

Syntax

public int getPrecision();

getScale()

Description

Returns the int value of a decimal scale. Throws XSDException if the data value is not decimal type.

Syntax

public int getScale();

XSDElement Class


Description of XSDElement

The XSDElement class represents the Schema element declaration.


Syntax of XSDElement

public class XSDElement
 
oracle.xml.parser.schema.XSDElement


Methods of XSDElement

Table 6-8 Summary of Methods of XSDElement  
Method Description

findEquivClass()

Finds the equivalent class corresponding to this class.

getDefaultVal()

Returns the value of 'default' attr in case of element, and the value of 'value' attr based on 'use' attribute.

getEquivClassRef()

Returns the local name of the resolved equivalent class.

getFixedVal()

Returns the value of 'fixed' attr in case of element, and the value of 'value' attr based on 'use' attribute.

getIdentities()

Returns the set of identities.

getMaxOccurs()

Returns the maxOccurs.

getMinOccurs()

Returns the minOccurs.

getName()

Returns Name.

getRefLocalname()

Returns the local name of the resolved 'ref' attribute.

getRefNamespace()

Returns the namespace of the resolved 'ref' attribute.

getRefState()

Returns refState.

getSubstitutionGroup()

Returns the substitutionGroup.

getTargetNS()

Sets target namespace.

getType()

Sets the node type.

isAbstract()

Returns TRUE if element abstract.

isNullable()

Returns TRUE if element nullable.

setMaxOccurs()

Sets the maxOccurs.

setMinOccurs()

Sets the minOccurs.

findEquivClass()

Description

Finds the equivalent class corresponding to this class.

Syntax

public XSDElement findEquivClass( String ns, 
                                  String nm);

Parameter Description

ns

Namespace.

rm

Name.

getDefaultVal()

Description

Returns the value of 'default' attr in case of element, and the value of 'value' attr based on 'use' attribute.

Syntax

public String getDefaultVal();

getEquivClassRef()

Description

Returns the local name of the resolved equivalent class.

Syntax

public String getEquivClassRef();

getFixedVal()

Description

Returns the value of 'fixed' attr in case of element, and the value of 'value' attr based on 'use' attribute

Syntax

public java.lang.String getFixedVal();

getIdentities()

Description

Returns the set of identities, as an array.

Syntax

public XSDIdentity getIdentities();

getMaxOccurs()

Description

Returns the maxOccurs

Syntax

public int getMaxOccurs();

getMinOccurs()

Description

Returns the minOccurs.

Syntax

public int getMinOccurs();

getName()

Description

Returns the name of the node.

Syntax

public String getName();

getRefLocalname()

Description

Returns the local name of the resolved 'ref' attribute

Syntax

public String getRefLocalname();

getRefNamespace()

Description

Returns the namespace of the resolved 'ref' attribute

Syntax

public String getRefNamespace();

getRefState()

Description

Returns refState. The return value is one of the following: TYPE_UNRESOLVED, TYPE_RESOLVED, REF_UNRESOLVED, REF_RESOLVED.

Syntax

public int getRefState();

getSubstitutionGroup()

Description

Returns the substitutionGroup

Syntax

public java.util.Vector getSubstitutionGroup();

getTargetNS()

Description

Returns target namespace.

Syntax

public java.lang.String getTargetNS();

getType()

Description

Returns the node type, either simpleType or complexType.

Syntax

public XSDNode getType();

isAbstract()

Description

Returns TRUE if this element is abstract.

Syntax

public boolean isAbstract();

isNullable()

Description

Returns TRUE if this element is nullable.

Syntax

public boolean isNullable();

setMaxOccurs()

Description

Sets the maxOccurs.

Syntax

public void setMaxOccurs( int max);

Parameter Description

maxOccurs

value

setMinOccurs()

Description

Sets the minOccurs.

Syntax

public void setMinOccurs( int min);

Parameter Description

minOccurs

value


XSDException


Description of XSDException

Indicates that an exception occurred during XMLSchema validation.


Syntax of XSDException

java.lang.Object
   |
   +---java.lang.Throwable
           |
           +---java.lang.Exception
                   |
                   +---oracle.xml.parser.schema.XSDException

public class XSDException extends Exception 

getMessage()

Description

Overrides getMessage() in class Throwable in order to construct error message from error id and error parameters. The options are described in the following table.

Syntax Description

public String getMessage()

Constructs error message from error id and error parameters

public String getMessage(

XMLError err)

Constructs localized error message based on the XMLError sent as parameter


Parameter Description

err

XMLError class used to get the error message


XSDGroup Class


Description of XSDGroup

The XSDGroup class represents the Schema group definition.


Syntax of XSDGroup

public class XSDGroup
 
oracle.xml.parser.schema.XSDGroup


Methods of XSDGroup

Table 6-9 Summary of Methods of XSDIdentity  
Method Description

getMaxOccurs()

Returns the maxOccurs.

getMinOccurs()

Returns the minOccurs.

getNodeVector()

Returns the particles of the group stored in nodeVector.

getOrder()

Returns the composite type - ALL, SEQUENCE, CHOICE.

setMaxOccurs()

Sets maxOccurs.

setMinOccurs()

Sets minOccurs.

getMaxOccurs()

Description

Returns the maxOccurs.

Syntax

public int getMaxOccurs();

getMinOccurs()

Description

Returns the minOccurs.

Syntax

public int getMinOccurs();

getNodeVector()

Description

Returns the particles of the group stored in nodeVector.

Syntax

public java.util.Vector getNodeVector();

getOrder()

Description

Returns the composite type - ALL, SEQUENCE, or CHOICE

Syntax

public int getOrder();

setMaxOccurs()

Description

Sets maxOccurs.

Syntax

public void setMaxOccurs( int max);

Parameter Description

maxOccurs

value

setMinOccurs()

Description

Sets the minOccurs.

Syntax

public void setMinOccurs( int min);

Parameter Description

minOccurs

value


XSDIdentity Class


Description of XSDIdentity

This class represents Schema Identity-Constraint definition: Unique, Key, and Keyref.


Syntax of XSDIdentity

public class XSDIdentity extends oracle.xml.parser.schema.XSDNode
 
oracle.xml.parser.schema.XSDNode
  |
  +--oracle.xml.parser.schema.XSDIdentity


Methods of XSDIdentity

Table 6-10 Summary of Methods of XSDIdentity
Method Description

getFields()

Returns the fields.

getNodeType()

Returns the node type.

getRefer()

Returns the reference key.

getSelector()

Returns the selector.

getFields()

Description

Returns the fields.

Syntax

public java.lang.String[] getFields();

getNodeType()

Description

Returns the node Type. Overrides XSDNode.getNodeType() in class XSDNode.

Syntax

public int getNodeType();

getRefer()

Description

Returns the referenced key

Syntax

public String getRefer();

getSelector()

Description

Returns the selector.

Syntax

public String getSelector();

XSDNode Class


Description of XSDNode

Root class for most of XSD classes. Contains fields and methods corresponding to XMLSchema definition attributes.


Syntax of XSDNode

public class XSDNode
 
oracle.xml.parser.schema.XSDNode


Direct Subclasses of XSDNode

XMLSchema, XMLSchemaNode, XSDAttribute, XSDComplexType, XSDIdentity


Methods of XSDNode

Table 6-11 Summary of Methods of XSDNode  
Method Description

getName()

Returns the name of the node.

getNamespaceURI()

Returns namespace uri for psv.

getNodeType()

Returns the type of XSDNode.

getTargetNS()

Returns target namespace.

isNodeType()

Checks if the node is of the give type.

getName()

Description

Returns the name of the node.

Syntax

public java.lang.String getName();

getNamespaceURI()

Description

Returns namespace uri for psv.

Syntax

public String getNamespaceURI()

getNodeType()

Description

Returns the type of XSDNode.

Syntax

public int getNodeType();

getTargetNS()

Description

Returns target namespace.

Syntax

public java.lang.String getTargetNS();

isNodeType()

Description

Checks if the node is of the give type.

Syntax

public boolean isNodeType( int type);

Parameter Description

type

Type of node that is being checked.


XSDSimpleType Class


Description of XSDSimpleType

This class represents Schema Simple Type definition.


Syntax of XSDSimpleType

public class XSDSimpleType implements oracle.xml.parser.schema.XSDTypeConstants
 
oracle.xml.parser.schema.XSDSimpleType


Implemented Interfaces of XSDSimpleType

XSDTypeConstants


Methods of XSDSimpleType

Table 6-12 Summary of Methods of XSDSimpleType  
Method Description

XSDSimpleType()

Class constructor.

derivedFrom()

Derive a type from the given base type.

getBase()

Returns the base type of this type.

getBasicType()

Gets the basic type from which this type was derived.

getBuiltInDatatypes()

Gets a built-in datatype.

getFacets()

Get the facets.

getMaxOccurs()

Get the value of maxOccurs.

getMinOccurs()

Get the value of minOccurs.

getVariety()

Get the variety of the type.

isAbstract()

Returns TRUE if this Type is abstract.

setFacet()

Sets a facet for the datatype (Internal private API).

setMaxOccurs()

Sets the value of maxOccurs.

setMinOccurs()

Sets the value of minOccurs.

setSource()

Sets the base type of the datatype, or in case of aggregate types sets the type of the component of the aggregate type.

validateValue()

Validates the string value with the facets defined for this type.

XSDSimpleType()

Description

Class constructor. The options are described in the following table.

Syntax Description

public XSDSimpleType();

Default constructor.

public XSDSimpleType(

int basic,

String tnm);

Implements W3C XMLSchema Datatype definition.


Parameter Description

basic

Id of the Primitive type from which this one is derived.

tnm

Name of this type.

derivedFrom()

Description

Derives a type from the given base type. Throws XSDException if new type cannot be created.

Syntax

public static XSDSimpleType derivedFrom( XSDSimpleType source,
                                         String nm, 
                                         String var);

Parameter Description

source

XSDSimpleType The base type

nm

The name of the new type

var

The method of derivation

getBase()

Description

Retrieves the base type.

Syntax

public XSDSimpleType getBase();

getBasicType()

Description

Retrieves the basic type from which this type was derived.

Syntax

public int getBasicType();

getBuiltInDatatypes()

Description

Gets a built-in datatype. Throws XSDException if the type is not a valid name.

Syntax

public static Hashtable getBuiltInDatatypes();

Parameter Description

type

Name of the built-in type.

getFacets()

Description

Retrieves the facets.

Syntax

public XSDConstrainingFacet getFacets();

getMaxOccurs()

Description

Retrieves value of maxOccurs.

Syntax

public int getMaxOccurs();

getMinOccurs()

Description

Retrieves the value of minOccurs.

Syntax

public int getMinOccurs();

getVariety()

Description

Retrieves the variety of the type.

Syntax

public java.lang.String getVariety();

isAbstract()

Description

Returns TRUE if this type is abstract, FALSE otherwise.

Syntax

public boolean isAbstract();

setFacet()

Description

Sets a facet for the datatype (Internal private API). Throws XSDException if the facet is invalid.

Syntax

public void setFacet( String facetName,
                      String value);

Parameter Description

facetName

Name of the facet being set.

value

Value of the facet.

setMaxOccurs()

Description

Set the value of maxOccurs

Syntax

public void setMaxOccurs(int max);

Parameter Description

max

Number of maximum occurrences.

setMinOccurs()

Description

Set the value of minOccurs.

Syntax

public void setMinOccurs( int min);

Parameter Description

min

Number of minimum occurrences.

setSource()

Description

Sets the base type of the datatype, or in case of aggregate types sets the type of the component of the aggregate type. Throws SDException if the src is not a valid type.

Syntax

public void setSource( XSDNode src);

Parameter Description

src

XSDNode source.

validateValue()

Description

Validates the string value with the facets defined for this type. Throws XSDException if the value is not valid.

Syntax

public void validateValue( String val);

Parameter Description

val

Value to be validated.


XSDConstantValues Interface


Description of XSDTypeConstantValues

This interface defines constants for the W3C Schema Processor.


Syntax of XSDTypeConstantValues

public interface XSDTypeConstants

Constants Defined in XSDConstantValues

Table 6-13 Constants Defined in XSDConstantValues  
Constant Definition

_abstract

public static final String _abstract

_all

public static final String _all

_annotation

public static final String _annotation

_any

public static final String _any

_anyAttribute

public static final String _anyAttribute

_anySimpleType

public static final String _anySimpleType

_anyType

public static final String _anyType

_attrFormDefault

public static final String _attrFormDefault

_attribute

public static final String _attribute

_attributeGroup

public static final String _attributeGroup

_attrTag

public static final String _attrTag

_base

public static final String _base

_block

public static final String _block

_blockDefault

public static final String _blockDefault

_choice

public static final String _choice

_complexContent

public static final String _complexContent

_complexType

public static final String _complexType

_content

public static final String _content

_default

public static final String _default

_derivedBy

public static final String _derivedBy

_element

public static final String _element

_elementOnly

public static final String _elementOnly

_elemFormDefault

public static final String _elemFormDefault

_empty

public static final String _empty

_enumeration

public static final String _enumeration

_equivClass

public static final String _equivClass

_extension

public static final String _extension

_false

public static final String _false

_field

public static final String _field

_final

public static final String _final

_finalDefault

public static final String _finalDefault

_fixed

public static final String _fixed

_form

public static final String _form

_group

public static final String _group

_id

public static final String _id

_import

public static final String _import

_include

public static final String _include

_itemType

public static final String _itemType

_key

public static final String _key

_keyref

public static final String _keyref

_lax

public static final String _lax

_list

public static final String _list

_maxOccurs

public static final String _maxOccurs

_memberTypes

public static final String _memberTypes

_minOccurs

public static final String _minOccurs

_mixed

public static final String _mixed

_nall

public static final String _nall

_name

public static final String _name

_namespace

public static final String _namespace

_nil

public static final String _nil

_nillable

public static final String _nillable

_nnany

public static final String _nnany

_nnlist

public static final String _nnlist

_nnlocal

public static final String _nnlocal

_nnother

public static final String _nnother

_nntargetNS

public static final String _nntargetNS

_noNSSchemaLocation

public static final String _noNSSchemaLocation

_notation

public static final String _notation

_null

public static final String _null

_nullable

public static final String _nullable

_optional

public static final String _optional

_pattern

public static final String _pattern

_processContents

public static final String _processContents

_prohibited

public static final String _prohibited

_publicid

public static final String _publicid

_qualified

public static final String _qualified

_redefine

public static final String _redefine

_ref

public static final String _ref

_refer

public static final String _refer

_required

public static final String _required

_restriction

public static final String _restriction

_restrictions

public static final String _restrictions

_schema

public static final String _schema

_schemaLocation

public static final String _schemaLocation

_selector

public static final String _selector

_sequence

public static final String _sequence

_simpleContent

public static final String _simpleContent

_simpleType

public static final String _simpleType

_skip

public static final String _skip

_strict

public static final String _strict

_substitution

public static final String _substitution

_systemid

public static final String _systemid

_targetNS

public static final String _targetNS

_textOnly

public static final String _textOnly

_this

public static final String _this

_true

public static final String _true

_type

public static final String _type

_undef

public static final String _undef

_union

public static final String _union

_unique

public static final String _unique

_unqualified

public static final String _unqualified

_use

public static final String _use

_value

public static final String _value

_version

public static final String _version

_xmlns

public static final String _xmlns

ABSENT_NS

public static final int ABSENT_NS

ACCEPTED

public static final int ACCEPTED

ALL

public static final int ALL

ANY

public static final int ANY

ANY_ATTRIBUTE

public static final int ANY_ATTRIBUTE

ANY_NODE

public static final String ANY_NODE

ATTRIBUTE

public static final int ATTRIBUTE

ATTRIBUTE_GROUP

public static final int ATTRIBUTE_GROUP

AUTO_VALIDATION

public static final String AUTO_VALIDATION

BASE_RESOLVED

public static final int BASE_RESOLVED

BASE_UNRESOLVED

public static final int BASE_UNRESOLVED

BASE_URL

public static final String BASE_URL

CHOICE

public static final int CHOICE

constName

public static final String constName[]

cyclicChain

public static final int cyclicChain

DATATYPE

public static final int DATATYPE

DONE

public static final int DONE

ELEMENT

public static final int ELEMENT

ELEMENT_CHILD

public static final int ELEMENT_CHILD

ELEMENT_ONLY

public static final int ELEMENT_ONLY

elemNotNullable

public static final int elemNotNullable

EMPTY

public static final int EMPTY

EQUIV_RESOLVED

public static final int EQUIV_RESOLVED

EQUIV_UNRESOLVED

public static final int EQUIV_UNRESOLVED

ERROR

public static final int ERROR

EXTENTION

public static final int EXTENTION

FACET_CHILD

public static final int FACET_CHILD

FAKE_NODE

public static final XSDGroup FAKE_NODE

FIXED_SCHEMA

public static final String FIXED_SCHEMA

GROUP

public static final int GROUP

IDENTITY_KEY

public static final int IDENTITY_KEY

IDENTITY_KEYREF

public static final int IDENTITY_KEYREF

IDENTITY_UNIQUE

public static final int IDENTITY_UNIQUE

IMPORT

public static final int IMPORT

INCLUDE

public static final int INCLUDE

INFINITY

public static final int INFINITY

invalidAttr

public static final int invalidAttr

invalidAttrVal

public static final int invalidAttrVal

invalidChars

public static final int invalidChars

invalidContent

public static final int invalidContent

invalidDerivation

public static final int invalidDerivation

invalidElem

public static final int invalidElem

invalidETag

public static final int invalidETag

invalidFacet

public static final int invalidFacet

invalidFixedChars

public static final int invalidFixedChars

invalidNameRef

public static final int invalidNameRef

invalidNS

public static final int invalidNS

invalidParsAttr

public static final int invalidParsAttr

invalidPrefix

public static final int invalidPrefix

invalidRef

public static final int invalidRef

invalidSTag

public static final int invalidSTag

invalidTargetNS

public static final int invalidTargetNS

LAX_VALIDATION

public static final String LAX_VALIDATION

missingAttr

public static final int missingAttr

MIXED

public static final int MIXED

needsSource

public static final int needsSource

NEW_STATE

public static final int NEW_STATE

NO_CHILD

public static final int NO_CHILD

noDefinition

public static final int noDefinition

NOT_DONE

public static final int NOT_DONE

NOTATION

public static final int NOTATION

notComplete

public static final int notComplete

notSubTypeOf

public static final int notSubTypeOf

NS_FRAME

public static final int NS_FRAME

NS_RESOLVER

public static final String NS_RESOLVER

REDEFINE

public static final int REDEFINE

REF_RESOLVED

public static final int REF_RESOLVED

REF_UNRESOLVED

public static final int REF_UNRESOLVED

refToAbstractElem

public static final int refToAbstractElem

refToAbstractType

public static final int refToAbstractType

RESTRICTION

public static final int RESTRICTION

SCHEMA_NS

public static final int SCHEMA_NS

SEQ

public static final int SEQ

STRICT_VALIDATION

public static final String STRICT_VALIDATION

TEXT_ONLY

public static final int TEXT_ONLY

TOP_LEVEL

public static final int TOP_LEVEL

TYPE

public static final int TYPE

TYPE_RESOLVED

public static final int TYPE_RESOLVED

TYPE_UNRESOLVED

public static final int TYPE_UNRESOLVED

UNDEF

public static final int UNDEF

undefinedType

public static final int undefinedType

unexpectedAttr

public static final int unexpectedAttr

unexpectedElem

public static final int unexpectedElem

unnamedAttrDecl

public static final int unnamedAttrDecl

VALIDATION_MODE

public static final String VALIDATION_MODE

XSDAUG2000NS

public static final String XSDAUG2000NS

XSDDATATYPENS

public static final String XSDDATATYPENS

XSDNAMESPACE

public static final String XSDNAMESPACE

XSDRECNS

public static final String XSDRECNS

XSDRECTYPENS

public static final String XSDRECTYPENS

XSI2000NS

public static final String XSI2000NS

XSINAMESPACE

public static final String XSINAMESPACE

XSIRECNS

public static final String XSIRECNS


XSDValidator Class


Description of XSDValidator

XSDValidator validates an instance XML document against an XMLSchema.

When registered, an XSDValidator object is inserted as a pipe-line node between XMLParser and XMLDocument events handler (SAXHandler or DOMBuilder). It works with three events: startElement(), characters() and endElement(). If defined, default element and default attribute values are added to the events contents as XMLSchema additions to infoset, and are propagated upwards.

The XMLSchema object is a set or group of element declarations:

 [element(name)] -> [shode(min/maxOccurs)] ->
  [type(group/simpleType)] 

XSDValidator is implemented as stack based state machine. Each state represents element type - group or simpleType.

XMLSchema object, as a group, is loaded as a first state. Current element is matched against current state group elements. If matched the element type element name and snode info are loaded as new state.

In a case of group, a vector of counters is allocated in a parallel stack. This vector is used to count element occurrences.

State status could be:

Text element contents, or event characters, are matched against simpleType through method validateValue(). End element, found through event endElement(), is matched against yjr last named state.

XMLSchema attributes are represented as a group (attrName -> attrType) forming the contents of special element: <_attrTag> attrType. XMLParser converts attributes, found through event startElement(), accordingly.

XSDAny objects are used as Namespace frame descriptors.

Fake states are loaded in a case of error or when wildcard('any') contents is skipped.


Syntax of XSDValidator

public class XSDValidator
 
oracle.xml.parser.schema.XSDValidator


Methods of XSDValidator

Table 6-14 Summary of Methods of XSDValidator  
Method Description

XSDValidator()

Class constructor.

characters()

Propagates notification of character data inside an element.

endElement()

Receives notification of the end of an element.

setDocumentLocator()

Propagates Locator object for document events.

setError()

Sets an XMLError object as current err.

setXMLProperties()

Sets XML Properties for runtime properties.

setXMLProperty()

Sets a property.

startElement()

Receive notification of a beginning of the element.

XSDValidator()

Description

XSDValidator constructor.

Syntax

public  XSDValidator();

characters()

Description

Propagate notification of character data inside an element. Throws org.xml.sax.SAXException, which can be any SAX exception, possibly wrapping another exception. See also org.xml.sax.DocumentHandler

Syntax

public void characters( char[] ch,
                        int start,
                        int length);

Parameter Description

ch

The characters

start

The start position in the character array.

length

The number of characters to use from the character array.

endElement()

Description

Receive notification of the end of an element. Throws org.xml.sax.SAXException, which can be any SAX exception, possibly wrapping another exception.

Syntax

public void endElement( String namespaceURI, 
                        String localName,
                        String qName);

Parameter Description

uri

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed

localName

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qName

The qualified XML 1.0 name (with prefix), or the empty string if qualified names are not available.

setDocumentLocator()

Description

Propagates Locator object for document events. See also org.xml.sax.DocumentHandler, org.xml.sax.Locator.

Syntax

public void setDocumentLocator( org.xml.sax.Locator locator);

Parameter Description

locator

A locator for all SAX document events

setError()

Description

Sets an XMLError object as current err. Throws org.xml.sax.SAXException, which can be any SAX exception, possibly wrapping another exception.

Syntax

public void setError( oracle.xml.parser.v2.XMLError he);

Parameter Description

he

XMLError object.

setXMLProperties()

Description

Sets XML Properties for runtime properties.

Syntax

public void setXMLProperties( XMLProperties xmlProp);

Parameter Description

xmlProp

XML properties.

setXMLProperty()

Description

Sets and returns a property. The value of the property set is returned if successfully set, a null is returned if the property is read-only and cannot be set or is not supported.

Syntax

public Object setXMLProperty( java.lang.String name,
                              java.lang.Object value);

Parameter Description

name

name of the property

value

value of the property

startElement()

Description

Receive notification of the beginning of an element. Throws org.xml.sax.SAXException, which can be any SAX exception, possibly wrapping another exception. See also: endElement(), org.xml.sax.Attributes.

Syntax

public void startElement( String namespaceURI,
                          String localName,
                          String qName,
                          Attributes atts);

Parameter Description

uri

The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed

localName

The local name (without prefix), or the empty string if Namespace processing is not being performed.

qName

The qualified name (with prefix), or the empty string if qualified names are not available.

atts

The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.


Go to previous page Go to next page
Oracle
Copyright © 2001, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback