Package org.jibx.schema.elements
Class SchemaPath
- java.lang.Object
-
- org.jibx.schema.elements.SchemaPath
-
public class SchemaPath extends Object
Path specification within a schema definition. This implements simple XPath-like expressions, consisting of any number of path components given as element names or '*' for any element or '**' for any nesting of elements, along with optional position number or name attribute predicates in square brackets.- Author:
- Dennis M. Sosnoski
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSchemaPath.PathStepstatic classSchemaPath.StepBase
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SchemaPathbuildPath(String path, String elemname, String nameattr, String postext, Object obj, ValidationContext vctx)Build a path.intgetPathLength()Get length of this path (minimum number of nested elements).booleanisWildStart()Check if the first path step is a wildcard.OpenAttrBasematchUnique(OpenAttrBase base)Find unique match for expression starting from a supplied schema element annotation.ListpartialMatchMultiple(int first, int last, OpenAttrBase base)Find any number of matches for subexpression starting from a supplied schema element annotation.OpenAttrBasepartialMatchUnique(int first, int last, OpenAttrBase base)Find unique match for subexpression starting from a supplied schema element annotation.
-
-
-
Method Detail
-
getPathLength
public int getPathLength()
Get length of this path (minimum number of nested elements).- Returns:
- path length
-
isWildStart
public boolean isWildStart()
Check if the first path step is a wildcard.- Returns:
trueif wildcard,falseif not
-
partialMatchMultiple
public List partialMatchMultiple(int first, int last, OpenAttrBase base)
Find any number of matches for subexpression starting from a supplied schema element annotation.- Parameters:
first- starting path step indexlast- ending path step indexbase- starting element for match- Returns:
- matching element, or
nullif error
-
partialMatchUnique
public OpenAttrBase partialMatchUnique(int first, int last, OpenAttrBase base)
Find unique match for subexpression starting from a supplied schema element annotation. An error is reported if no match is found, or if multiple matches are found.- Parameters:
first- starting path step indexlast- ending path step indexbase- starting element for match- Returns:
- matching element, or
nullif error
-
matchUnique
public OpenAttrBase matchUnique(OpenAttrBase base)
Find unique match for expression starting from a supplied schema element annotation. An error is reported if no match is found, or if multiple matches are found.- Parameters:
base- starting element for match- Returns:
- matching element, or
nullif error
-
buildPath
public static SchemaPath buildPath(String path, String elemname, String nameattr, String postext, Object obj, ValidationContext vctx)
Build a path. If a path expression is supplied, the final path step in the expression must either not use an element name, or the element name must match the actual element supplied.- Parameters:
path- expression (nullif none)elemname- element name for final step in pathnameattr- name attribute (applied to final step in path,nullif none)postext- position (applied to final step in path,nullif none)obj- object defining the pathvctx- validation context- Returns:
- constructed path, or
nullif error
-
-