|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
oracle.xml.parser.schema.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 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>
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. |
protected boolean |
pushState(XSDNode nd,
java.lang.String tag,
java.lang.String xsiType)
pushState ********************* |
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. |
void |
setXMLProperties(oracle.xml.util.XMLProperties xmlProp)
Set XML Properties for runtime proerties |
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. |
Constructor Detail |
public XSDValidator() throws XSDException
Method Detail |
public void reset()
public void setError(XMLError he) throws SAXException
he
- XMLError objectSAXException
could be thrown.public void setXMLProperties(oracle.xml.util.XMLProperties xmlProp)
xmlProp
- XMLPropertiespublic void setXMLSchema(XMLSchema s) throws SAXException
s
- XMLSchema objectSAXException
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 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, Attributes atts) throws SAXException
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.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
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.public void characters(char[] ch, int start, int length) throws SAXException
ch
- The characters.start
- The start position in the character array.length
- The number of characters to use from the
character array.DocumentHandler.characters(char[], int, int)
public void setDocumentLocator(Locator locator)
locator
- A locator for all SAX document events.DocumentHandler.setDocumentLocator(org.xml.sax.Locator)
,
Locator
protected boolean pushState(XSDNode nd, java.lang.String tag, java.lang.String xsiType)
protected java.lang.String resolve(java.lang.String prefix)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |