cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From coli...@apache.org
Subject cvs commit: cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation JXFormsGenerator.java
Date Wed, 30 Apr 2003 18:37:12 GMT
coliver     2003/04/30 11:37:12

  Modified:    src/scratchpad/src/org/apache/cocoon/generation
                        JXFormsGenerator.java
  Log:
  corrected value generation
  
  Revision  Changes    Path
  1.6       +20 -14    cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXFormsGenerator.java
  
  Index: JXFormsGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/src/org/apache/cocoon/generation/JXFormsGenerator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JXFormsGenerator.java	30 Apr 2003 09:39:01 -0000	1.5
  +++ JXFormsGenerator.java	30 Apr 2003 18:37:12 -0000	1.6
  @@ -214,20 +214,30 @@
               if (absolute) {
                   ctx = root;
               }
  -            // hack: for non-collections iteratePointers doesn't always do 
  -            // the right thing 
  +            return jxpath.iteratePointers(ctx);
  +        }
  +
  +      
  +        Iterator iterate(JXPathContext root, JXPathContext current) {
  +            JXPathContext ctx = current;
  +            if (absolute) {
  +                ctx = root;
  +            }
  +            // Hack: iterate doesn't always do the right thing for non-
  +            // collections
               final NodePointer ptr = (NodePointer)jxpath.getPointer(ctx, "???");
               if (ptr.isCollection()) {
  -                return jxpath.iteratePointers(ctx);
  +                return jxpath.iterate(ctx);
               } 
  +            final Object value = ptr.getValue();
               return new Iterator() {
  -                    Pointer p = ptr;
  +                    Object val = value;
                       public boolean hasNext() {
  -                        return p != null;
  +                        return val != null;
                       }
                       public Object next() {
  -                        Object result = p;
  -                        p = null;
  +                        Object result = val;
  +                        val = null;
                           return result;
                       }
                       public void remove() {
  @@ -1475,15 +1485,11 @@
                                         startElement.raw,
                                         startElement.attributes);
                   if (ref != null) {
  -                    Iterator iter = ref.iteratePointers(rootContext,
  -                                                        currentContext);
  +                    Iterator iter = ref.iterate(rootContext,
  +                                                currentContext);
                       while (iter.hasNext()) {
  -                        Pointer ptr = (Pointer)iter.next();
  -                        AttributesImpl attrs = new AttributesImpl();
  -                        attrs.addAttribute(NS, REF, REF, "CDATA",
  -                                           ptr.asPath());
  +                        Object val = iter.next();
                           consumer.startElement(NS, VALUE, VALUE, EMPTY_ATTRS);
  -                        Object val = ptr.getValue();
                           if (val == null) val = "";
                           String str = String.valueOf(val);
                           consumer.characters(str.toCharArray(), 0, str.length());
  
  
  

Mime
View raw message