Class TPathCache
The syntax constraints on attribute values are different than in pure XML: Whenever an embedded xpath expressions is indicated by an escape character, the further contents must be parsable as such. So "{@code a{}" is a valid value for any CDATA attribute in XML, but not in xslt result elements. <p> The involved compiler for AVTs is {@link AttributeValueTemplate}. It always delivers a {@link TPath.Expr}; if there are no opening brackets in the source, this will be one single constant literal expression. <br/> This value is turned into a an {@link ExprClassified}, which contains the parsed code and analysis results (or "null" in the code field iff there had been errors.) <p> Look-up and memorization go in two steps: (1) first look for verbatim cached source. (2) Then parse and look up for canonical source text. If look-up fails, perform analyses and store accordingly. <br/> + FIXME: List of all variable names collected !?!? <p> Additionally, the "sensitivity" on the context is calculated: <br/> None -> needs evaluation only once, is constant<br/> Session -> depends only on global variables, needs evaluation only once per application<br/> Multi -> depends on context (=input focus, local vars), needs always re-evaluation<br/> <br/> FIXME variable access is context depended. <br/> FIXME But if ALL appearing variable NAMES appear only on global level, this raises sensivity only to "session", not to "multi". <br/> FIXME the "union of relative and absolute" is not yet supported, (????) code has to be unified with <mt>/tpath/Util.isAbsolute() !!!!
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Holds the results of parsing and analysis.static class
Statistic data on the sub-expressions of the top-level TPath.Union expression.protected class
static enum
This value is ONLY related to the current-node-(list)-context, not to referred variables nor functions! -
Field Summary
Modifier and TypeFieldDescriptionstatic final TPath.Union
tpath "(preceding::node()|nacestor-or-self::node())"static final TPath.Step
static final TPath.AxisSpecifier
static final TPath.AxisSpecifier
static final TPath.AxisSpecifier
static final TPath.AxisSpecifier
static final TPath.AxisSpecifier
(package private) static final Map<TPath.Expr,
TPath.Expr> protected Map<String,
TPathCache.ExprClassified> (package private) TPathCache.PatternPart
(package private) boolean
(package private) Location<XMLDocumentIdentifier>
(package private) MessageReceiver<SimpleMessage<XMLDocumentIdentifier>>
(package private) boolean
static final TPath.Step
tpath "precedingSiblings::node()"(package private) final TPathCache.PredicateChecker
static final TPath.Step
(package private) String
(package private) TPathCache.ExprClassified
static final TPath.Node
static final TPath.Root
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Means to check the function which can appear as first (umod: deepest) expression on a path expression ("id(x)/a/b/")boolean
checkPattern
(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg_EXT, @Opt Location<XMLDocumentIdentifier> loc, TPathCache.ExprClassified expr, boolean inTemplateOrKeyMatch, String role) Returns whether the ExprClassified is a pattern, and updatesTPathCache.ExprClassified.patternParts
accordingly.protected void
checkStep
(TPath.Step step, boolean isTop) protected void
checkTop
(TPath.Expr expr) (package private) static TPath.Expr
copyLocation
(TPath.Expr newer, TPath.Expr old) (package private) void
(package private) static final TPath.Expr
Any expression of un-rooted type "a/b/..."
= TPath.Step()->base->Step->base->null
can be interpreted existentially quantified by prepending with
"/descendant-or-self::node()/a/b/.."
= TPath.Step()->base->Step->base-> (descendant-or-self) Root
This is realized by a copy, which is cached and can be used as key for the cached evaluation result.parse
(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg_EXT, Location<XMLDocumentIdentifier> loc, NamespaceName attribName, @Opt String data, boolean isTemplate) Parse expression source and store result to caches.protected void
splitTop
(TPath.Expr expr) (package private) static final TPath.Step
topStep
(TPath.Step step) (package private) static TPath.Expr
withRoot
(TPath.Expr expr, TPath.Expr root) Return a clone which has the given root instead of a base of null; distribute this over a possible top-level "union" operation.
-
Field Details
-
attributeValueTemplates_to_canonical
-
attributeValue_to_canonical
-
canonical_to_parsed
-
msg
-
loc
-
inTemplateOrKeyMatch
boolean inTemplateOrKeyMatch -
role
String role -
patternOkay
boolean patternOkay -
toCheck
TPathCache.ExprClassified toCheck -
curPart
TPathCache.PatternPart curPart -
predicateChecker
-
TPATH_NODE
-
TPATH_ROOT
-
AXIS_ANC_OR_SELF
-
AXIS_DESC
-
AXIS_DESC_OR_SELF
-
AXIS_PRECEDING
-
AXIS_PRECEDING_SIBS
-
RELATIVE_TO_PRECEDING
-
ANYWHERE_IN_DOM
-
ALL_LOWERS
tpath "(preceding::node()|nacestor-or-self::node())" -
PRECEDING_SIBS
tpath "precedingSiblings::node()" -
cache_all_quantified
-
-
Constructor Details
-
TPathCache
public TPathCache()
-
-
Method Details
-
parse
@Opt public @Opt TPathCache.ExprClassified parse(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg_EXT, Location<XMLDocumentIdentifier> loc, NamespaceName attribName, @Opt @Opt String data, boolean isTemplate) Parse expression source and store result to caches. Return null in case of parsing errors. Otherwise classify expression for sensitivity. Return cached value, iff it exists. FIXME dann stimmt rel2abs nicht !?!?!? (Error msg must contain an attribute name, since location has only element granularity.) -
error
-
checkStep
-
checkFunction
Means to check the function which can appear as first (umod: deepest) expression on a path expression ("id(x)/a/b/") -
checkTop
-
splitTop
-
checkPattern
public boolean checkPattern(MessageReceiver<SimpleMessage<XMLDocumentIdentifier>> msg_EXT, @Opt @Opt Location<XMLDocumentIdentifier> loc, TPathCache.ExprClassified expr, boolean inTemplateOrKeyMatch, String role) Returns whether the ExprClassified is a pattern, and updatesTPathCache.ExprClassified.patternParts
accordingly. Generates errors if ExprClassified is not correct as a pattern. -
copyLocation
-
withRoot
Return a clone which has the given root instead of a base of null; distribute this over a possible top-level "union" operation. -
topStep
-
make_all_quantified
Any expression of un-rooted type "a/b/..."
= TPath.Step()->base->Step->base->null
can be interpreted existentially quantified by prepending with
"/descendant-or-self::node()/a/b/.."
= TPath.Step()->base->Step->base-> (descendant-or-self) Root
This is realized by a copy, which is cached and can be used as key for the cached evaluation result.- Parameters:
expr
- an un-rooted expression serving as pattern-part, i.e. not a Union.
-