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 20:59:11 GMT
coliver     2003/04/30 13:59:11

  Modified:    src/scratchpad/src/org/apache/cocoon/generation
                        JXFormsGenerator.java
  Log:
  Fixed handling of relative paths in input controls
  
  Revision  Changes    Path
  1.8       +11 -1     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.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JXFormsGenerator.java	30 Apr 2003 20:09:44 -0000	1.7
  +++ JXFormsGenerator.java	30 Apr 2003 20:59:11 -0000	1.8
  @@ -999,6 +999,9 @@
                       newEvent = startInputControl;
                   } else if (isInputControl(localName)) {
                       String refStr = attrs.getValue("ref");
  +                    if (refStr == null) {
  +                        throw new SAXParseException("\""+localName + "\" requires a \"ref\"
attribute", locator, null);
  +                    }
                       XPathExpr ref = 
                           compileExpr(refStr, locator);
                       StartInputControl startInputControl = 
  @@ -1479,10 +1482,17 @@
                       (StartInputControl)ev;
                   XPathExpr ref = startInputControl.ref;
                   StartElement startElement = startInputControl.startElement;
  +                Attributes attrs = startElement.attributes;
  +                if (!ref.absolute && contextPath != null) {
  +                    AttributesImpl impl = new AttributesImpl(attrs);
  +                    int index = impl.getIndex(REF);
  +                    impl.setValue(index, contextPath + "/" + ref.string);
  +                    attrs = impl;
  +                }
                   consumer.startElement(startElement.namespaceURI,
                                         startElement.localName,
                                         startElement.raw,
  -                                      startElement.attributes);
  +                                      attrs);
                   if (ref != null) {
                       Iterator iter = ref.iterate(rootContext,
                                                   currentContext);
  
  
  

Mime
View raw message