edu.byu.deg.osmx.binding.impl.runtime
Class ValidationContext

java.lang.Object
  extended byedu.byu.deg.osmx.binding.impl.runtime.ValidationContext

class ValidationContext
extends Object

Maintains information that needs to be stored across validations of multiple objects. Specifically, this object is responsible for:

  1. detecting a cycle in a content tree by keeping track of objects that were validated.
  2. keeping an instance of NamespaceContextImpl, which is shared by all MSVValidators.
  3. keeping a reference to ValidationErrorHandler. MSVValidators should use this error handler to report any error.


Constructor Summary
(package private) ValidationContext(javax.xml.bind.ValidationEventHandler _eventHandler, boolean validateID)
           
 
Method Summary
 NamespaceContextImpl getNamespaceContext()
           
 String onID(XMLSerializable owner, String value)
           
 String onIDREF(XMLSerializable referer, String value)
           
protected  void reconcileIDs()
          Tests if all IDREFs have corresponding IDs.
 void reportEvent(ValidatableObject source, Exception nestedException)
          Reports an error to the client.
 void reportEvent(ValidatableObject source, String formattedMessage)
          Reports an error to the application.
 void reportEvent(ValidatableObject source, javax.xml.bind.ValidationEvent event)
           
 void validate(ValidatableObject vo)
          Validates the sub-tree rooted at vo and reports any errors/warnings to the error handler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidationContext

ValidationContext(javax.xml.bind.ValidationEventHandler _eventHandler,
                  boolean validateID)
Parameters:
validateID - if true, ID/IDREF validation will be performed.
Method Detail

validate

public void validate(ValidatableObject vo)
              throws SAXException
Validates the sub-tree rooted at vo and reports any errors/warnings to the error handler.

Returns:
true if there was no error. false otherwise.
Throws:
SAXException

getNamespaceContext

public NamespaceContextImpl getNamespaceContext()

onID

public String onID(XMLSerializable owner,
                   String value)
            throws SAXException
Throws:
SAXException

onIDREF

public String onIDREF(XMLSerializable referer,
                      String value)
               throws SAXException
Throws:
SAXException

reconcileIDs

protected void reconcileIDs()
                     throws SAXException
Tests if all IDREFs have corresponding IDs.

Throws:
SAXException

reportEvent

public void reportEvent(ValidatableObject source,
                        String formattedMessage)
                 throws com.sun.xml.bind.serializer.AbortSerializationException
Reports an error to the application.

Throws:
com.sun.xml.bind.serializer.AbortSerializationException

reportEvent

public void reportEvent(ValidatableObject source,
                        Exception nestedException)
                 throws com.sun.xml.bind.serializer.AbortSerializationException
Reports an error to the client. This version should be used when an exception is thrown from sub-modules.

Throws:
com.sun.xml.bind.serializer.AbortSerializationException

reportEvent

public void reportEvent(ValidatableObject source,
                        javax.xml.bind.ValidationEvent event)
                 throws com.sun.xml.bind.serializer.AbortSerializationException
Throws:
com.sun.xml.bind.serializer.AbortSerializationException