Changeset 1517

Show
Ignore:
Timestamp:
12/03/08 10:20:53 (5 weeks ago)
Author:
droos
Message:

catch another invalid path format ( /.. ); (the path is technically valid, but outside our supported subset)

Location:
branches/dev-repeat
Files:
2 added
3 modified

Legend:

Unmodified
Added
Removed
  • branches/dev-repeat/javarosa/org.javarosa.core.model/src/org/javarosa/core/model/instance/TreeReference.java

    r1516 r1517  
    5353        //return a new reference that is this reference anchored to a passed-in parent reference 
    5454        //if this reference is absolute, return self 
    55         //if this ref as 'parent' steps (..), it can only be anchored if the parent ref is a relative ref consisting only of 'parent' steps 
     55        //if this ref has 'parent' steps (..), it can only be anchored if the parent ref is a relative ref consisting only of other 'parent' steps 
    5656        //return null in these invalid situations 
    5757        public TreeReference parent (TreeReference parentRef) { 
     
    7777                } 
    7878        } 
    79          
    80         public TreeReference append (TreeReference childRef) { 
    81                 return childRef.prepend(this); 
    82         } 
    83          
     79                 
    8480        //assumes contextRef refers to a singular, existing node in the model 
    8581        public TreeReference anchor (TreeReference contextRef) { 
  • branches/dev-repeat/javarosa/org.javarosa.xform/src/org/javarosa/model/xform/XPathReference.java

    r1516 r1517  
    6666        public static TreeReference getRefFromPathExpr (XPathPathExpr path) throws XPathUnsupportedException { 
    6767                TreeReference ref = new TreeReference(); 
     68                boolean parentsAllowed; 
    6869                 
    6970                switch (path.init_context) { 
    70                 case XPathPathExpr.INIT_CONTEXT_ROOT: ref.refLevel = TreeReference.REF_ABSOLUTE; 
    71                 case XPathPathExpr.INIT_CONTEXT_RELATIVE: ref.refLevel = 0; 
    72                 case XPathPathExpr.INIT_CONTEXT_EXPR: throw new XPathUnsupportedException(); 
     71                case XPathPathExpr.INIT_CONTEXT_ROOT: 
     72                        ref.refLevel = TreeReference.REF_ABSOLUTE; 
     73                        parentsAllowed = false; 
     74                        break; 
     75                case XPathPathExpr.INIT_CONTEXT_RELATIVE: 
     76                        ref.refLevel = 0; 
     77                        parentsAllowed = true; 
     78                        break; 
     79                default: throw new XPathUnsupportedException(); 
    7380                } 
    7481                 
    75                 boolean parentsAllowed = true; 
    7682                for (int i = 0; i < path.steps.length; i++) { 
    7783                        XPathStep step = path.steps[i]; 
  • branches/dev-repeat/javarosa/org.javarosa.xform/src/org/javarosa/xform/parse/XFormParser.java

    r1516 r1517  
    209209 
    210210                parseElement(formDef, doc.getRootElement(), formDef, topLevelHandlers); 
     211                collapseRepeatGroups(formDef); 
    211212                if(instanceNode != null) { 
    212213                        parseInstance(formDef, instanceNode); 
    213214                } 
    214                 collapseRepeatGroups(formDef); 
    215215 
    216216                initStateVars(); 
     
    269269                                //binds and data types and such 
    270270                                saveInstanceNode(child); 
    271                         } else if ("bind".equals(childName)) { 
     271                        } else if ("bind".equals(childName)) { //<instance> must come before <bind>s 
    272272                                parseBind(f, child); 
    273273                        } else {