Search in sources :

Example 1 with XFormParseException

use of org.javarosa.xform.parse.XFormParseException in project javarosa by opendatakit.

the class FormDef method getAbsRef.

// take a (possibly relative) reference, and make it absolute based on its parent
// moved from the parser to this class so it can be used more cleanly by ItemsetBinding
public static IDataReference getAbsRef(IDataReference ref, TreeReference parentRef) {
    TreeReference tref;
    if (!parentRef.isAbsolute()) {
        throw new RuntimeException("XFormParser.getAbsRef: parentRef must be absolute");
    }
    if (ref != null) {
        tref = (TreeReference) ref.getReference();
    } else {
        // only happens for <group>s with no binding
        tref = TreeReference.selfRef();
    }
    tref = tref.parent(parentRef);
    if (tref == null) {
        throw new XFormParseException("Binding path [" + tref + "] not allowed with parent binding of [" + parentRef + "]");
    }
    return new XPathReference(tref);
}
Also used : TreeReference(org.javarosa.core.model.instance.TreeReference) XFormParseException(org.javarosa.xform.parse.XFormParseException) XPathReference(org.javarosa.model.xform.XPathReference)

Aggregations

TreeReference (org.javarosa.core.model.instance.TreeReference)1 XPathReference (org.javarosa.model.xform.XPathReference)1 XFormParseException (org.javarosa.xform.parse.XFormParseException)1