dims        01/04/25 08:39:12

  Modified:    src/org/apache/cocoon/components/saxconnector Tag:
                        xml-cocoon2 XIncludeSAXConnector.java
               webapp   Tag: xml-cocoon2 cocoon.xconf sitemap.xmap
               webapp/docs/samples Tag: xml-cocoon2 samples.xml
               webapp/stylesheets/news Tag: xml-cocoon2 news.xsl
  Added:       webapp/docs/samples/xsp Tag: xml-cocoon2 aggregate.xsp
  Log:
  - Fixes for XIncludeSAXConnector.
  - Added sample for Transparent CA
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.6   +54 -52    
xml-cocoon/src/org/apache/cocoon/components/saxconnector/Attic/XIncludeSAXConnector.java
  
  Index: XIncludeSAXConnector.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon/src/org/apache/cocoon/components/saxconnector/Attic/XIncludeSAXConnector.java,v
  retrieving revision 1.1.2.5
  retrieving revision 1.1.2.6
  diff -u -r1.1.2.5 -r1.1.2.6
  --- XIncludeSAXConnector.java 2001/04/25 13:51:31     1.1.2.5
  +++ XIncludeSAXConnector.java 2001/04/25 15:39:06     1.1.2.6
  @@ -47,12 +47,12 @@
   /**
    * Copy of code from XIncludeTransformer as a starting point for 
XIncludeSAXConnector.
    * @author <a href="[EMAIL PROTECTED]">Davanum Srinivas</a>
  - * @version CVS $Revision: 1.1.2.5 $ $Date: 2001/04/25 13:51:31 $
  + * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/04/25 15:39:06 $
    */
   public class XIncludeSAXConnector extends AbstractXMLPipe implements 
Composable, Recyclable, SAXConnector, Disposable {
   
       /** Stacks namespaces during processing */
  -    //private ArrayList currentNS = new ArrayList();
  +    private ArrayList currentNS = new ArrayList();
   
       /** The current <code>ComponentManager</code>. */
       protected ComponentManager manager = null;
  @@ -97,60 +97,62 @@
               return;
           }
   
  -        //if (uri.equals("")) {
  -        //    uri = (String)this.getNS();
  -        //}
  -        //this.pushNS(uri);
  +        if (uri == null || uri.equals("")) {
  +            uri = (String)this.getNS();
  +        }
  +        this.pushNS(uri);
           super.startElement(uri, name, raw, attr);
       }
   
       public void endElement(String uri, String name, String raw) throws 
SAXException {
           if (uri != null && name != null && 
uri.equals(XINCLUDE_NAMESPACE_URI) && name.equals(XINCLUDE_INCLUDE_ELEMENT)) {
               return;
  +        }
  +        super.endElement((String)this.popNS(),name,raw);
  +    }
  +
  +    private void startElem(String namespaceURI, String prefix, String name) 
throws SAXException {
  +        this.pushNS(namespaceURI);
  +        AttributesImpl attrs = new AttributesImpl();
  +        String qname = name;
  +        if (!namespaceURI.equals("")) {
  +            super.startPrefixMapping(prefix, namespaceURI);
  +            if (prefix!= null && !prefix.equals("")) {
  +                attrs.addAttribute("", prefix, "xmlns:" + prefix, "CDATA", 
namespaceURI);
  +            } else {
  +                attrs.addAttribute("", "xmlns", "xmlns", "CDATA", 
namespaceURI);
  +            }
           }
  -        //super.endElement((String)this.popNS(),name,raw);
  -        super.endElement(uri,name,raw);
  +        super.startElement(namespaceURI, name, name, attrs);
       }
   
  -    //private void startElem(String namespaceURI, String prefix, String 
