Oracle9i Supplied Java Packages Reference Release 2 (9.2) Part Number A96609-01 |
|
This chapter describes the oracle.XML.parser.schema package. The classes contained in package oracle.XML.parser.schema implement the Oracle XML Schema Processor for Java.
In addition to the class reference, this chapter contains these sections:
The classes contained in package oracle.XML.parser.schema implement the Oracle XML Schema Processor for Java and support the World Wide Web Consortium (W3C) XML Schema specification.
XML Schema can be used to define a class of XML documents. The term instance document describes an XML document that conforms to a particular XML Schema definition or XSD. This document assumes familiarity with the W3C recommendations for XML Schema. The W3C recommendations can be found at http://www.w3.org/.
The Oracle XML Schema Processor for Java is built on the Oracle XML Parser for Java v2 and includes these features:
To run XML Schema Processor for Java, you need an operating system that supports Java 1.1.x or above and the JDK 1.1.x. or above.
The classes contained in package oracle.xml.parser.schema implement support for XML Schema and for XML Schema Definition.
This class contains a set of XML Schemas for different target namespaces. They are used by XSDParser for validation of instance XML documents, and by XSDBuilder as imported schemas.
public class XMLSchema extendsoracle.xml.parser.schema.XSDNode
oracle.xml.parser.schema.XSDNode
| +--oracle.xml.parser.schema.XMLSchema
XMLSchema class constructor.
Syntax |
---|
public XMLSchema() throws XSDException |
public XMLSchema(int n) throws XSDException |
Parameter | Description |
---|---|
n |
Initial size of schemanode set |
Get all the Target Name spaces defined in the Schema.
public java.lang.String[] getAllTargetNS()
Get schemaNode for the given namespace.
public XMLSchemaNode
getSchemaByTargetNS(java.lang.String namespace)
namespace
- Target namespace of the required schema
XMLSchemaNode
Get the top level schema's target Namespace. In case there are more than one top level schema, the last one being built is returned.
public java.lang.String getSchemaTargetNS()
Get XMLSchemaNode table
public java.util.Hashtable getXMLSchemaNodeTable()
Hashtable
Get XMLSchema URLs
public java.lang.String[] getXMLSchemaURLS()
Array of schema URLs
Print schema information.
Syntax | Description |
---|---|
public void printSchema() |
Prints schema information |
public void printSchema( boolean all) |
Prints schema information, including buildins |
Parameter | Description |
---|---|
all |
Flag to indicate that all information, including built-ins, should be printed. |
XMLSchemaNode class sets top-level XMLSchema document declarations and definitions plus schema location and schema target namespace. XMLSchema objects are created by XSDBuilder as a result of processing XMLSchema documents.
public class XMLSchemaNode extendsoracle.xml.parser.schema.XSDNode
oracle.xml.parser.schema.XSDNode
| +--oracle.xml.parser.schema.XMLSchemaNode
XNLSchema constructor.
public XMLSchemaNode()
Get all the top level attributes in the schema
public XSDAttribute
getAttributeDeclarations()
an array of top level attribute definitions
Get all the top level complexType elements in the schema
public XSDNode
getComplexTypeSet()
an array of top level complexType nodes
Get the complexType definitions
public java.util.Hashtable getComplexTypeTable()
Hashtable of complexTypes
Get all the top level elements in the schema
public XSDNode
getElementSet()
an array of top level XSDNode elements
Get all the top level simpleType elements in the schema
public XSDNode
getSimpleTypeSet()
an array of top level simpleType nodes
Get the simple type definitions
public java.util.Hashtable getSimpleTypeTable()
Hashtable of simpleTypes
Get targetNS of the schema. Overrides XSDNode.getTargetNS()
in class XSDNode.
public java.lang.String getTargetNS()
value targetNS
Get the type definitions
public java.util.Hashtable getTypeDefinitionTable()
Hashtable of type definitions
XSDAttribute class. Represents the complexType attribute group for XMLSchema.
public class XSDAttribute extendsoracle.xml.parser.schema.XSDNode
oracle.xml.parser.schema.XSDNode
| +--oracle.xml.parser.schema.XSDAttribute
Get the value of 'default' attr in case of element, and the value of 'value' attr based on 'use' attribute
public java.lang.String getDefaultVal()
defaultVal
Get the value of 'fixed' attr in case of element, and the value of 'value' attr based on 'use' attribute
public java.lang.String getFixedVal()
defaultVal
Get the name of the node. Overrides XSDNode.getName()
in class XSDNode
public java.lang.String getName()
name
Get the local name of the resolved 'ref' attribute
public java.lang.String getRefLocalname()
refLocalname
Get the namespace of the resolved 'ref' attribute
public java.lang.String getRefNamespace()
refNamespace
Get refState. The return value is one of the following: TYPE_UNRESOLVED, TYPE_RESOLVED, REF_UNRESOLVED, REF_RESOLVED
public int getRefState()
refstate value
Get target namespace
public java.lang.String getTargetNS()
XSDNode.getTargetNS()
in class XSDNode
Get the node type
public XSDNode
getType()
nodeType, which is either simpleType or complexType.
Check if the attribute is required.
public boolean isRequired()
Builds an XMLSchema object from XMLSchema document. XMLSchema object is a set of objects (infoset) corresponding to top-level schema declarations and 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 and definitions are registered as a current schema infoset of items. Finally, top-level tree elements (infoset items) are 'Schema' parsed. The resulting 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 info (min/maxOccurs).
public class XSDBuilder extendsoracle.xml.parser.schema.XSDNode
oracle.xml.parser.schema.XSDNode
| +--oracle.xml.parser.schema.XSDBuilder
XSDBuilder constructor.
public XSDBuilder() throws XSDException
Build an XMLSchema object/document.
Object - XMLSchema
An Exception is thrown if Builder fails to build an XMLSchema object.
Returns XML schema object.
public Object getObject()
XMLSchema object.
Set an EntityResolver for resolving imports/include. See also org.xml.sax.EintityResolver.
public void setEntityResolver( org.xml.sax.entityResolver entResolver)
Parameter | Description |
---|---|
entResolver |
EntityResolver |
Sets XMLError error object.
public void setError(XMLError er)
Parameter | Description |
---|---|
er |
XMLError object |
Sets locale for error reporting.
public void setLocale(Locale locale)
Parameter | Description |
---|---|
locale |
Locale object |
XSDComplexType class manages the complexType for XML Schema Definition (XSD) for XML document. In XML Schema, the structure of the instance document or an element is called complexType.
public class XSDComplexType extendsoracle.xml.parser.schema.XSDNode
oracle.xml.parser.schema.XSDNode
| +--oracle.xml.parser.schema.XSDComplexType
Get attribute declarations of this complexType; does not include wild card array of attribute declarations
public XSDAttribute
getAttributeDeclarations()
Get attribute wildcard of this complexType.
public oracle.xml.parser.schema.XSDAny getAttributeWildcard()
The attribute wildcard, if this type has one.
Get the base type of this complexType.
public XSDNode
getBaseType()
XSDNode - base type
Get the content of this complexType.
public int getContent()
Returns a numeric code indicating the kind of derivation used to construct this type.
public short getDerivationMethod()
A code number for: EXTENSION_DERIVATION or RESTRICTION_DERIVATION.
Gets all the local elements inside a complexType element if the complexType element extends another complexType element
public XSDNode
getElementSet()
an array of local elements
Get the attribute group or the child and attribute group
public XSDGroup
getGroup()
group
Get the local name of resolved 'base' attr
public java.lang.String getRefLocalname()
refLocalname
Get the kind of group for this complexType as either: model group or attribute group.
public XSDGroup
getTypeGroup()
Initialize this group.
public static void init()
Make the group abstract or not abstract, with Boolean true or false.
public boolean isAbstract()
Implements the XSDConstants interface.
public class XSDConstants oracle.xml.parser.schema.XSDConstants
Class constructor.
public XSDConstants()
Implements XSDTypeConstants. XML Schema defines fifteen facets for applying constraints when deriving a datatype through restriction. Facets constrain the permitted values of a datatype.
Some facets use a value space for defining the restrictions on a datatype. A value space is the set of values for a given datatype. A lexical space is the set of valid literals for a datatype. Enumeration constrains the value space to a specified set of values. Each value in the value space of a datatype is denoted by one or more literals in its lexical space.
public class XSDConstrainingFacet extends java.lang.Object implements
oracle.xml.parser.schema.XSDTypeConstants
java.lang.Object
|
+--oracle.xml.parser.schema.XSDConstrainingFacet
XSDTypeConstants
Get the facet ID.
public int getFacetId()
Get the starting and ending points for the enumerated literals that define the value space for this facet.
public java.util.Vector getLexicalEnumeration()
Get value for lexical space for facet.
public java.lang.String getLexicalValue()
Get name of facet.
public java.lang.String getName()
Declare facet is fixed or not fixed, with Boolean true or false.
public boolean isFixed(boolean fixed)
Validate facet against XML Schema Definition.
public void validateFacet(XSDDataValue
value)
Implements XSDTypeConstants
public class XSDDataValue extends java.lang.Object implements
oracle.xml.parser.schema.XSDTypeConstants
java.lang.Object
|
+--oracle.xml.parser.schema.XSDDataValue
XSDTypeConstants
Compare two values; return int -1 -- smaller, 0 -- equal, 1 -- greater
public int compareTo(XSDDataValue
val)
XSDException
- if the data values are not comparable
Gets the length of STRING/BINARY value; return int length.
public int getLength()
XSDException
- if the data value is not of String/Binary type
Gets LEXICAL value from the XSDDataValue class; return String value
public java.lang.String getLexicalValue()
Gets the precision of decimal value return int precision
public int getPrecision()
XSDException
- if the data value is not of decimal type
Gets the scale of decimal value return int scale
public int getScale()
XSDException
- if the data value is not decimal type
XSDElement class. Represents XMLSchema Definition for element.
public class XSDElement oracle.xml.parser.schema.XSDElement
Find the equivalent class corresponding to this class
public XSDElement
findEquivClass(java.lang.String ns, java.lang.String nm)
Parameter | Description |
---|---|
ns |
namespace for class |
nm |
name of class |
XSDElement
Get the value of 'default' attr in case of element, and the value of 'value' attr based on 'use' attribute
public String getDefaultVal()
defaultVal
Get the local name of the resolved equiv class
public String getEquivClassRef()
equivRefLocalname
Get the value of 'fixed' attr in case of element, and the value of 'value' attr based on 'use' attribute
public java.lang.String getFixedVal()
defaultVal
Returns the set of identities
public XSDIdentity
getIdentities()
array of identities
Get the maxOccurs
public int getMaxOccurs()
maxOccurs
Get the minOccurs
public int getMinOccurs()
minOccurs value
Get the name of the node
public String getName()
name
Get the local name of the resolved 'ref' attribute
public String getRefLocalname()
refLocalname
Get the namespace of the resolved 'ref' attribute
public String getRefNamespace()
refNamespace
Get refState. The return value is one of the following: TYPE_UNRESOLVED, TYPE_RESOLVED, REF_UNRESOLVED, REF_RESOLVED
public int getRefState()
refstate value
Get the substitutionGroup
public java.util.Vector getSubstitutionGroup()
Get target namespace
public java.lang.String getTargetNS()
Get the node type
public XSDNode
getType()
nodeType, which is either simpleType or complexType
Declares is or is not abstract.
public boolean isAbstract()
Declares is or is not nullable.
public boolean isNullable()
Set the maxOccurs
public void setMaxOccurs(int max)
Parameter | Description |
---|---|
maxOccurs |
value |
Set the minOccurs
public void setMinOccurs(int min)
Parameter | Description |
---|---|
minOccurs |
value |
Indicates that an exception occurred during XMLSchema validation.
java.lang.Object | +---java.lang.Throwable | +---java.lang.Exception | +---oracle.xml.parser.schema.XSDException public class XSDException extends Exception
Overrides getMessage in class Throwable, in order to construct error message from error id and error parameters. The options are described in Table 7-22:
Parameter | Description |
---|---|
err |
XMLError class used to get the error message |
XSDGroup represents the model group for the XMLSchema. A model group may further contain model groups or element particles.
public class XSDGroup oracle.xml.parser.schema.XSDGroup
Method | Description |
---|---|
Get the maxOccurs |
|
Get the minOccurs |
|
Get the particles of the group stored in nodeVector |
|
Get the composite type - ALL, SEQUENCE, CHOICE |
|
Set maxOccurs |
|
Set minOccurs |
Get the maxOccurs
public int getMaxOccurs()
maxOccurs
Get the minOccurs
public int getMinOccurs()
minOccurs
Get the particles of the group stored in nodeVector
public java.util.Vector getNodeVector()
nodeVector
Get the composite type - ALL, SEQUENCE, or CHOICE
public int getOrder()
order
Set maxOccurs
public void setMaxOccurs(int max)
Parameter | Description |
---|---|
maxOccurs |
value |
Set the minOccurs
public void setMinOccurs(int min)
Parameter | Description |
---|---|
minOccurs |
value |
XSDElement presents identity parameters for the XSD for XMLSchema.
public class XSDIdentity extendsoracle.xml.parser.schema.XSDNode
oracle.xml.parser.schema.XSDNode
| +--oracle.xml.parser.schema.XSDIdentity
Method | Description |
---|---|
Get the fields |
|
Get the node type |
|
Get the reference key |
|
Get the selector |
Get the fields
public java.lang.String[] getFields()
fields
Get the node Type. Overrides XSDNode.getNodeType()
in class XSDNode
public int getNodeType()
nodeType
Get the referenced key
public java.lang.String getRefer()
referenced key
Get the selector
public java.lang.String getSelector()
selector
Root class for most of XSD classes. Contains fields and methods corresponding to XMLSchema definition attributes.
public class XSDNode oracle.xml.parser.schema.XSDNode
XMLSchema
,XMLSchemaNode
,XSDAttribute
,XSDComplexType
,XSDIdentity
Method | Description |
---|---|
Get the name of the node |
|
Get namespace URI |
|
Get the type of XSDNode. |
|
Get target namespace |
|
Checks if the node is of the give type |
Get the name of the node
public java.lang.String getName()
name
Get namespace URI.
public java.lang.String getNamespaceURI()
targetNS
Get the type of XSDNode.
public int getNodeType()
nodeType
Get target namespace
public java.lang.String getTargetNS()
targetNS
Checks if the node is of the give type
public boolean isNodeType(int type)
Parameter | Description |
---|---|
type |
type of node that is being checked |
Implements XSDTypeContstants to derive a type.
public class XSDSimpleType implements oracle.xml.parser.schema.XSDTypeConstants
oracle.xml.parser.schema.XSDSimpleType
XSDTypeConstants
Class constructor. The options are described in Table 7-31:
Syntax | Description |
---|---|
public XSDSimpleType() |
default constructor |
public XSDSimpleType(int basic, String nm) |
derived |
Derive a type from the given base type.
public staticXSDSimpleType
derivedFrom(XSDSimpleType
source, String nm, String var)
Parameter | Description |
---|---|
source |
XSDSimpleType The base type |
nm |
String The name of the new type |
var |
String The method of derivation |
XSDException
- if new type can not be created.
Specify the base type from which to derive this type.
public XSDSimpleType
getBase()
Gets the basic type from which this type was derived.
public int getBasicType()
basicType
Gets a built-in datatype
public static Hashtable getBuiltInDatatypes()
Parameter | Description |
---|---|
type |
Name of the built-in type |
XSDException
if the type is not a valid name
Get the facets for this datatype.
public XSDConstrainingFacet
getFacets()
facets
public int getMaxOccurs()
Get the value of maxOccurs
1
Get the value of minOccurs
public int getMinOccurs()
1
Get the variety of the type
public java.lang.String getVariety()
variety
Declares Boolean for abstract, true or false.
public boolean isAbstract()
Sets a facet for the datatype (Internal private API)
public void setFacet(String facetName, String value)
Parameter | Description |
---|---|
facetName |
name of the facet being set |
value |
value of the facet |
XSDException
- if the facet is invalid
Set the value of maxOccurs
public void setMaxOccurs(int max)
Parameter | Description |
---|---|
max |
number of maximum occurrences |
Set the value of minOccurs.
public void setMinOccurs(int min)
Parameter | Description |
---|---|
min |
number of minimum occurrences |
Sets the base type of the datatype, or for aggregate types, sets the type of the component of the aggregate type.
public void setSource(XSDNode
src)
Parameter | Description |
---|---|
src |
XSDNode source |
XSDException
if the src is not a valid type
Validates the string value with the facets defined for this type.
public void validateValue(java.lang.String val)
Parameter | Description |
---|---|
val |
value to be validated |
XSDException
if the value is not valid
Implements the interface for XSDTypeConstants.
public interface XSDTypeConstants
XSDDataValue
,XSDConstrainingFacet
,XSDSimpleType
XSDValidator validates an instance XML document against an XMLSchema.
[element(name)] -> [snode(min/maxOccurs)] -> [type(group/simpleType)]
public class XSDValidator oracle.xml.parser.schema.XSDValidator
XSDValidator constructor.
public XSDValidator()
Propagate notification of character data inside an element. See also org.xml.sax.DocumentHandler
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. |
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.
Receive notification of the end of an element.
public void endElement(String namespaceURI, String localName, String qName)
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.
Propagates Locator object for document events.
See also org.xml.sax.DocumentHandler
, org.xml.sax.Locator
public void setDocumentLocator(org.xml.sax.Locator locator)
Parameter | Description |
---|---|
locator |
A locator for all SAX document events |
Sets an XMLError object as current err.
public void setError(oracle.xml.parser.v2.XMLError he)
Parameter | Description |
---|---|
he |
XMLError object |
SAXException
- A SAXException
could be thrown.
Set XML Properties for runtime properties
public void setXMLProperties(XMLProperties xmlProp)
Parameter | Description |
---|---|
xmlProp |
XMLProperties |
value |
value of the property |
Set a property. The value of the property is returned if successfully set. A null is returned if the property is read-only and cannot be set or is not supported.
public Object setXMLProperty(java.lang.String name, java.lang.Object value)
Parameter | Description |
---|---|
name |
name of the property |
value |
value of the property |
Object the set property
Receive notification of the beginning of an element.
See also: endElement(String, String, String)
, org.xml.sax.Attributes
public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
org.xml.sax.SAXException
- Any SAX exception, possibly wrapping another exception.
|
Copyright © 1996, 2002 Oracle Corporation. All Rights Reserved. |
|