[XML-SIG] XPath IDL
Martin v. Loewis
martin@v.loewis.de
Fri, 21 Dec 2001 17:18:07 +0100
For those looking for the latest copy: see below
Regards,
Martin
// $Revision: 1.8 $
module XPath{
typedef wstring DOMString;
const unsigned short ABSOLUTE_LOCATION_PATH = 1;
const unsigned short ABBREVIATED_ABSOLUTE_LOCATION_PATH = 2;
const unsigned short RELATIVE_LOCATION_PATH = 3;
const unsigned short ABBREVIATED_RELATIVE_LOCATION_PATH = 4;
const unsigned short STEP_EXPR = 5; // STEP would conflict with Step in case
const unsigned short NODE_TEST = 6;
const unsigned short NAME_TEST = 7;
const unsigned short BOOLEAN_EXPR = 8;
const unsigned short NUMERIC_EXPR = 9;
const unsigned short PATH_EXPR = 10;
const unsigned short ABBREVIATED_PATH_EXPR = 11; // filter '//' path
const unsigned short FILTER_EXPR = 12;
const unsigned short VARIABLE_REFERENCE = 13;
const unsigned short LITERAL_EXPR = 14;
const unsigned short NUMBER_EXPR = 15;
const unsigned short FUNCTION_CALL = 16;
// XSLT
const unsigned short PATTERN = 17;
const unsigned short LOCATION_PATTERN = 18;
const unsigned short RELATIVE_PATH_PATTERN = 19;
const unsigned short STEP_PATTERN = 20;
Interface Expr{
readonly attribute unsigned short exprType;
DOMString pprint();
};
interface AbsoluteLocationPath;
interface AbbreviatedAbsoluteLocationPath;
interface RelativeLocationPath;
interface Step;
interface AxisSpecifier;
interface NodeTest;
typedef sequence<Expr> PredicateList, ExprList;
interface NameTest;
interface NumericExpr;
interface UnaryExpr;
interface UnionExpr;
interface PathExpr;
interface FilterExpr;
interface VariableReference;
interface Literal;
interface Number;
interface FunctionCall;
interface ExprFactory{
AbsoluteLocationPath createAbsoluteLocationPath(in RelativeLocationPath p);
AbsoluteLocationPath createAbbreviatedAbsoluteLocationPath(in RelativeLocationPath p);
RelativeLocationPath createRelativeLocationPath(in RelativeLocationPath left,
in Step right);
RelativeLocationPath createAbbreviatedRelativeLocationPath(in RelativeLocationPath left,
in Step right);
Step createStep(in AxisSpecifier axis, in NodeTest test, in PredicateList predicates);
// . is represented as self::node(); .. as parent::node()
Step createAbbreviatedStep(in boolean dotdot); // false for .; true for ..
// An omitted axisname is created as CHILD; @ is created as ATTRIBUTE
AxisSpecifier createAxisSpecifier(in unsigned short name);
NodeTest createNodeTest(in unsigned short type);
NameTest createNameTest(in DOMString prefix, in DOMString localName);
NumericExpr createNumericExpr(in unsigned short operator, in Expr left, in Expr right);
UnaryExpr createBooleanExpr(in unsigned short operator, in Expr left, in Expr right);
PathExpr createPathExpr(in Expr filter, in Expr path);
// filter '//' path
PathExpr createAbbreviatedPathExpr(in Expr filter, in Expr path);
FilterExpr createFilterExpr(in Expr filter, in Expr predicate);
// the name must not contain the leading $
VariableReference createVariableReference(in DOMString prefix, in DOMString localName);
Literal createLiteral(in DOMString literal);
Number createNumber(in DOMString value);
FunctionCall createFunctionCall(in DOMString prefix, in DOMString localName, in ExprList args);
};
interface Parser{
Expr parseExpr(in DOMString path);
};
interface AbsoluteLocationPath:Expr{
/* '/' relative-opt, or '//' relative */
readonly attribute Expr relative; // step or relative path, or null
};
interface RelativeLocationPath:Expr{
readonly attribute Expr left; // step or relative path
readonly attribute Step right;
};
interface Step:Expr{
readonly attribute AxisSpecifier axis;
readonly attribute NodeTest test;
readonly attribute PredicateList predicates;
};
const unsigned short ANCESTOR_AXIS = 1;
const unsigned short ANCESTOR_OR_SELF_AXIS = 2;
const unsigned short ATTRIBUTE_AXIS = 3; // attribute is a keyword
const unsigned short CHILD_AXIS = 4;
const unsigned short DESCENDANT_AXIS = 5;
const unsigned short DESCENDANT_OR_SELF_AXIS = 6;
const unsigned short FOLLOWING_AXIS = 7;
const unsigned short FOLLOWING_SIBLING_AXIS = 8;
const unsigned short NAMESPACE_AXIS = 9;
const unsigned short PARENT_AXIS = 10;
const unsigned short PRECEDING_AXIS = 11;
const unsigned short PRECEDING_SIBLING_AXIS = 12;
const unsigned short SELF_AXIS = 13;
interface AxisSpecifier:Expr{
readonly attribute unsigned short axisType;
};
const unsigned short COMMENT = 1;
const unsigned short TEXT = 2;
const unsigned short PROCESSING_INSTRUCTION = 3;
const unsigned short NODE = 4;
interface NodeTest:Expr{
readonly attribute unsigned short testType;
readonly attribute DOMString literal; // only for PROCESSING_INSTRUCTION
};
interface NameTest:Expr{
readonly attribute DOMString prefix; // may be null
readonly attribute DOMString localName; // may be "*"
};
// objects implement either NumericExpr or BooleanExpr
interface BinaryExpr:Expr{
readonly attribute unsigned short operator;
readonly attribute Expr left,right;
};
const unsigned short OR_OPERATOR = 1;
const unsigned short AND_OPERATOR = 2;
const unsigned short EQ_OPERATOR = 3;
const unsigned short NEQ_OPERATOR = 4;
const unsigned short LT_OPERATOR = 5;
const unsigned short GT_OPERATOR = 6;
const unsigned short LE_OPERATOR = 7;
const unsigned short GE_OPERATOR = 8;
interface BooleanExpr:BinaryExpr{
};
const unsigned short PLUS_OPERATOR = 9;
const unsigned short MINUS_OPERATOR = 10;
const unsigned short TIMES_OPERATOR = 11;
const unsigned short DIV_OPERATOR = 12;
const unsigned short MOD_OPERATOR = 13;
const unsigned short UNION_OPERATOR = 14;
interface NumericExpr:BinaryExpr{
};
interface PathExpr:Expr{
readonly attribute Expr filter;
readonly attribute Expr path;
};
interface FilterExpr:Expr{
readonly attribute Expr filter;
readonly attribute Expr predicate;
};
interface VariableReference:Expr{
readonly attribute DOMString name;
};
interface Literal:Expr{
readonly attribute DOMString value;
};
interface Number:Expr{
readonly attribute double value;
};
interface FunctionCall:Expr{
readonly attribute DOMString name;
readonly attribute ExprList args;
};
// XSLT
interface Pattern;
interface LocationPathPattern;
interface RelativePathPattern;
interface StepPattern;
interface PatternFactory:ExprFactory{
Pattern createPattern(in LocationPathPattern first);
// If idkey is not null, it represents IdKeyPattern
// if parent is true, it is '/', else '//'
// rel may be null
LocationPathPattern createLocationPathPattern(in FunctionCall idkey,
boolean parent,
in RelativePathPattern rel);
// if parent is true, it is /, else //
RelativePathPattern createRelativePathPattern(in RelativePathPattern rel,
boolean parent,
in StepPattern step);
StepPattern createStepPattern(in AxisSpecifier axis,
in NodeTest test,
in PredicateList predicates);
};
typedef sequence<LocationPathPattern> LocationPathPatterns;
interface Pattern:Expr{
readonly attribute LocationPathPatterns patterns;
void append(in LocationPathPattern pattern);
};
interface LocationPathPattern:Expr{
readonly attribute FunctionCall idkey;
readonly attribute boolean parent;
readonly attribute RelativePathPattern relative_pattern;
};
interface RelativePathPattern:Expr{
readonly attribute RelativePathPattern relative;
readonly attribute boolean parent;
readonly attribute StepPattern step;
};
interface StepPattern:Expr{
readonly attribute AxisSpecifier axis;
readonly attribute NodeTest test;
readonly attribute PredicateList predicates;
};
interface XSLTParser:Parser{
Pattern parsePattern(in DOMString pattern);
};
};