ISchemaListener
, ISkipElements
public class ValidationContext extends SchemaContextTracker implements ISkipElements
Modifier and Type | Field | Description |
---|---|---|
private java.util.Set |
m_duplicateNamespaces |
Set of namespaces with multiple schemas.
|
private int |
m_errorCount |
Number of errors reported.
|
private int |
m_fatalCount |
Number of fatals reported.
|
private java.util.Map |
m_idSchemaMap |
Map from identifier to schema.
|
private java.util.Map |
m_namespaceSchemaMap |
Map from namespace URI to schema.
|
private java.util.ArrayList |
m_problemList |
List of problem items reported by validation.
|
private java.util.Set |
m_skipSet |
Set of elements to be skipped in walking tree.
|
private int |
m_unimplementedCount |
Number of unimplementeds reported.
|
private int |
m_warningCount |
Number of warnings reported.
|
private static Logger |
s_logger |
Logger for class.
|
m_nameRegister
Constructor | Description |
---|---|
ValidationContext() |
Constructor.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
addError(java.lang.String msg,
java.lang.Object obj) |
Add error item.
|
void |
addFatal(java.lang.String msg,
java.lang.Object obj) |
Add fatal item.
|
void |
addProblem(ValidationProblem problem) |
Add problem report.
|
protected void |
addSkip(java.lang.Object skip) |
Add element to set to be skipped.
|
void |
addUnimplemented(java.lang.String msg,
java.lang.Object obj) |
Add unimplemented feature item for current element.
|
void |
addWarning(java.lang.String msg,
java.lang.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.
|
java.util.ArrayList |
getProblems() |
Get list of problems.
|
SchemaElement |
getSchemaById(java.lang.String id) |
Get schema element by identifier.
|
SchemaElement |
getSchemaByNamespace(java.lang.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(java.lang.Object obj) |
Check if a component is being skipped due to a fatal error.
|
java.util.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(java.lang.String id,
SchemaElement schema) |
Add schema element with identifier.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clearTraversed, enterSchema, exitSchema, getCurrentSchema, getNameRegister, setNameRegister
private static final Logger s_logger
private java.util.Map m_idSchemaMap
private java.util.Map m_namespaceSchemaMap
private java.util.Set m_duplicateNamespaces
private int m_unimplementedCount
private int m_warningCount
private int m_errorCount
private int m_fatalCount
private java.util.ArrayList m_problemList
private java.util.Set m_skipSet
public void reset()
public SchemaElement getSchemaByNamespace(java.lang.String uri)
uri
- unique namespace URInull
if not loaded or non-unique namespacepublic SchemaElement getSchemaById(java.lang.String id)
id
- null
if not loadedpublic java.util.Iterator iterateSchemas()
public void setSchema(java.lang.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 definitionpublic void registerAttributeGroup(QName qname, AttributeGroupElement def)
qname
- namedef
- attribute definitionpublic void registerElement(QName qname, ElementElement def)
qname
- namedef
- element definitionpublic void registerGroup(QName qname, GroupElement def)
qname
- namedef
- attribute definitionpublic void registerType(QName qname, CommonTypeDefinition def)
qname
- namedef
- attribute definitionpublic AttributeElement findAttribute(QName qname)
qname
- namenull
if not registeredpublic AttributeGroupElement findAttributeGroup(QName qname)
qname
- namenull
if not registeredpublic ElementElement findElement(QName qname)
qname
- namenull
if not registeredpublic GroupElement findGroup(QName qname)
qname
- namenull
if not registeredpublic CommonTypeDefinition findType(QName qname)
qname
- namenull
if not registeredpublic void addUnimplemented(java.lang.String msg, java.lang.Object obj)
msg
- problem descriptionobj
- source object for validation errorpublic void addWarning(java.lang.String msg, java.lang.Object obj)
msg
- problem descriptionobj
- source object for validation errorpublic boolean addError(java.lang.String msg, java.lang.Object obj)
msg
- problem descriptionobj
- source object for validation errortrue
if to continue validation, false
if notpublic void addFatal(java.lang.String msg, java.lang.Object obj)
msg
- problem descriptionobj
- source object for validation error (should be an element)public void addProblem(ValidationProblem problem)
problem
- details of problem reportpublic java.util.ArrayList getProblems()
protected void addSkip(java.lang.Object skip)
skip
- public boolean reportProblems(ProblemHandler handler)
handler
- problem handlertrue
if one or more errors, false
if notpublic boolean isSkipped(java.lang.Object obj)
ISkipElements
isSkipped
in interface ISkipElements
obj
- component to be checked