package lux;

import java.util.Collection;
import java.util.Iterator;

import javax.xml.transform.TransformerException;

import net.sf.saxon.s9api.XdmEmptySequence;
import net.sf.saxon.s9api.XdmItem;
import net.sf.saxon.s9api.XdmValue;

public class XdmResultSet implements Iterable<XdmItem> {
    
    private final XdmValue value;
    private final Collection<TransformerException> errors;
    
    public XdmResultSet(XdmValue value) {
        this.value = value;
        errors = null;
    }
    
    public XdmResultSet (Collection<TransformerException> errors) {
        this.value = XdmEmptySequence.getInstance();
        this.errors = errors;
    }

    public XdmValue getXdmValue () {
        return value;
    }

    public Iterator<XdmItem> iterator() {
        return value.iterator();
    }

    public int size() {
        return value.size();
    }

    public Collection<TransformerException> getErrors() {
        return errors;
    }

}

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

@@ -24,26 +24,24 @@
 va.util.
-Collection
+Iterator
 ;%0Aimport
@@ -51,24 +51,20 @@
 va.util.
-Iterator
+List
 ;%0A%0Aimpor
@@ -338,26 +338,20 @@
 e final 
-Collection
+List
 %3CTransfo
@@ -507,26 +507,20 @@
 ultSet (
-Collection
+List
 %3CTransfo
@@ -850,25 +850,178 @@
     
-public Collection
+/**%0A     * @return the list of errors reported when compiling or evaluating an xquery expression.%0A     * returns null if no errors were generated.%0A     */%0A    public List
 %3CTra

maintain order of errors (use a List)