net.sf.vex.dom
Class DTDValidator

java.lang.Object
  |
  +--net.sf.vex.dom.AbstractValidator
        |
        +--net.sf.vex.dom.DTDValidator
All Implemented Interfaces:
Validator

public class DTDValidator
extends AbstractValidator

A validator driven by a DTD.


Field Summary
 
Fields inherited from interface net.sf.vex.dom.Validator
PCDATA
 
Method Summary
static DTDValidator create(java.net.URL url)
          Creates a instance of DtdValidator given a URL.
 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.
 
Methods inherited from class net.sf.vex.dom.AbstractValidator
isValidSequence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static DTDValidator create(java.net.URL url)
                           throws java.io.IOException
Creates a instance of DtdValidator given a URL.

Parameters:
url - URL of the DTD file to use.
java.io.IOException

getAttributeDefinitions

public AttributeDefinition[] getAttributeDefinitions(java.lang.String element)
Description copied from interface: Validator
Returns the attribute definitions that apply to the given element.

Parameters:
element - Name of the element to check.
See Also:
Validator.getAttributeDefinitions(java.lang.String)

getValidItems

public java.util.Set getValidItems(java.lang.String element,
                                   java.lang.String[] prefix,
                                   java.lang.String[] suffix)
Description copied from interface: Validator
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
See Also:
Validator.getValidItems(java.lang.String, java.lang.String[], java.lang.String[])

isValidSequence

public boolean isValidSequence(java.lang.String element,
                               java.lang.String[] nodes,
                               boolean partial)
Description copied from interface: Validator
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.
See Also:
Validator.isValidSequence(java.lang.String, java.lang.String[], boolean)