Re: Use of string literal ("dummy") as namespace resolver in L3 XPath tests and other schema validation issues

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='&quot;//foo&quot;'
                     resolver='nullNSResolver'
                     />

   <createEntityReference var="contextNode" obj="doc" 
name="&quot;entityname&quot;"/>

   <assertDOMException id="throw_NOT_SUPPORTED_ERR">
     <NOT_SUPPORTED_ERR>
       <evaluate interface="XPathExpression"
                 obj='xpathExpression'
		expression='&quot;dummy&quot;'
		resolver='&quot;dummy&quot;'
                 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