Cocoon 3
  1. Cocoon 3
  2. COCOON3-3

Provide an XInclude transformer as a PipelineComponent

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha-1
    • Fix Version/s: 3.0.0-alpha-2
    • Component/s: cocoon-sax
    • Labels:
      None

      Description

      Oldest versions of cocoon already contain an XInclude transformer, it could be a good starting point:

      http://svn.eu.apache.org/repos/asf/cocoon/trunk/core/cocoon-pipeline/cocoon-pipeline-components/src/main/java/org/apache/cocoon/transformation/XIncludeTransformer.java

      XPointer package's dependencies should be reduced to be imported in the new pipeline:

      http://svn.eu.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/xpointer

      An alternative solution could be using xerces2 APIs:

      http://xerces.apache.org/xerces2-j/faq-xinclude.html
      1. XInclude.patch
        71 kB
        Simone Tripodi
      2. XIncludeTransformerFixedAndApacheHeaders.patch
        80 kB
        Simone Tripodi
      3. XIncludeTransformer.patch
        91 kB
        Simone Tripodi

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        447d 22h 51m 1 Reinhard Poetz 21/Dec/09 13:21
        Reinhard Poetz made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 3.0.0-alpha-2 [ 12313446 ]
        Fix Version/s 3.0.0-alpha-3 [ 12314181 ]
        Resolution Fixed [ 1 ]
        Hide
        Reinhard Poetz added a comment -
        Patch applied, many thanks Simone!
        Show
        Reinhard Poetz added a comment - Patch applied, many thanks Simone!
        Reinhard Poetz made changes -
        Assignee Cocoon Developers Team [ cocoon ] Reinhard Poetz [ reinhard@apache.org ]
        Simone Tripodi made changes -
        Attachment XIncludeTransformer.patch [ 12426575 ]
        Hide
        Simone Tripodi added a comment -
        Last uploaded patch (XIncludeTransformer.patch ~92K) contains a new implementation of the XInclude processor based strictly only on SAX APIs, no more DOM to extract elements by ids or by xpath expressions.

        Like always, don't hesitate to contact me if some help or extra work is needed to apply the patch.
        Show
        Simone Tripodi added a comment - Last uploaded patch (XIncludeTransformer.patch ~92K) contains a new implementation of the XInclude processor based strictly only on SAX APIs, no more DOM to extract elements by ids or by xpath expressions. Like always, don't hesitate to contact me if some help or extra work is needed to apply the patch.
        Reinhard Poetz made changes -
        Affects Version/s 3.0.0-alpha-1 [ 12313445 ]
        Affects Version/s 3.0.0-alpha-2 [ 12313446 ]
        Fix Version/s 3.0.0-alpha-3 [ 12314181 ]
        Fix Version/s 3.0.0-alpha-2 [ 12313446 ]
        Reinhard Poetz made changes -
        Component/s cocoon-sax [ 12312641 ]
        Component/s cocoon-pipeline [ 12312489 ]
        Simone Tripodi made changes -
        Hide
        Simone Tripodi added a comment -
        Hi!!!!
        I'm really sorry to have provided a corrupted patch.
        The new patch, named XIncludeTransformerFixedAndApacheHeaders.patch fixes the missing method, creates an XInclude unit test for JUnit4, and adds the right header.

        Sorry if I've never attached the header, but not being an Apache committer I thought I didn't have the right to apply it.

        I also modified a little the previous XIncludeTransformer in way to be ready to be reused in the sitemap.

        The XPointerFrameworkParser is generated using javacc; this justify the pom's modifications: the javacc plugin compiles the grammar in java sources, hat are managed through the build-helper plugin. So, only the .jj file should be committed, not also generated files.

        I really hope this helps, don't hesitate if some help is needed.
        Show
        Simone Tripodi added a comment - Hi!!!! I'm really sorry to have provided a corrupted patch. The new patch, named XIncludeTransformerFixedAndApacheHeaders.patch fixes the missing method, creates an XInclude unit test for JUnit4, and adds the right header. Sorry if I've never attached the header, but not being an Apache committer I thought I didn't have the right to apply it. I also modified a little the previous XIncludeTransformer in way to be ready to be reused in the sitemap. The XPointerFrameworkParser is generated using javacc; this justify the pom's modifications: the javacc plugin compiles the grammar in java sources, hat are managed through the build-helper plugin. So, only the .jj file should be committed, not also generated files. I really hope this helps, don't hesitate if some help is needed.
        Hide
        Reinhard Poetz added a comment -
        I forgot this to mention in my previous comment: Please make sure that _all_ files that you add have the Apache License 2.0 header. Thank you very much in advance!
        Show
        Reinhard Poetz added a comment - I forgot this to mention in my previous comment: Please make sure that _all_ files that you add have the Apache License 2.0 header. Thank you very much in advance!
        Hide
        Reinhard Poetz added a comment -
        I tried to apply your patch but the DOMUtils.stream() method is missing. Can you please add it to your patch? Thanks!
        Show
        Reinhard Poetz added a comment - I tried to apply your patch but the DOMUtils.stream() method is missing. Can you please add it to your patch? Thanks!
        Reinhard Poetz made changes -
        Affects Version/s 3.0.0-alpha-2 [ 12313446 ]
        Fix Version/s 3.0.0-alpha-2 [ 12313446 ]
        Simone Tripodi made changes -
        Field Original Value New Value
        Attachment XInclude.patch [ 12391523 ]
        Hide
        Simone Tripodi added a comment -
        As mentioned on http://cocoon.apache.org/3.0/roadmap.html, the XInclude support is one of the unscheduled feature for cocoon 3.0.0

        The attached patch provides the porting to Cocoon3's pipeline of old XInclude Transformer already present in previous releases; some TestCase are also provided.

        Just few notes:
        - As described in http://www.w3.org/TR/xinclude/, I managed the 'accept' and 'accept-language' attributes that weren't previously implemented;
        - I maintained the deprecated xpointer support;
        - The dependencies from old Excalibur's org.apache.excalibur.xml.xpath.* have been replaced with Java5 provided javax.xml.xpath.* - they are very similar;
        - The XPointer grammar has been adapted to be managed by the maven-javacc-plugin (generation + report);
        - The original DOMStreamer has been simplified;
        - I only adapted the existing code to the new structure and used Java5 generics, iterators where possible.

        I really hope this helps! :)
        Show
        Simone Tripodi added a comment - As mentioned on http://cocoon.apache.org/3.0/roadmap.html, the XInclude support is one of the unscheduled feature for cocoon 3.0.0 The attached patch provides the porting to Cocoon3's pipeline of old XInclude Transformer already present in previous releases; some TestCase are also provided. Just few notes: - As described in http://www.w3.org/TR/xinclude/, I managed the 'accept' and 'accept-language' attributes that weren't previously implemented; - I maintained the deprecated xpointer support; - The dependencies from old Excalibur's org.apache.excalibur.xml.xpath.* have been replaced with Java5 provided javax.xml.xpath.* - they are very similar; - The XPointer grammar has been adapted to be managed by the maven-javacc-plugin (generation + report); - The original DOMStreamer has been simplified; - I only adapted the existing code to the new structure and used Java5 generics, iterators where possible. I really hope this helps! :)
        Hide
        Simone Tripodi added a comment -
        I started working on it but it's not so easy (for me, at least ;) ).
        I should be able to provide an initial patch in a week
        Show
        Simone Tripodi added a comment - I started working on it but it's not so easy (for me, at least ;) ). I should be able to provide an initial patch in a week
        Hide
        Reinhard Poetz added a comment -
        Usually the job of porting Cocoon 2.x components to Cocoon 3 is straight forward and in this case the best option IMO.
        Show
        Reinhard Poetz added a comment - Usually the job of porting Cocoon 2.x components to Cocoon 3 is straight forward and in this case the best option IMO.
        Hide
        Simone Tripodi added a comment -
        It seems that Xerces' implementation of XPointer is incomplete:

        https://svn.apache.org/repos/asf/xerces/java/trunk/src/org/apache/xerces/xinclude/XIncludeHandler.java

        Reading from the javadoc: "Currently, this implementation has only partial support for the XInclude specification. Specifically, it is missing support for XPointer document fragments. Thus, only whole documents can be included using this component in the pipeline."

        The oldest cocoon's version porting should be the best solution.
        Show
        Simone Tripodi added a comment - It seems that Xerces' implementation of XPointer is incomplete: https://svn.apache.org/repos/asf/xerces/java/trunk/src/org/apache/xerces/xinclude/XIncludeHandler.java Reading from the javadoc: "Currently, this implementation has only partial support for the XInclude specification. Specifically, it is missing support for XPointer document fragments. Thus, only whole documents can be included using this component in the pipeline." The oldest cocoon's version porting should be the best solution.
        Simone Tripodi created issue -

          People

          • Assignee:
            Reinhard Poetz
            Reporter:
            Simone Tripodi
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development