ds.Expr Extends
Create a new expression. An expression uses a string expression language, and from this string and a passed in DataNode can evaluate to a value, DataNode, or a DataNodeList.

Inheritance

Constructor

goog.ds.Expr(opt_expr)

Parameters

opt_expr : string=
The string expression.

Instance Methods

Public Protected Private
Defined in goog.ds.Expr
getLast() ?string
Gets the last part of the expression.
Returns: ?string  Last part of the expression.
code »
getNext() goog.ds.Expr
Gets the parent expression of this expression, or null if this is top level
Returns: goog.ds.Expr  The parent.
code »
getNode(opt_dsopt_canCreate) goog.ds.DataNode
Evaluate an expression on a data node, and return the first matching node Recursively walks through child nodes to evaluate
Arguments:
opt_ds : goog.ds.DataNode=
Optional datasource to evaluate against. If not provided, evaluates against DataManager global root.
opt_canCreate : boolean=
If true, will try to create new nodes.
Returns: goog.ds.DataNode  Matching nodes, or null if doesn't exist.
code »
getNodes(opt_dsopt_canCreate) goog.ds.DataNodeList
Evaluate an expression on a data node, and return matching nodes Recursively walks through child nodes to evaluate
Arguments:
opt_ds : goog.ds.DataNode=
Optional datasource to evaluate against. If not provided, evaluates against data root.
opt_canCreate : boolean=
If true, will try to create new nodes.
Returns: goog.ds.DataNodeList  Matching nodes.
code »
getNodes_(opt_dsopt_selectOneopt_canCreate) goog.ds.DataNode | goog.ds.DataNodeList
Evaluate an expression on a data node, and return the first matching node Recursively walks through child nodes to evaluate
Arguments:
opt_ds : goog.ds.DataNode=
Optional datasource to evaluate against. If not provided, evaluates against DataManager global root.
opt_selectOne : boolean=
Whether to return single matching DataNode or matching nodes in DataNodeList.
opt_canCreate : boolean=
If true, will try to create new nodes.
Returns: goog.ds.DataNode | goog.ds.DataNodeList  Matching node or nodes, depending on value of opt_selectOne.
code »
getParent() goog.ds.Expr
Gets the parent expression of this expression, or null if this is top level
Returns: goog.ds.Expr  The parent.
code »
getSource() string
Get the source data path for the expression
Returns: string  The path.
code »
getValue(opt_ds) *
Evaluate an expression on a data node, and return a value Recursively walks through child nodes to evaluate TODO(user) Support other expression functions
Arguments:
opt_ds : goog.ds.DataNode=
Optional datasource to evaluate against. If not provided, evaluates against DataManager global root.
Returns: *  Value of the node, or null if doesn't exist.
code »
setSource_(expropt_partsopt_childExpropt_prevExpr)
Set the source expression text & parse
Arguments:
expr : string
The string expression source.
opt_parts : Array=
Array of the parts of an expression.
opt_childExpr : goog.ds.Expr=
Optional child of this expression, passed in as a hint for processing.
opt_prevExpr : goog.ds.Expr=
Optional preceding expression (i.e. $A/B/C is previous expression to B/C) passed in as a hint for processing.
code »

Instance Properties

Defined in goog.ds.Expr
canBeEmpty_ :
Whether the expression can be null.
Code »
exprFn_ :
The function used by this expression
Code »
isAllAttributes_ :
Does this expression select all DOM-style attribute nodes (starts with '@')
Code »
isAllChildNodes_ :
Does this expression select all DOM-style child nodes (element and text)
Code »
isAllElements_ :
Does this expression select all DOM-style element child nodes
Code »
isCurrent_ :
Whether the expression evaluates to current node
Code »
isJustAttribute_ :
Whether the expression is just an attribute
Code »
last_ :
The last path in the expression
Code »
nextExpr_ : goog.ds.Expr
Cached value for the next expression.
Code »
parentExpr_ : goog.ds.Expr
Cached value for the parent expression.
Code »
parts_ :
The parsed paths in the expression
Code »
root_ :
The root node path in the expression
Code »
size_ :
Number of paths in the expression
Code »

Static Methods

goog.ds.Expr.create(expr) goog.ds.Expr
Create an expression from a string, can use cached values
Arguments:
expr : string
The expression string.
Returns: goog.ds.Expr  The expression object.
code »
goog.ds.Expr.createInternal_(opt_expropt_partsopt_childExpropt_prevExpr) goog.ds.Expr
Create an expression from a string, can use cached values Uses hints from related expressions to help in creation
Arguments:
opt_expr : ?string=
The string expression source.
opt_parts : Array=
Array of the parts of an expression.
opt_childExpr : goog.ds.Expr=
Optional child of this expression, passed in as a hint for processing.
opt_prevExpr : goog.ds.Expr=
Optional preceding expression (i.e. $A/B/C is previous expression to B/C) passed in as a hint for processing.
Returns: goog.ds.Expr  The expression object.
code »

Static Properties

goog.ds.Expr.ALL_ATTRIBUTES : goog.ds.Expr
For DOM interop - all DOM attribute nodes Attribute nodes have dataName starting with "@"
Code »
goog.ds.Expr.ALL_CHILD_NODES : goog.ds.Expr
For DOM interop - all DOM child nodes (text + element). Text nodes have dataName #text
Code »
goog.ds.Expr.ALL_ELEMENTS : goog.ds.Expr
For DOM interop - all DOM element child nodes
Code »
goog.ds.Expr.COUNT : goog.ds.Expr
Get the count of nodes matching an expression
Code »
goog.ds.Expr.CURRENT : goog.ds.Expr
The current node
Code »
goog.ds.Expr.NAME : goog.ds.Expr
Get the dataName of a node
Code »
goog.ds.Expr.POSITION : goog.ds.Expr
Get the position of the "current" node in the current node list This will only apply for datasources that support the concept of a current node (none exist yet). This is similar to XPath position() and concept of current node
Code »
goog.ds.Expr.cache_ :
Cache of pre-parsed expressions
Code »

Enumerations

goog.ds.Expr.String_ :
Commonly used strings in expressions.
Constants:
ALL_ATTRIBUTES_EXPR
No description.
ALL_CHILD_NODES_EXPR
No description.
ALL_ELEMENTS_EXPR
No description.
ATTRIBUTE_START
No description.
CAN_BE_EMPTY
No description.
COUNT_EXPR
No description.
CURRENT_NODE_EXPR
No description.
EMPTY_EXPR
No description.
INDEX_END
No description.
INDEX_START
No description.
NAME_EXPR
No description.
POSITION_EXPR
No description.
SEPARATOR
No description.
Code »

Package ds

Package Reference