|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ValidationContext
Interface that defines functionality exposed by the "owner" of the content to validate (usually a stream reader or stream writer) to validators, needed in addition to actually validatable content, for succesful validation. It also defines methods needed for infoset augmentation some validators do, such as adding default values to attributes. Some of functionality is optional (for example, writer may not have any useful location information).
The functionality included is close to the minimal subset of functionality needed to support 3 main streamable schema languages (DTD, W3C Schema, Relax NG).
Method Summary | |
---|---|
int |
addDefaultAttribute(java.lang.String localName,
java.lang.String uri,
java.lang.String prefix,
java.lang.String value)
An optional method that can be used to add a new attribute value for an attribute that was not yet contained by the container, as part of using attribute default value mechanism. |
int |
findAttributeIndex(java.lang.String nsURI,
java.lang.String localName)
|
int |
getAttributeCount()
This method returns number of attributes accessible from within currently active start element. |
java.lang.String |
getAttributeLocalName(int index)
|
java.lang.String |
getAttributeNamespace(int index)
|
java.lang.String |
getAttributePrefix(int index)
|
java.lang.String |
getAttributeValue(int index)
|
java.lang.String |
getAttributeValue(java.lang.String nsURI,
java.lang.String localName)
|
java.lang.String |
getBaseUri()
|
javax.xml.namespace.QName |
getCurrentElementName()
Method that can be used to access name information of the innermost (top) element in the element stack. |
java.lang.String |
getNamespaceURI(java.lang.String prefix)
Method that can be called by the validator to resolve a namespace prefix of the currently active top-level element. |
javax.xml.stream.Location |
getValidationLocation()
Method that will return the location that best represents current location within document to be validated, if such information is available. |
java.lang.String |
getXmlVersion()
Method that validator can call to figure out which xml version document being validated declared (if none, "1.0" is assumed as per xml specifications 1.0 and 1.1). |
boolean |
isNotationDeclared(java.lang.String name)
|
boolean |
isUnparsedEntityDeclared(java.lang.String name)
|
void |
reportProblem(XMLValidationProblem problem)
Method called by the validator, upon encountering a validation problem. |
Method Detail |
---|
java.lang.String getXmlVersion()
javax.xml.namespace.QName getCurrentElementName()
java.lang.String getNamespaceURI(java.lang.String prefix)
int getAttributeCount()
Note: this method is only guaranteed to be callable during execution
of XMLValidator
methods
XMLValidator.validateElementStart(java.lang.String, java.lang.String, java.lang.String)
,
XMLValidator.validateAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
and
XMLValidator.validateElementAndAttributes()
. At other times
implementations may choose to allow it to be called (for example,
with information regarding last start element processed), to throw
a IllegalArgumentException
, or to return 0 to indicate no
attribute information is available.
Also note that whether defaulted attributes (attributes for which values are only available via attribute defaulting) are accessible depends on exact time when this method is called, and in general can not be assumed to function reliably.
java.lang.String getAttributeLocalName(int index)
java.lang.String getAttributeNamespace(int index)
java.lang.String getAttributePrefix(int index)
java.lang.String getAttributeValue(int index)
java.lang.String getAttributeValue(java.lang.String nsURI, java.lang.String localName)
int findAttributeIndex(java.lang.String nsURI, java.lang.String localName)
boolean isNotationDeclared(java.lang.String name)
boolean isUnparsedEntityDeclared(java.lang.String name)
java.lang.String getBaseUri()
javax.xml.stream.Location getValidationLocation()
Note: it is likely that even when a location is known, it may not be very accurate; for example, when attributes are validated, it is possible that they all would point to a single location that may point to the start of the element that contains attributes.
void reportProblem(XMLValidationProblem problem) throws XMLValidationException
ValidationProblemHandler
be set by the application,
to define handling.
XMLValidationException
int addDefaultAttribute(java.lang.String localName, java.lang.String uri, java.lang.String prefix, java.lang.String value)
Note: caller has to ensure that the addition would not introduce a duplicate; attribute container implementation is not required to do any validation on attribute name (local name, prefix, uri) or value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |