|
Oracle® XML Java API Reference Release 1 (10.1) B12024-01 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--oracle.xml.parser.v2.XMLMultiHandler
|
+--oracle.xml.parser.schema.XSDValidator
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) XSDAny objects are used as Namespace frame descriptors (see XMLSchema definition of 'any' element). Fake states are loaded in a case of error or when wildcard('any') contents is skipped.
| Field Summary |
| 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 |
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 |
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, startDocument, startPrefixMapping |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public XSDValidator()
throws XSDException
| Method Detail |
public void reset()
public void setError(XMLError he)
throws SAXException
he - XMLError objectSAXException - A SAXException could be thrown.
public void setXMLSchema(XMLSchema s)
throws SAXException
s - XMLSchema objectSAXException - A SAXException could be thrown.
public java.lang.Object setXMLProperty(java.lang.String name,
java.lang.Object value)
name - - name of the propertyvalue - - value of the propertypublic java.lang.String getCurrentMode()
_strict, _lax, _skip, or _errorpublic XSDNode getTypeDefinition()
XSDComplexType node or XSDSimpleType<code/> nodepublic XSDElement getElementDeclaration()
XSDElement node
public void startElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName,
Attributes atts)
throws SAXException
startElement in interface ContentHandlerstartElement in class XMLMultiHandlerlocalName - 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.SAXException - Any SAX exception, possibly wrapping another exception.endElement(java.lang.String, java.lang.String, java.lang.String), Attributes
public void endElement(java.lang.String namespaceURI,
java.lang.String localName,
java.lang.String qName)
throws SAXException
endElement in interface ContentHandlerendElement in class XMLMultiHandlerlocalName - 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.SAXException - Any SAX exception, possibly wrapping another exception.
public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class XMLMultiHandlerch - The characters.start - The start position in the character array.length - The number of characters to use from the character array.SAXException - Any SAX exception, possibly wrapping another exception.DocumentHandler.characters(char[], int, int)public void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlersetDocumentLocator in class XMLMultiHandlerlocator - A locator for all SAX document events.DocumentHandler.setDocumentLocator(org.xml.sax.Locator), Locator
|
Oracle® XML Java API Reference Release 1 (10.1) B12024-01 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||