Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Application Server XML Java API Reference 10g Release 2 (10.1.2) Part no. B12024-03 September 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.xml.parser.schema
Class XSDValidator

    java.lang.Object
      |
      +--oracle.xml.parser.v2.XMLMultiHandler
            |
            +--oracle.xml.parser.schema.XSDValidator

All Implemented Interfaces:
  ContentHandler, XSDConstantValues

public class XSDValidator
extends XMLMultiHandler
implements XSDConstantValues

XSDValidator validates 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 up. As far as XSDValidator is concerned the XMLSchema object is a set/group of element declaratioms whith following structure: [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(event startElement) 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(int) is allocated in a parallel stack. This vector is used to count element occurances. State status could be: - NEW_STATE: just loaded and not tryed. - ACCEPTED: minOccurs satisfied. Could still accept element occurances. - DONE: maxOccurs satisfied. Doesn't accept element occurances. Text element contents(event characters) is matched against simpleType (method validateValue). End element (event endElement) is matched against last named state. XMLSchema attributes are represented as a group (attrName -> attrType) forming the contents of special element: <_attrTag> <attrName> attrType </attrName> ... </_attrTag> SMLParser converts attributes (event startElement) accordingly. (see method startElement)

Field Summary

Fields inherited from interface oracle.xml.parser.schema.XSDConstantValues
`_abstract, _all, _annotation, _any, _anyAttribute, _anySimpleType, _anyType, _appinfo, _attrFormDefault, _attribute, _attributeGroup, _attrTag, _base, _block, _blockDefault, _choice, _complexContent, _complexType, _content, _default, _derivedBy, _documentation, _element, _elementOnly, _elemFormDefault, _empty, _enumeration, _equivClass, _extension, _false, _field, _final, _finalDefault, _fixed, _form, _group, _id, _import, _include, _itemType, _key, _keyref, _lax, _list, _maxOccurs, _memberTypes, _minOccurs, _mixed, _nall, _name, _namespace, _nil, _nillable, _nnany, _nnlist, _nnlocal, _nnother, _nntargetNS, _noNSSchemaLocation, _notation, _null, _nullable, _optional, _pattern, _processContents, _prohibited, _publicid, _qualified, _redefine, _ref, _refer, _required, _restriction, _restrictions, _schema, _schemaLocation, _selector, _sequence, _simpleContent, _simpleType, _skip, _strict, _substitution, _substitutionGrp, _systemid, _targetNS, _textOnly, _this, _true, _type, _undef, _union, _unique, _unqualified, _use, _value, _version, _xmlns, ABSENT_NS, ACCEPTED, ALL, ANNOTATION, ANY, ANY_ATTRIBUTE, ANY_NODE, ATTRIBUTE, ATTRIBUTE_GROUP, AUTO_VALIDATION, BASE_RESOLVED, BASE_UNRESOLVED, BASE_URL, BUILD_FAIL, CHOICE, CIRCULAR_SUBST, CONFLICIT_FACET, constName, DATATYPE, DEEP_VALIDATION, derivationBlock, DONE, DUPLICATE_DEF, duplicateId, ELEMENT, ELEMENT_CHILD, ELEMENT_ONLY, elemNotNullable, EMPTY, ENTITY_RESOLVER, EQUIV_RESOLVED, EQUIV_UNRESOLVED, ERROR, EXTENTION, FACET_CHILD, FAKE_ATTR, FAKE_NODE, FIXED_SCHEMA, GROUP, IABSTRACT, IBLOCKEXT, IBLOCKRST, IBLOCKSUB, IDENTITY_ERROR, IDENTITY_KEY, IDENTITY_KEYREF, IDENTITY_UNIQUE, IFINALEXT, IFINALLIST, IFINALRST, IFINALUNION, IMPORT, INCLUDE, INCORRECT_ATTR, INCORRECT_ELEM, INFINITY, INTERNAL_ERROR, INVALID_DERIVATION, INVALID_FACET, INVALID_FACET_VALUE, INVALID_NOTATION, INVALID_REGEX, INVALID_SCHEMA_NS, INVALID_TYPE_VALUE, invalidAttr, invalidAttrVal, invalidChars, invalidElem, invalidFixedChars, invalidNS, invalidPrefix, invalidProperty, invalidRef, invalidSubstitution, invalidTargetNS, LAX_VALIDATION, MISSING_NS, missingAttr, MIXED, NEW_STATE, NO_CHILD, noDefinition, NOT_DONE, NOTATION, notComplete, notSubstitutable, notSubTypeOf, NS_CONFLICT, NS_DIF_SPECIFIED, NS_NOT_ALLOWED, NS_NOT_EXPECTED, NS_NOT_SAME, NS_RESOLVER, REDEFINE, REF_RESOLVED, REF_UNRESOLVED, RESTRICTION, SCHEMA_NS, SEQ, STRICT_VALIDATION, TEXT_ONLY, TOP_LEVEL, TYPE, TYPE_RESOLVED, TYPE_UNRESOLVED, UNDEF, unexpectedAttr, unexpectedElem, VALIDATION_MODE, VIOLATE_FACET, XSDRECNS, XSDRECTYPENS, XSIRECNS, XSITYPE_ABSENT`

Constructor Summary
`XSDValidator()` XSDValidator constructor.

Method Summary
`void` | `characters(char[] ch, int start, int length)` Propagate notification of character data inside an element.
`void` | `endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)` Receive notification of the end of an element.
`java.lang.String` | `getCurrentMode()` Get the current validation mode
`XSDElement` | `getElementDeclaration()` Get the current element declaration
`XSDNode` | `getTypeDefinition()` Get the current XSD type
`void` | `reset()` Reset the validator, prepare for next validation
`protected java.lang.String` | `resolve(java.lang.String prefix)`
`void` | `setDocumentLocator(Locator locator)` Propagates Locator object for document events.
`void` | `setError(XMLError he)` Sets an XMLError object as current err.
`java.lang.Object` | `setXMLProperty(java.lang.String name, java.lang.Object value)` Set a property.
`void` | `setXMLSchema(XMLSchema s)` Deprecated.
`void` | `startDocument()` Receive notification of the beginning of the document.
`void` | `startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts)` Receive notification of the beginning of an element.

Methods inherited from class oracle.xml.parser.v2.XMLMultiHandler
`addContentHandler, endDocument, endPrefixMapping, getContentHandlers, getNumContentHandlers, ignorableWhitespace, processingInstruction, removeContentHandler, skippedEntity, startPrefixMapping`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### XSDValidator

    public XSDValidator()
                 throws XSDException

  XSDValidator constructor.

Method Detail

### reset

    public void reset()

  Reset the validator, prepare for next validation

### setError

    public void setError(XMLError he)
                  throws SAXException

  Sets an XMLError object as current err.
  Parameters:
    `he` - XMLError object
  Throws:
    `SAXException` - A `SAXException` could be thrown.

### setXMLSchema

    public void setXMLSchema(XMLSchema s)
                      throws SAXException

  Deprecated.
  Sets an XMLSchema object as current schema.
  Parameters:
    `s` - XMLSchema object
  Throws:
    `SAXException` - A `SAXException` could be thrown.

### setXMLProperty

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

  Set 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.
  Parameters:
    `name` - - name of the property
    `value` - - value of the property
  Returns:
    Object - the set property

### getCurrentMode

    public java.lang.String getCurrentMode()

  Get the current validation mode
  Returns:
    a `_strict`, `_lax`, `_skip`, or `_error`

### getTypeDefinition

    public XSDNode getTypeDefinition()

  Get the current XSD type
  Returns:
    `XSDComplexType` node or `XSDSimpleType<code/> node`

### getElementDeclaration

    public XSDElement getElementDeclaration()

  Get the current element declaration
  Returns:
    `XSDElement` node

### startDocument

    public void startDocument()
                       throws SAXException

  Receive notification of the beginning of the document.
  Specified by:
    `startDocument` in interface `ContentHandler`
  Overrides:
    `startDocument` in class `XMLMultiHandler`
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `DocumentHandler.startDocument()`

### startElement

    public void startElement(java.lang.String namespaceURI,
                             java.lang.String localName,
                             java.lang.String qName,
    Attributes atts)
                      throws SAXException

  Receive notification of the beginning of an element.
  Specified by:
    `startElement` in interface `ContentHandler`
  Overrides:
    `startElement` in class `XMLMultiHandler`
  Parameters:
    `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.
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `endElement(java.lang.String, java.lang.String, java.lang.String)`, `Attributes`

### endElement

    public void endElement(java.lang.String namespaceURI,
                           java.lang.String localName,
                           java.lang.String qName)
                    throws SAXException

  Receive notification of the end of an element.
  Specified by:
    `endElement` in interface `ContentHandler`
  Overrides:
    `endElement` in class `XMLMultiHandler`
  Parameters:
    `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.
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.

### characters

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

  Propagate notification of character data inside an element.
  Specified by:
    `characters` in interface `ContentHandler`
  Overrides:
    `characters` in class `XMLMultiHandler`
  Parameters:
    `ch` - The characters.
    `start` - The start position in the character array.
    `length` - The number of characters to use from the character array.
  Throws:
    `SAXException` - Any SAX exception, possibly wrapping another exception.
  See Also:
    `DocumentHandler.characters(char[], int, int)`

### setDocumentLocator

    public void setDocumentLocator(Locator locator)

  Propagates Locator object for document events.
  Specified by:
    `setDocumentLocator` in interface `ContentHandler`
  Overrides:
    `setDocumentLocator` in class `XMLMultiHandler`
  Parameters:
    `locator` - A locator for all SAX document events.
  See Also:
    `DocumentHandler.setDocumentLocator(org.xml.sax.Locator)`, `Locator`

### resolve

    protected java.lang.String resolve(java.lang.String prefix)

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle® Application Server XML Java API Reference 10g Release 2 (10.1.2) Part no. B12024-03 September 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003, 2004, Oracle. All rights reserved.