net.sf.vex.dom
Interface Validator

All Known Implementing Classes:
AbstractValidator

public interface Validator

Represents an object that can validate the structure of a document.


Field Summary
static java.lang.String PCDATA
          String indicating that character data is allowed at the given point in the document.
 
Method Summary
 AttributeDefinition[] getAttributeDefinitions(java.lang.String element)
          Returns the attribute definitions that apply to the given element.
 java.util.Set getValidItems(java.lang.String element, java.lang.String[] prefix, java.lang.String[] suffix)
          Returns a set of Strings representing items that are valid at point in the child nodes of a given element.
 boolean isValidSequence(java.lang.String element, java.lang.String[] nodes, boolean partial)
          Returns true if the given sequence is valid for the given element.
 boolean isValidSequence(java.lang.String element, java.lang.String[] seq1, java.lang.String[] seq2, java.lang.String[] seq3, boolean partial)
          Returns true if the given sequence is valid for the given element.
 

Field Detail

PCDATA

public static final java.lang.String PCDATA
String indicating that character data is allowed at the given point in the document.

See Also:
Constant Field Values
Method Detail

getAttributeDefinitions

public AttributeDefinition[] getAttributeDefinitions(java.lang.String element)
Returns the attribute definitions that apply to the given element.

Parameters:
element - Name of the element to check.

getValidItems

public java.util.Set getValidItems(java.lang.String element,
                                   java.lang.String[] prefix,
                                   java.lang.String[] suffix)
Returns a set of Strings representing items that are valid at point in the child nodes of a given element. Each string is either an element name or Validator.PCDATA.

Parameters:
element - Name of the parent element.
prefix - Array of strings representing nodes coming before the insertion point
suffix - Array of strings representing nodes coming after the insertion point

isValidSequence

public boolean isValidSequence(java.lang.String element,
                               java.lang.String[] nodes,
                               boolean partial)
Returns true if the given sequence is valid for the given element. Accepts three sequences, which will be concatenated before doing the check.

Parameters:
element - Name of the element being tested.
nodes - Array of element names and Validator.PCDATA.
partial - If true, an valid but incomplete sequence is acceptable.

isValidSequence

public boolean isValidSequence(java.lang.String element,
                               java.lang.String[] seq1,
                               java.lang.String[] seq2,
                               java.lang.String[] seq3,
                               boolean partial)
Returns true if the given sequence is valid for the given element. Accepts three sequences, which will be concatenated before doing the check.

Parameters:
element - Name of the element being tested.
seq1 - Array of element names and Validator.PCDATA.
seq2 - Array of element names and Validator.PCDATA. May be null or empty.
seq3 - Array of element names and Validator.PCDATA. May be null or empty.
partial - If true, an valid but incomplete sequence is acceptable.