- From: Bob Clary <bc@bclary.com>
- Date: Fri, 19 Dec 2003 12:21:50 -0500
- To: www-dom-ts@w3.org
- Message-ID: <3FE333AE.2020706@bclary.com>
Curt Arnold wrote:
>
> Several XPath tests (for example,
> XPathExpression_evaluate_NOT_SUPPORTED_ERR) used the string literal
> "dummy" as a namespace resolver. I believe all of these tests expected
> an exception for other reasons and the type mismatch would have
> satisified the expectation of an exception. If Mozilla actually takes a
> string literal as an namespace resolver, we should add a test that
> asserts that an implementation specific exception be thrown.
I used a dummy resolver and expression string in
XPathExpression.evaluate to get the test
<createExpression interface="XPathEvaluator"
obj='xpEvaluator'
var='xpathExpression'
expression='"//foo"'
resolver='nullNSResolver'
/>
<createEntityReference var="contextNode" obj="doc"
name=""entityname""/>
<assertDOMException id="throw_NOT_SUPPORTED_ERR">
<NOT_SUPPORTED_ERR>
<evaluate interface="XPathExpression"
obj='xpathExpression'
expression='"dummy"'
resolver='"dummy"'
var='result'
contextNode='contextNode'
type='0'
result='nullResult'/>
</NOT_SUPPORTED_ERR>
</assertDOMException>
to validate in the ML since
interface XPathExpression {
DOMObject evaluate(in Node contextNode,
in unsigned short type,
in DOMObject result)
raises(XPathException,
DOMException);
};
has no resolver or expression although the dom3.dtd has resolver and
expression as required
<!ELEMENT evaluate EMPTY >
<!ATTLIST evaluate
id ID #IMPLIED
obj CDATA #REQUIRED
var CDATA #REQUIRED
expression CDATA #REQUIRED
contextNode CDATA #REQUIRED
resolver CDATA #REQUIRED
type CDATA #REQUIRED
result CDATA #REQUIRED
interface (XPathEvaluator|XPathExpression) #REQUIRED
>
The generated ecmascript code did not contain the dummy string
xpEvaluator = createXPathEvaluator(doc);
xpathExpression = xpEvaluator.createExpression("//foo",nullNSResolver);
contextNode = doc.createEntityReference("entityname");
{
var success = false;
try {
result = xpathExpression.evaluate(contextNode,0,nullResult);
}
catch(ex) {
success = (ex.code == 9);
}
assertTrue("throw_NOT_SUPPORTED_ERR",success);
}
The real issue is the requirement in the DTD that <evaluate
interface="XPathExpression"/> have expression and resolver attributes.
/bc
Received on Friday, 19 December 2003 12:30:04 UTC