name) throws SAXException {
  -    //    this.pushNS(namespaceURI);
  -    //    AttributesImpl attrs = new AttributesImpl();
  -    //    String qname = name;
  -    //    if (!namespaceURI.equals("")) {
  -    //        super.startPrefixMapping(prefix, namespaceURI);
  -    //        if (!prefix.equals("")) {
  -    //            attrs.addAttribute("", prefix, "xmlns:" + prefix, "CDATA", 
namespaceURI);
  -    //        } else {
  -    //            attrs.addAttribute("", "xmlns", "xmlns", "CDATA", 
namespaceURI);
  -    //        }
  -    //    }
  -    //    super.startElement(namespaceURI, name, name, attrs);
  -    //}
  -
  -    //private void endElem(String prefix, String name) throws SAXException {
  -    //    String ns = this.popNS();
  -    //    super.endElement(ns, name, name);
  -    //    if (!ns.equals("")) {
  -    //        super.endPrefixMapping(prefix);
  -    //    }
  -    //}
  -
  -    //private String pushNS(String ns) {
  -    //    currentNS.add(ns);
  -    //    return ns;
  -    //}
  -
  -    //private String popNS() {
  -    //    int last = currentNS.size()-1;
  -    //    String ns = (String)currentNS.get(last);
  -    //    currentNS.remove(last);
  -    //    return ns;
  -    //}
  -
  -    //private String getNS() {
  -    //    int last = currentNS.size()-1;
  -    //    return (String)currentNS.get(last);
  -    //}
  +    private void endElem(String prefix, String name) throws SAXException {
  +        String ns = this.popNS();
  +        super.endElement(ns, name, name);
  +        if (!ns.equals("")) {
  +            super.endPrefixMapping(prefix);
  +        }
  +    }
  +
  +    private String pushNS(String ns) {
  +        currentNS.add(ns);
  +        return ns;
  +    }
  +
  +    private String popNS() {
  +        int last = currentNS.size()-1;
  +        String ns = (String)currentNS.get(last);
  +        currentNS.remove(last);
  +        return ns;
  +    }
  +
  +    private String getNS() {
  +        int last = currentNS.size()-1;
  +        String ns = "";
  +        if (last >= 0)
  +            ns = (String)currentNS.get(last);
  +        return ns;
  +    }
   
       public void setDocumentLocator(Locator locator) {
           super.setDocumentLocator(locator);
  @@ -178,8 +180,8 @@
   
               IncludeXMLConsumer consumer = new IncludeXMLConsumer(this);
   
  -            //if (!element.equals(""))
  -            //    this.startElem(ns, prefix, element);
  +            if (!element.equals(""))
  +                this.startElem(ns, prefix, element);
   
               ((XMLProducer)eventPipeline).setConsumer(consumer);
   
  @@ -188,8 +190,8 @@
               eventPipeline.process(this.environment);
               this.environment.popURI();
   
  -            //if (!element.equals(""))
  -            //    this.endElem(prefix, element);
  +            if (!element.equals(""))
  +                this.endElem(prefix, element);
           } catch (Exception e) {
               getLogger().error("Error selecting sitemap",e);
           } finally {
  @@ -212,6 +214,6 @@
        * Recycle the producer by removing references
        */
       public void recycle () {
  -        //this.currentNS.clear();
  +        this.currentNS.clear();
       }
   }
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.42  +1 -1      xml-cocoon/webapp/Attic/cocoon.xconf
  
  Index: cocoon.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/webapp/Attic/cocoon.xconf,v
  retrieving revision 1.1.2.41
  retrieving revision 1.1.2.42
  diff -u -r1.1.2.41 -r1.1.2.42
  --- cocoon.xconf      2001/04/20 20:50:20     1.1.2.41
  +++ cocoon.xconf      2001/04/25 15:39:07     1.1.2.42
  @@ -107,7 +107,7 @@
     <!-- these components is used as a PoolController for the sitemap 
component pools  -->
     <pool-controller 
class="org.apache.excalibur.component.DefaultComponentPoolController"/>
   
  -  <sax-connector 
class="org.apache.cocoon.components.saxconnector.NullSAXConnector"/>
  +  <sax-connector 
