|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jibx.schema.SchemaContextTracker
org.jibx.schema.validation.ValidationContext
public class ValidationContext
Tracks the schema validation state. This includes order-dependent state information collected while walking the tree structure of a schema model. Collects all errors and warnings and maintains a summary of the severity of the problems found. For ease of use, this also wraps the schema name register with convenience methods for validation. TODO: separate out a generalized base class and move the base out of the schema package
| Field Summary |
|---|
| Fields inherited from class org.jibx.schema.SchemaContextTracker |
|---|
m_nameRegister |
| Constructor Summary | |
|---|---|
ValidationContext()
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
addError(String msg,
Object obj)
Add error item. |
void |
addFatal(String msg,
Object obj)
Add fatal item. |
void |
addProblem(ValidationProblem problem)
Add problem report. |
protected void |
addSkip(Object skip)
Add element to set to be skipped. |
void |
addUnimplemented(String msg,
Object obj)
Add unimplemented feature item for current element. |
void |
addWarning(String msg,
Object obj)
Add warning item. |
AttributeElement |
findAttribute(QName qname)
Find global attribute by name. |
AttributeGroupElement |
findAttributeGroup(QName qname)
Find attribute group by name. |
ElementElement |
findElement(QName qname)
Find global element by name. |
GroupElement |
findGroup(QName qname)
Find group by name. |
CommonTypeDefinition |
findType(QName qname)
Find global type by name. |
int |
getErrorCount()
Get number of error problems reported. |
int |
getFatalCount()
Get number of fatal problems reported. |
ArrayList |
getProblems()
Get list of problems. |
SchemaElement |
getSchemaById(String id)
Get schema element by identifier. |
SchemaElement |
getSchemaByNamespace(String uri)
Get schema element by target namespace. |
int |
getSchemaCount()
Get the number of schemas processed by this context. |
int |
getUnimplementedCount()
Get number of unimplemented feature problems reported. |
int |
getWarningCount()
Get number of warning problems reported. |
boolean |
isSkipped(Object obj)
Check if a component is being skipped due to a fatal error. |
Iterator |
iterateSchemas()
Get iterator for all schemas defined in this context. |
void |
registerAttribute(QName qname,
AttributeElement def)
Register global attribute in the current schema definition. |
void |
registerAttributeGroup(QName qname,
AttributeGroupElement def)
Register global attribute group in the current schema definition. |
void |
registerElement(QName qname,
ElementElement def)
Register global element in the current schema definition. |
void |
registerGroup(QName qname,
GroupElement def)
Register global group in the current schema definition. |
void |
registerType(QName qname,
CommonTypeDefinition def)
Register global type in the current schema definition. |
boolean |
reportProblems(ProblemHandler handler)
Report problems using handler. |
void |
reset()
Reset context for reuse. |
void |
setSchema(String id,
SchemaElement schema)
Add schema element with identifier. |
| Methods inherited from class org.jibx.schema.SchemaContextTracker |
|---|
clearTraversed, enterSchema, exitSchema, getCurrentSchema, getNameRegister, setNameRegister |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ValidationContext()
| Method Detail |
|---|
public void reset()
public SchemaElement getSchemaByNamespace(String uri)
uri - unique namespace URI
null if not loaded or non-unique namespacepublic SchemaElement getSchemaById(String id)
id -
null if not loadedpublic Iterator iterateSchemas()
public void setSchema(String id,
SchemaElement schema)
id - schema - public int getSchemaCount()
public int getUnimplementedCount()
public int getWarningCount()
public int getErrorCount()
public int getFatalCount()
public void registerAttribute(QName qname,
AttributeElement def)
qname - namedef - attribute definition
public void registerAttributeGroup(QName qname,
AttributeGroupElement def)
qname - namedef - attribute definition
public void registerElement(QName qname,
ElementElement def)
qname - namedef - element definition
public void registerGroup(QName qname,
GroupElement def)
qname - namedef - attribute definition
public void registerType(QName qname,
CommonTypeDefinition def)
qname - namedef - attribute definitionpublic AttributeElement findAttribute(QName qname)
qname - name
null if not registeredpublic AttributeGroupElement findAttributeGroup(QName qname)
qname - name
null if not registeredpublic ElementElement findElement(QName qname)
qname - name
null if not registeredpublic GroupElement findGroup(QName qname)
qname - name
null if not registeredpublic CommonTypeDefinition findType(QName qname)
qname - name
null if not registered
public void addUnimplemented(String msg,
Object obj)
msg - problem descriptionobj - source object for validation error
public void addWarning(String msg,
Object obj)
msg - problem descriptionobj - source object for validation error
public boolean addError(String msg,
Object obj)
msg - problem descriptionobj - source object for validation error
true if to continue validation, false if not
public void addFatal(String msg,
Object obj)
msg - problem descriptionobj - source object for validation error (should be an element)public void addProblem(ValidationProblem problem)
problem - details of problem reportpublic ArrayList getProblems()
protected void addSkip(Object skip)
skip - public boolean reportProblems(ProblemHandler handler)
handler - problem handler
true if one or more errors, false if notpublic boolean isSkipped(Object obj)
ISkipElements
isSkipped in interface ISkipElementsobj - component to be checked
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||