### Eclipse Workspace Patch 1.0 #P Saxon-HE_latest9.5 Index: hej/net/sf/saxon/s9api/XPathExecutable.java =================================================================== --- hej/net/sf/saxon/s9api/XPathExecutable.java (revision 851) +++ hej/net/sf/saxon/s9api/XPathExecutable.java (working copy) @@ -8,12 +8,14 @@ package net.sf.saxon.s9api; import net.sf.saxon.expr.StaticContext; +import net.sf.saxon.om.StructuredQName; import net.sf.saxon.sxpath.IndependentContext; import net.sf.saxon.sxpath.XPathExpression; import net.sf.saxon.sxpath.XPathVariable; -import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; /** * An XPathExecutable represents the compiled form of an XPath expression. @@ -49,10 +51,10 @@ */ public XPathSelector load() { - ArrayList declaredVariables = new ArrayList(); + Map declaredVariables = new LinkedHashMap(); for (Iterator iter=env.iterateExternalVariables(); iter.hasNext();) { XPathVariable var = (XPathVariable)iter.next(); - declaredVariables.add(var); + declaredVariables.put(var.getVariableQName(), var); } return new XPathSelector(exp, declaredVariables); } Index: hej/net/sf/saxon/s9api/XPathSelector.java =================================================================== --- hej/net/sf/saxon/s9api/XPathSelector.java (revision 851) +++ hej/net/sf/saxon/s9api/XPathSelector.java (working copy) @@ -17,9 +17,8 @@ import net.sf.saxon.value.SequenceExtent; import javax.xml.transform.URIResolver; -import java.util.ArrayList; import java.util.Iterator; -import java.util.List; +import java.util.Map; /** * An XPathSelector represents a compiled and loaded XPath expression ready for execution. @@ -30,12 +29,12 @@ private XPathExpression exp; private XPathDynamicContext dynamicContext; - private List declaredVariables; + private Map declaredVariables; // protected constructor protected XPathSelector(XPathExpression exp, - ArrayList declaredVariables) { + Map declaredVariables) { this.exp = exp; this.declaredVariables = declaredVariables; dynamicContext = exp.createDynamicContext(); @@ -88,14 +87,8 @@ */ public void setVariable(QName name, XdmValue value) throws SaxonApiException { - XPathVariable var = null; StructuredQName qn = name.getStructuredQName(); - for (XPathVariable v : declaredVariables) { - if (v.getVariableQName().equals(qn)) { - var = v; - break; - } - } + XPathVariable var = declaredVariables.get(qn); if (var == null) { throw new SaxonApiException( new XPathException("Variable has not been declared: " + name));