| Oracle9i XML API Reference - XDK and Oracle XML DB Release 2 (9.2) Part Number A96616-01 |
|
The full functionality of XML Schema Processor for Java is contained in the oracle.XML.parser.schema package.
This chapter discusses the following topics:
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.
public class XMLSchemaNode extendsoracle.xml.parser.schema.XSDNodeoracle.xml.parser.schema.XSDNode| +--oracle.xml.parser.schema.XMLSchemaNode
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 |
Returns all the Target Name space defined in the schema.
public java.lang.String[] getAllTargetNS();
Returns schemaNode for the given namespace.
public XMLSchemaNode getSchemaByTargetNS( String namespace);
| Parameter | Description |
|---|---|
|
namespace |
Target namespace of the required schema. |
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.
public String getSchemaTargetNS();
Returns XMLSchemaNode table as a hashtable.
public java.util.Hashtable getXMLSchemaNodeTable();
Returns XMLSchema URLs as an array.
public java.lang.String[] getXMLSchemaURLS();
Print schema information. The options are described in the following table.
| Syntax | Description |
|---|---|
|
public void printSchema(); |
Prints schema information. |
|
boolean all); |
Prints schema information, including build-ins. |
| Parameter | Description |
|---|---|
|
all |
Flag to indicate that all information, including build-ins, should be printed |
This class contains sets of top level Schema components in a target namespace.
public class XMLSchemaNode extendsoracle.xml.parser.schema.XSDNodeoracle.xml.parser.schema.XSDNode| +--oracle.xml.parser.schema.XMLSchemaNode
XMLSchema constructor.
public XMLSchemaNode();
Returns all the top level attributes in the schema as an array.
public XSDAttribute getAttributeDeclarations();
Returns all the top level complex type elements in the schema as an array.
public XSDNode getComplexTypeSet();
Returns the complex type definitions as a hashtable.
public java.util.Hashtable getComplexTypeTable();
Returns all the top level elements in the schema as an array.
public XSDNode getElementSet();
Returns all the top level simpleType elements in the schema as an array.
public XSDNode getSimpleTypeSet();
Returns the simple type definitions, in a hashtable.
public java.util.Hashtable getSimpleTypeTable();
Returns targetNS of the schema. Overrides XSDNode.getTargetNS() in class XSDNode.
public String getTargetNS();
Returns the type definitions as a hashtable.
public java.util.Hashtable getTypeDefinitionTable();
This class represents Schema Attribute declaration.
public class XSDAttribute extendsoracle.xml.parser.schema.XSDNodeoracle.xml.parser.schema.XSDNode| +--oracle.xml.parser.schema.XSDAttribute
Returns the value of 'default' attr in case of element, and the value of 'value' attr based on 'use' attribute.
public String getDefaultVal();
Returns the default value of 'fixed' attr in case of element, and the value of 'value' attr based on 'use' attribute.
public java.lang.String getFixedVal();
Returns the name of the node. Overrides XSDNode.getName() in class XSDNode.
public String getName();
Returns the refLocal name of the resolved 'ref' attribute
public String getRefLocalname();
Returns the RefNamespace of the resolved 'ref' attribute.
public String getRefNamespace();
Returns refState value. The return value is one of the following: TYPE_UNRESOLVED, TYPE_RESOLVED, REF_UNRESOLVED, REF_RESOLVED.
public int getRefState();
Returns target namespace. XSDNode.getTargetNS() in class XSDNode.
public String getTargetNS();
Returns the node type which is either simpleTypeor complexType.
public XSDNode getType();
Checks if the attribute is required.
public boolean isRequired();
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).
public class XSDBuilder
XSDBuilder constructor.
public XSDBuilder() throws XSDException;
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.
Returns XML schema object.
public Object getObject();
Sets 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 object.
public void setError( XMLError er);
| Parameter | Description |
|---|---|
|
er |
XMLError object |
Sets locale for error reporting.
public void setLocale(L ocale locale);
| Parameter | Description |
|---|---|
|
locale |
Locale object |
This class represents the Schema ComplexType definition.
public class XSDComplexType extendsoracle.xml.parser.schema.XSDNodeoracle.xml.parser.schema.XSDNode| +--oracle.xml.parser.schema.XSDComplexType
Returns attribute declarations of this complex type; does not include wild card array of attribute declarations.
public XSDAttribute getAttributeDeclarations();
Returns attribute wildcard of this complex type.
public oracle.xml.parser.schema.XSDAny getAttributeWildcard();
The attribute wildcard if has one
Returns the base type of this complextype.
public XSDNode getBaseType();
Returns content of XSDComplexType.
public int getContent();
Returns information on how was this type derived from its parent type. One of EXTENSION_DERIVATION or RESTRICTION_DERIVATION.
public short getDerivationMethod();
Returns an array of all the local elements inside a complexType element.
public XSDNode getElementSet();
Returns the attribute group or the child & attribute group.
public XSDGroup getGroup();
Returns the local name of resolved 'base' attr.
public java.lang.String getRefLocalname();
Returns type group of Complex Type.
public XSDGroup getTypeGroup();
Initializes complex type.
public static void init();
Returns TRUE if the Complex Type is abstract.
public boolean isAbstract();
This class represents Schema Constraining facet for Data Type.
public class XSDConstrainingFacet extends java.lang.Object implements
oracle.xml.parser.schema.XSDTypeConstants
java.lang.Object
|
+--oracle.xml.parser.schema.XSDConstrainingFacet
XSDTypeConstants
Returns the facet id.
public int getFacetId();
Returns the LEXICAL enumeration of the constraining facet.
public java.util.Vector getLexicalEnumeration();
Returns the LEXICAL value of a constraining facet.
public String getLexicalValue();
Returns the name of the constraining facet.
public String getName();
Checks whether facet is fixed and cannot be changed. Returns TRUE for fixed, FALSE otherwise.
public boolean isFixed();
Sets whether facet is fixed and cannot be changed. TRUE for fixed, FALSE otherwise.
public void setFixed( boolean fixed);
| Parameter | Description |
|---|---|
|
value |
Value being validated. |
Validates the value against the constraint facet.
public void validateFacet( XSDDataValue value);
| Parameter | Description |
|---|---|
|
value |
Value being validated. |
This class represents data values for Schema Simple Type.
public class XSDDataValue extends java.lang.Object implements
oracle.xml.parser.schema.XSDTypeConstants
java.lang.Object
|
+--oracle.xml.parser.schema.XSDDataValue
XSDTypeConstants
Compares two values; returns -1 for smaller, 0 for equal, and 1 for greater. Throws XSDException if the data values are not comparable.
public int compareTo( XSDDataValue val);
Gets the length of STRING/BINARY value. Throws XSDException if the data value is not of String/Binary type.
public int getLength();
Returns LEXICAL value from the XSDDataValue class.
public String getLexicalValue();
Returns the precision of decimal value. Throws XSDException if the data values are not decimal type.
public int getPrecision();
Returns the int value of a decimal scale. Throws XSDException if the data value is not decimal type.
public int getScale();
The XSDElement class represents the Schema element declaration.
public class XSDElement oracle.xml.parser.schema.XSDElement
Finds the equivalent class corresponding to this class.
public XSDElement findEquivClass( String ns,
String nm);
| Parameter | Description |
|---|---|
|
ns |
Namespace. |
|
rm |
Name. |
Returns the value of 'default' attr in case of element, and the value of 'value' attr based on 'use' attribute.
public String getDefaultVal();
Returns the local name of the resolved equivalent class.
public String getEquivClassRef();
Returns the value of 'fixed' attr in case of element, and the value of 'value' attr based on 'use' attribute
public java.lang.String getFixedVal();
Returns the set of identities, as an array.
public XSDIdentity getIdentities();
Returns the maxOccurs
public int getMaxOccurs();
Returns the minOccurs.
public int getMinOccurs();
Returns the name of the node.
public String getName();
Returns the local name of the resolved 'ref' attribute
public String getRefLocalname();
Returns the namespace of the resolved 'ref' attribute
public String getRefNamespace();
Returns refState. The return value is one of the following: TYPE_UNRESOLVED, TYPE_RESOLVED, REF_UNRESOLVED, REF_RESOLVED.
public int getRefState();
Returns the substitutionGroup
public java.util.Vector getSubstitutionGroup();
Returns target namespace.
public java.lang.String getTargetNS();
Returns the node type, either simpleType or complexType.
public XSDNode getType();
Returns TRUE if this element is abstract.
public boolean isAbstract();
Returns TRUE if this element is nullable.
public boolean isNullable();
Sets the maxOccurs.
public void setMaxOccurs( int max);
| Parameter | Description |
|---|---|
|
maxOccurs |
value |
Sets 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 the following table.
| Syntax | Description |
|---|---|
|
public String getMessage() |
Constructs error message from error id and error parameters |
|
XMLError err) |
Constructs localized error message based on the XMLError sent as parameter |
| Parameter | Description |
|---|---|
|
err |
XMLError class used to get the error message |
The XSDGroup class represents the Schema group definition.
public class XSDGroup oracle.xml.parser.schema.XSDGroup
Returns the maxOccurs.
public int getMaxOccurs();
Returns the minOccurs.
public int getMinOccurs();
Returns the particles of the group stored in nodeVector.
public java.util.Vector getNodeVector();
Returns the composite type - ALL, SEQUENCE, or CHOICE
public int getOrder();
Sets maxOccurs.
public void setMaxOccurs( int max);
| Parameter | Description |
|---|---|
|
maxOccurs |
value |
Sets the minOccurs.
public void setMinOccurs( int min);
| Parameter | Description |
|---|---|
|
minOccurs |
value |
This class represents Schema Identity-Constraint definition: Unique, Key, and Keyref.
public class XSDIdentity extendsoracle.xml.parser.schema.XSDNodeoracle.xml.parser.schema.XSDNode| +--oracle.xml.parser.schema.XSDIdentity
| Method | Description |
|---|---|
|
Returns the fields. |
|
|
Returns the node type. |
|
|
Returns the reference key. |
|
|
Returns the selector. |
Returns the fields.
public java.lang.String[] getFields();
Returns the node Type. Overrides XSDNode.getNodeType() in class XSDNode.
public int getNodeType();
Returns the referenced key
public String getRefer();
Returns the selector.
public String getSelector();
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 |
|---|---|