Class Validator
- java.lang.Object
-
- com.google.javascript.jscomp.jsonml.Validator
-
public class Validator extends java.lang.Object
Statically validates JsonML elements. It is done in constant time: no subtree is traversed, but the element is validated based only on its properties. Sometimes, also its children are taken into account. Usually it checks if the specified element has a correct number of children, and if all require attributes exist. It does not enforce all restrictions which are implied by ES3 or ES5 specification.
-
-
Field Summary
Fields Modifier and Type Field Description static TagType[]
exprTypes
static java.lang.String
MISSING_ARGUMENT
static java.lang.String
NOT_ENOUGH_CHILDREN_FMT
static java.lang.String
TOO_MANY_CHILDREN_FMT
static java.lang.String
WRONG_CHILD_TYPE_FMT
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
printList(java.lang.Object[] list)
static java.lang.String
validate(JsonML element)
Validates the specified JsonML element.
-
-
-
Field Detail
-
MISSING_ARGUMENT
public static final java.lang.String MISSING_ARGUMENT
- See Also:
- Constant Field Values
-
NOT_ENOUGH_CHILDREN_FMT
public static final java.lang.String NOT_ENOUGH_CHILDREN_FMT
- See Also:
- Constant Field Values
-
TOO_MANY_CHILDREN_FMT
public static final java.lang.String TOO_MANY_CHILDREN_FMT
- See Also:
- Constant Field Values
-
WRONG_CHILD_TYPE_FMT
public static final java.lang.String WRONG_CHILD_TYPE_FMT
- See Also:
- Constant Field Values
-
exprTypes
public static TagType[] exprTypes
-
-
Method Detail
-
validate
public static java.lang.String validate(JsonML element)
Validates the specified JsonML element.- Parameters:
element
- JsonML element to validate- Returns:
- error message if the element could not be validated, an empty string otherwise
-
printList
public static java.lang.String printList(java.lang.Object[] list)
-
-