class="org.apache.cocoon.components.saxconnector.XIncludeSAXConnector"/>
   
     <stream-pipeline 
class="org.apache.cocoon.components.pipeline.CachingStreamPipeline"/>
   
  
  
  
  1.1.2.55  +8 -0      xml-cocoon/webapp/Attic/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/webapp/Attic/sitemap.xmap,v
  retrieving revision 1.1.2.54
  retrieving revision 1.1.2.55
  diff -u -r1.1.2.54 -r1.1.2.55
  --- sitemap.xmap      2001/04/24 12:14:47     1.1.2.54
  +++ sitemap.xmap      2001/04/25 15:39:07     1.1.2.55
  @@ -274,6 +274,14 @@
       <map:serialize/>
      </map:match>
   
  +   <map:match pattern="news/aggregate.xsp">
  +    <map:generate type="serverpages" src="docs/samples/xsp/aggregate.xsp"/>
  +    <map:transform src="stylesheets/news/news.xsl">
  +        <parameter name="view-source" 
value="docs/samples/xsp/aggregate.xsp"/>
  +    </map:transform>
  +    <map:serialize/>
  +   </map:match>
  +
      <!-- ================  Static  =========================== -->
   
      <map:match pattern="fo">
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.22  +3 -0      xml-cocoon/webapp/docs/samples/Attic/samples.xml
  
  Index: samples.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/webapp/docs/samples/Attic/samples.xml,v
  retrieving revision 1.1.2.21
  retrieving revision 1.1.2.22
  diff -u -r1.1.2.21 -r1.1.2.22
  --- samples.xml       2001/04/21 10:09:31     1.1.2.21
  +++ samples.xml       2001/04/25 15:39:09     1.1.2.22
  @@ -76,6 +76,9 @@
      <sample name="Simple XSP" href="xsp/simple">
       Simple XSP example.
      </sample>
  +   <sample name="Content Aggregation" href="news/aggregate.xsp">
  +    Sample for Transparent Content Aggregation.        
  +   </sample>
      <sample name="Simple SQL" href="sql/sql-page" xlink:role="dynamic">
       Simple SQL example. You should make sure that you have a database and
       table according to the conf/sitemap.xmap and the
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +23 -0     xml-cocoon/webapp/docs/samples/xsp/Attic/aggregate.xsp
  
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.3   +37 -4     xml-cocoon/webapp/stylesheets/news/Attic/news.xsl
  
  Index: news.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/webapp/stylesheets/news/Attic/news.xsl,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- news.xsl  2001/04/22 07:50:20     1.1.2.2
  +++ news.xsl  2001/04/25 15:39:11     1.1.2.3
  @@ -3,15 +3,48 @@
                   xmlns:ns2="http://foo.bar.com/moreover";
                   xmlns:ns3="http://foo.bar.com/isyndicate";
   >
  -
  +     <xsl:include href="../page/simple-page2html.xsl"/>
  +    
        <!-- Match The Root Node -->
        <xsl:template match="/">
                <HTML>
  -            <xsl:apply-templates select="//ns1:BODY"/>
  -            <xsl:apply-templates select="//ns2:BODY"/>
  -            <xsl:apply-templates select="//ns3:BODY"/>
  +            <BODY>
  +                <xsl:apply-templates/>
  +            </BODY>
                </HTML>
        </xsl:template>
  +
  +     <xsl:template match="HTML">
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +     <xsl:template match="ns1:HTML">
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +     <xsl:template match="ns2:HTML">
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +     <xsl:template match="ns3:HTML">
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +     <xsl:template match="BODY">
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +     <xsl:template match="ns1:BODY">
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +     <xsl:template match="ns2:BODY">
  +        <xsl:apply-templates/>
  +    </xsl:template>
  +
  +     <xsl:template match="ns3:BODY">
  +        <xsl:apply-templates/>
  +    </xsl:template>
   
        <xsl:template match="@*|*|text()|processing-instruction()" 
priority="-1">
                <xsl:copy>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to