You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by br...@apache.org on 2004/02/08 12:30:38 UTC

cvs commit: cocoon-2.1/src/java/org/apache/cocoon/transformation XIncludeTransformer.java

bruno       2004/02/08 03:30:38

  Modified:    src/java/org/apache/cocoon/transformation
                        XIncludeTransformer.java
  Log:
  Versions 1.11 disabled the following line:
  } else if (xIncludeLevel > 0 && fallbackLevel < 1) {
  in case the element was not in the XInclude namespace, fixed that.
  
  Revision  Changes    Path
  1.13      +20 -21    cocoon-2.1/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java
  
  Index: XIncludeTransformer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/transformation/XIncludeTransformer.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- XIncludeTransformer.java	7 Feb 2004 15:20:09 -0000	1.12
  +++ XIncludeTransformer.java	8 Feb 2004 11:30:38 -0000	1.13
  @@ -179,32 +179,32 @@
           }
   
           public void startElement(String uri, String name, String raw, Attributes attr) throws SAXException {
  +            if (xIncludeLevel == 1 && useFallback && name.equals(XINCLUDE_FALLBACK_ELEMENT) && uri.equals(XINCLUDE_NAMESPACE_URI)) {
  +                fallbackLevel++;
  +
  +                // don't need these anymore
  +                useFallback = false;
  +                fallBackException = null;
  +
  +                return;
  +            } else if (xIncludeLevel > 0 && fallbackLevel < 1) {
  +                xIncludeLevel++;
  +                return;
  +            }
  +
  +            xmlBaseSupport.startElement(uri, name, raw, attr);
               if (uri.equals(XINCLUDE_NAMESPACE_URI)) {
  -                if (xIncludeLevel == 1 && useFallback && name.equals(XINCLUDE_FALLBACK_ELEMENT)) {
  -                    fallbackLevel++;
  -    
  -                    // don't need these anymore
  -                    useFallback = false;
  -                    fallBackException = null;
  -    
  -                    return;
  -                } else if (xIncludeLevel > 0 && fallbackLevel < 1) {
  -                    xIncludeLevel++;
  -                    return;
  -                }
  -    
  -                xmlBaseSupport.startElement(uri, name, raw, attr);
                   if (XINCLUDE_INCLUDE_ELEMENT.equals(name)) {
                       String href = attr.getValue("",XINCLUDE_INCLUDE_ELEMENT_HREF_ATTRIBUTE);
                       if (href == null) {
                           throw new SAXException(raw + " must have a 'href' attribute at " + getLocation());
                       }
  -                    
  +
                       String parse = attr.getValue("",XINCLUDE_INCLUDE_ELEMENT_PARSE_ATTRIBUTE);
  -    
  +
                       if (null == parse) parse="xml";
                       xIncludeLevel++;
  -    
  +
                       try {
                           processXIncludeElement(href, parse);
                       } catch (ProcessingException e) {
  @@ -216,11 +216,10 @@
                       }
                       return;
                   }
  -                
  +
                   throw new SAXException("Unknown XInclude element " + raw + " at " + getLocation());
  -                
  +
               } else {
  -                xmlBaseSupport.startElement(uri, name, raw, attr);
                   super.startElement(uri,name,raw,attr);
               }
           }