cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 27301] New: - FilterTransformer: Generates not matching block tags
Date Fri, 27 Feb 2004 18:19:42 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27301>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=27301

FilterTransformer: Generates not matching block tags

           Summary: FilterTransformer: Generates not matching block tags
           Product: Cocoon 2
           Version: 2.1.4
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: sitemap components
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: apache@dobler.net


example: 
sitemap:   <map:match pattern="filter/*">
              <map:generate src="test.xml"
              <map:transform type="filter">
                 <map:parameter name="element-name" value="include"/>
                 <map:parameter name="count" value="10"/>
                 <map:parameter name="blocknr" value="1"/>                   
              </map:transform> 
              <map:serialize type="xml"/>                
           </map:match>

test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<files xmlns:i="http://apache.org/cocoon/include/1.0">
  <i:include src="file1.xml" />
  <i:include src="file2.xml" />
  <i:include src="file3.xml" />
  <i:include src="file4.xml" />
</files>

output:
<?xml version="1.0" encoding="UTF-8"?>
<files>
  <i:block id="1" xmlns:i="http://apache.org/cocoon/include/1.0">
    <i:include src="file1.xml" />
    <i:include src="file2.xml" />
    <i:include src="file3.xml" />
    <i:include src="file4.xml" />
  </block>
</files>

I tracked the cause to:
org.apache.cocoon.transformation.FilterTransformer 1.3 Line 186-200
    public void endElement(String uri,String name,String raw)
    throws SAXException  {
        if (this.foundIt && name.equals(this.parentName)) {
            // FIXME: VG: This will fail on XML like:
            // <parent>
            //   <element>
            //     <parent>
            super.contentHandler.endElement(uri, BLOCK, BLOCK);
            super.contentHandler.endElement(uri, name, raw);
            this.foundIt = false;
            this.skip = false;
        } else if (!this.skip)  {
            super.contentHandler.endElement(uri,name,raw);
        }
    }

in line 193:
            super.contentHandler.endElement(uri, BLOCK, BLOCK);
the uri variable has the namespace of the parent element (in this case from
<files>) and not from the <i:include> element, so the end </block> tag is
written	without the namespace prefix i

suggestion: use no namespace for the block tag or a namespace of his own

Mime
View raw message