//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v1.0.6-b27-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.06.11 at 10:33:54 AM PDT
//
/**
* XMLSerializer that calls the native interface of MSV and performs validation.
* Used in a pair with a ValidationContext.
*
* @author Kohsuke Kawaguchi
*/
{
/** Current acceptor in use. */
/** Context object that coordinates the entire validation effort. */
/** The object which we are validating. */
/**
* Acceptor stack. Whenever an element is found, the current acceptor is
* pushed to the stack and new one is created.
*
* LightStack is a light-weight stack implementation
*/
return context.getNamespaceContext();
}
/**
* To use this class, call the static validate method.
*/
private MSVValidator( DefaultJAXBContextImpl _jaxbCtx, ValidationContext _ctxt, ValidatableObject vo ) {
}
/**
* Validates the specified object and reports any error to the context.
*/
public static void validate( DefaultJAXBContextImpl jaxbCtx, ValidationContext context, ValidatableObject vo )
throws SAXException {
try {
} catch( RuntimeException e ) {
// sometimes when a conversion between Java object and
// lexical value fails, it may throw an exception like
// NullPointerException or NumberFormatException.
//
// catch them and report them as an error.
}
}
/** performs the validation to the object specified in the constructor. */
// validate attributes
target.serializeURIs(this);
target.serializeAttributes(this);
// validate content model
target.serializeBody(this);
// some elements are missing
// report error
}
}
}
// some required attributes are missing.
// report a validation error
// Note that we don't know which property of this object
// causes this error.
emptyAttributes,this);
}
}
/** stores text reported by the text method. */
return;
}
}
}
// used to keep attribute names until the endAttribute method is called.
private boolean insideAttribute;
// we will do the processing at the end element
this.attNamespaceUri = uri;
this.attLocalName = local;
insideAttribute = true;
}
insideAttribute = false;
attLocalName /* we don't have QName, so just use the local name */,
// either the name was incorrect (which is quite unlikely),
// or the value was wrong.
// report an error
}
buf = new StringBuffer();
}
// assert(textBuf!=null);
// this text is invalid.
// report an error
}
buf = new StringBuffer();
else
}
// we pass in an empty attributes, as there is just no way for us to
// properly re-construct attributes. Fortunately, I know MSV is not using
// attribute values, so this would work, but nevertheless this code is
// ugly. This is one of the problems of the "middle" approach.
// this element is invalid. probably, so this object is invalid
// report an error
}
this.currentElementUri = uri;
this.currentElementLocalName = local;
}
// some required elements are missing
// report error
}
// pop the acceptor
// some required elements are missing.
// report an error
}
}
// do nothing
// either the onMarshallableObjectInElement method
// or the onMarshallableObjectInAttributeBody method will be
// called for every content tree objects.
//
// so we don't need to validate an object within this method.
}
// ditto.
}
/** An empty <code>Attributes</code> object. */
/** namespace URI of dummy elements. TODO: allocate one namespace URI for this. */
//final ValidatableObject vo = Util.toValidatableObject(o);
return;
}
else childAsElementBody(o,vo);
}
// if the object implements the RIElement interface,
// add a marker attribute to the dummy element.
//
// For example, if the object is org.acme.impl.FooImpl,
// the dummy element will look like
// <{DUMMY_ELEMENT_NS}org.acme.Foo
// {<URI of this element>}:<local name of this element>="" />
//
// This extra attribute is used to validate wildcards.
// AttributesImpl atts;
// if(o instanceof RIElement) {
// RIElement rie = (RIElement)o;
// atts = new AttributesImpl();
// atts.addAttribute(
// rie.____jaxb_ri____getNamespaceURI(),
// rie.____jaxb_ri____getLocalName(),
// rie.____jaxb_ri____getLocalName(), // use local name as qname
// "CDATA",
// ""); // we don't care about the attribute value
// } else
// atts = emptyAttributes;
// feed a dummy element to the acceptor.
intfName/*just pass the local name as QName.*/,
this );
// some required elements were missing. report errors
}
if(o instanceof RIElement) {
if(!child.onAttribute2(
"",
// this object is not a valid member of the wildcard
}
// this can't be possible, as the dummy element was
// generated by XJC.
throw new JAXBAssertionError();
}
// we need a separate validator instance to validate a child object
}
/*
Dirty quick hack. When we split a schema into fragments, basically
every chlid object needs a place holder in the fragment
(so that the parent schema fragment can correctly validate that the
child objects are at their supposed places.)
For example, cconsider the following schema:
imagine:
<class>
<attribute>
<list>
<oneOrMore>
<ref name="bar"/>
</oneOrMore>
</list>
</attribute>
</class>
In our algorithm, the corresponding schema fragment will be:
<class>
<attribute>
<list>
<oneOrMore>
<value>\u0000full.class.name.of.BarImpl</value>
</oneOrMore>
</list>
</attribute>
</class>
If we find a child object inside an attribute
(that's why we are in this method BTW),
we generate a class name (with a special marker \u0000).
*/
// put a class name with a special marker \u0000. This char is an invalid
// XML char, so sensible datatypes should reject this (although many
// datatype implementations will accept it in actuality)
// validate a child object
}
}
//
//
//
//
}
}
//
//
// ValidationContext implementation. Used by MSV to obtain
// contextual information related to validation.
//
//
// abandon the validation of ENTITY type.
return true;
}
// abandon the validation of NOTATION type.
return true;
}
// so we will not rely on the validator to perform this check.
// because we will use multiple instances of validators, so
// they cannot check global consistency.
}
}
}