You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Lochschmied, Alexander" <Al...@Vishay.com> on 2009/11/19 13:45:55 UTC
Unbalanced tags not triggering endTransformingElement in Transformer
Hello!
Let me call <br/> "unbalanced" element as opposed to <br></br>.
I'm extending AbstractSAXTransformer and noticed that unbalanced elements do not trigger endTransformingElement(...) if the source (or generator) is cocoon:/something.
Example:
1. Unbalanced tags do NOT trigger endTransformingElement(...)
<map:match pattern="OK">
<map:generate src="cocoon:/something"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
2. Unbalanced tags do trigger endTransformingElement(...)
<map:match pattern=" NOT_OK">
<map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
Can somebody explain what I'm could possibly be missing or is that a bug in Cocoon?
Thanks,
Alexander
Alexander Lochschmied
Web Programmer - Internet and Commerce
IT Global Web Services
Information Technology
Phone: +49 92 8771 2682
Fax +49 92 8771 2545
Website: www.vishay.com <http://www.vishay.com/>
Vishay Electronic GmbH
Geheimrat-Rosenthal-Str. 100
D-95100 Selb
Amtsgericht/County Court Hof HRB 2894,
Geschäftsführer/Managing Directors: Sieglinde Janker-Buecherl, Arnold Rohr
RE: Unbalanced tags not triggering endTransformingElement in
Transformer
Posted by "Lochschmied, Alexander" <Al...@Vishay.com>.
To avoid confusion, please swap the pattern values of my example; "OK" should be "NOT_OK" and vice versa.
Let me call <br/> "unbalanced" element as opposed to <br></br>.
I'm extending AbstractSAXTransformer and noticed that unbalanced elements do not trigger endTransformingElement(...) if the source (or generator) is cocoon:/something.
Example:
1. Unbalanced tags do NOT trigger endTransformingElement(...)
<map:match pattern="NOT_OK">
<map:generate src="cocoon:/something"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
2. Unbalanced tags do trigger endTransformingElement(...)
<map:match pattern="OK">
<map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
Can somebody explain what I could possibly be missing or is that a bug in Cocoon?
Thanks,
Alexander
From: Lochschmied, Alexander
Sent: Donnerstag, 19. November 2009 13:46
To: dev@cocoon.apache.org
Subject: Unbalanced tags not triggering endTransformingElement in Transformer
Hello!
Let me call <br/> "unbalanced" element as opposed to <br></br>.
I'm extending AbstractSAXTransformer and noticed that unbalanced elements do not trigger endTransformingElement(...) if the source (or generator) is cocoon:/something.
Example:
1. Unbalanced tags do NOT trigger endTransformingElement(...)
<map:match pattern="OK">
<map:generate src="cocoon:/something"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
2. Unbalanced tags do trigger endTransformingElement(...)
<map:match pattern=" NOT_OK">
<map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
Can somebody explain what I'm could possibly be missing or is that a bug in Cocoon?
Thanks,
Alexander
Alexander Lochschmied
Web Programmer - Internet and Commerce
IT Global Web Services
Information Technology
Phone: +49 92 8771 2682
Fax +49 92 8771 2545
Website: www.vishay.com <http://www.vishay.com/>
Vishay Electronic GmbH
Geheimrat-Rosenthal-Str. 100
D-95100 Selb
Amtsgericht/County Court Hof HRB 2894,
Geschäftsführer/Managing Directors: Sieglinde Janker-Buecherl, Arnold Rohr
Re: Unbalanced tags not triggering endTransformingElement in Transformer
Posted by Simone Gianni <si...@apache.org>.
Hi Alexander,
in SAX parsing of the namespace is not "mandatory". That is, when the
sax event is constructed, the namespace is given, but nothing is
checking if you are considering it or not.
Some parsers do enforce validation, so incorrect namespaces are detected
during the parsing phase, but a normal "sax passthru" (as is the cocoon:
protocol) does not perform such validation. So if incorrect namespaces
are present (or even malformed XML up to some extent) you might see a
different behavior.
Hope this helps,
Simone
Lochschmied, Alexander wrote:
>
> It’s resolved. My elements didn’t have the right namespace.
>
> I still don’t understand why there is a difference between source
> being a file VS other processing step though.
>
> *From:* Lochschmied, Alexander
> *Sent:* Freitag, 20. November 2009 10:31
> *To:* 'dev@cocoon.apache.org'
> *Subject:* RE: Unbalanced tags not triggering endTransformingElement
> in Transformer
>
> Hello again!
>
> I think I was wrong, unbalanced tags do not seem to cause it. Here is
> sample input XML for my transformer:
>
> <rowset xmlns="http://www.vishay.com/rowspan/1.0">
>
> <row>
>
> <P1000>abc</P1000>
>
> <P1001>def</P1001>
>
> <T8400>
>
> <img src="small.jpg">img</img>
>
> <br>br</br>
>
> <a href="javascript:void(0)" onClick="foo(42)">Enlarge</a>
>
> </T8400>
>
> The elements inside T8400 (img, br, a) do not trigger
> endTransformingElement() but they do trigger
> startTransformingElement(). And again: This is only a problem if the
> input XML is coming from another Cocoon processing step. It is not a
> problem if the input XML is read from file system (with
> FileGenerator). This is actually the most confusing part for me.
>
> If input comes from a file, they do generate the end events.
>
> Any pointers for me?
>
> Thanks,
> Alexander
>
> *From:* Lochschmied, Alexander
> *Sent:* Donnerstag, 19. November 2009 14:23
> *To:* 'dev@cocoon.apache.org'
> *Subject:* RE: Unbalanced tags not triggering endTransformingElement
> in Transformer
>
> To avoid confusion, please swap the pattern values of my example; “OK”
> should be “NOT_OK” and vice versa.
>
> Let me call <br/> “unbalanced” element as opposed to <br></br>.
>
> I’m extending AbstractSAXTransformer and noticed that unbalanced
> elements do not trigger endTransformingElement(…) if the source (or
> generator) is cocoon:/something.
>
> Example:
>
> 1. Unbalanced tags do NOT trigger endTransformingElement(…)
>
> <map:match pattern="NOT_OK">
>
> <map:generate src="cocoon:/something"/>
>
> <map:transform type="custom-transformer"/>
>
> <map:serialize type="xml"/>
>
> </map:match>
>
> 2. Unbalanced tags do trigger endTransformingElement(…)
>
> <map:match pattern="OK">
>
> <map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
>
> <map:transform type="custom-transformer"/>
>
> <map:serialize type="xml"/>
>
> </map:match>
>
> Can somebody explain what I could possibly be missing or is that a bug
> in Cocoon?
>
> Thanks,
> Alexander
>
> *From:* Lochschmied, Alexander
> *Sent:* Donnerstag, 19. November 2009 13:46
> *To:* dev@cocoon.apache.org
> *Subject:* Unbalanced tags not triggering endTransformingElement in
> Transformer
>
> Hello!
>
> Let me call <br/> “unbalanced” element as opposed to <br></br>.
>
> I’m extending AbstractSAXTransformer and noticed that unbalanced
> elements do not trigger endTransformingElement(…) if the source (or
> generator) is cocoon:/something.
>
> Example:
>
> 1. Unbalanced tags do NOT trigger endTransformingElement(…)
>
> <map:match pattern="OK">
>
> <map:generate src="cocoon:/something"/>
>
> <map:transform type="custom-transformer"/>
>
> <map:serialize type="xml"/>
>
> </map:match>
>
> 2. Unbalanced tags do trigger endTransformingElement(…)
>
> <map:match pattern=" NOT_OK">
>
> <map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
>
> <map:transform type="custom-transformer"/>
>
> <map:serialize type="xml"/>
>
> </map:match>
>
> Can somebody explain what I’m could possibly be missing or is that a
> bug in Cocoon?
>
> Thanks,
>
> Alexander
>
> Alexander Lochschmied
>
> Web Programmer - Internet and Commerce
>
> IT Global Web Services
>
> Information Technology
>
> Phone: +49 92 8771 2682
>
> Fax +49 92 8771 2545
>
> Website: www.vishay.com <http://www.vishay.com/>
>
> Vishay Electronic GmbH
>
> Geheimrat-Rosenthal-Str. 100
>
> D-95100 Selb
>
> Amtsgericht/County Court Hof HRB 2894,
>
> Geschäftsführer/Managing Directors: Sieglinde Janker-Buecherl, Arnold Rohr
>
--
Simone Gianni CEO Semeru s.r.l. Apache Committer
http://www.simonegianni.it/
Re: Unbalanced tags not triggering endTransformingElement in Transformer
Posted by Sylvain Wallez <sy...@apache.org>.
Lochschmied, Alexander wrote:
>
> It’s resolved. My elements didn’t have the right namespace.
>
> I still don’t understand why there is a difference between source
> being a file VS other processing step though.
>
Maybe I'm stating the obvious, but from a SAX point of view there's no
difference between "balanced" and "unbalanced" elements. An element with
no children elements nor embedded text is just a startElement()
immediately followed by an endElement() for the same tag.
Sylvain
--
Sylvain Wallez - http://bluxte.net
RE: Unbalanced tags not triggering endTransformingElement in
Transformer
Posted by "Lochschmied, Alexander" <Al...@Vishay.com>.
It's resolved. My elements didn't have the right namespace.
I still don't understand why there is a difference between source being a file VS other processing step though.
From: Lochschmied, Alexander
Sent: Freitag, 20. November 2009 10:31
To: 'dev@cocoon.apache.org'
Subject: RE: Unbalanced tags not triggering endTransformingElement in Transformer
Hello again!
I think I was wrong, unbalanced tags do not seem to cause it. Here is sample input XML for my transformer:
<rowset xmlns="http://www.vishay.com/rowspan/1.0">
<row>
<P1000>abc</P1000>
<P1001>def</P1001>
<T8400>
<img src="small.jpg">img</img>
<br>br</br>
<a href="javascript:void(0)" onClick="foo(42)">Enlarge</a>
</T8400>
The elements inside T8400 (img, br, a) do not trigger endTransformingElement() but they do trigger startTransformingElement(). And again: This is only a problem if the input XML is coming from another Cocoon processing step. It is not a problem if the input XML is read from file system (with FileGenerator). This is actually the most confusing part for me.
If input comes from a file, they do generate the end events.
Any pointers for me?
Thanks,
Alexander
From: Lochschmied, Alexander
Sent: Donnerstag, 19. November 2009 14:23
To: 'dev@cocoon.apache.org'
Subject: RE: Unbalanced tags not triggering endTransformingElement in Transformer
To avoid confusion, please swap the pattern values of my example; "OK" should be "NOT_OK" and vice versa.
Let me call <br/> "unbalanced" element as opposed to <br></br>.
I'm extending AbstractSAXTransformer and noticed that unbalanced elements do not trigger endTransformingElement(...) if the source (or generator) is cocoon:/something.
Example:
1. Unbalanced tags do NOT trigger endTransformingElement(...)
<map:match pattern="NOT_OK">
<map:generate src="cocoon:/something"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
2. Unbalanced tags do trigger endTransformingElement(...)
<map:match pattern="OK">
<map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
Can somebody explain what I could possibly be missing or is that a bug in Cocoon?
Thanks,
Alexander
From: Lochschmied, Alexander
Sent: Donnerstag, 19. November 2009 13:46
To: dev@cocoon.apache.org
Subject: Unbalanced tags not triggering endTransformingElement in Transformer
Hello!
Let me call <br/> "unbalanced" element as opposed to <br></br>.
I'm extending AbstractSAXTransformer and noticed that unbalanced elements do not trigger endTransformingElement(...) if the source (or generator) is cocoon:/something.
Example:
1. Unbalanced tags do NOT trigger endTransformingElement(...)
<map:match pattern="OK">
<map:generate src="cocoon:/something"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
2. Unbalanced tags do trigger endTransformingElement(...)
<map:match pattern=" NOT_OK">
<map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
Can somebody explain what I'm could possibly be missing or is that a bug in Cocoon?
Thanks,
Alexander
Alexander Lochschmied
Web Programmer - Internet and Commerce
IT Global Web Services
Information Technology
Phone: +49 92 8771 2682
Fax +49 92 8771 2545
Website: www.vishay.com <http://www.vishay.com/>
Vishay Electronic GmbH
Geheimrat-Rosenthal-Str. 100
D-95100 Selb
Amtsgericht/County Court Hof HRB 2894,
Geschäftsführer/Managing Directors: Sieglinde Janker-Buecherl, Arnold Rohr
RE: Unbalanced tags not triggering endTransformingElement in Transformer
Posted by Robby Pelssers <ro...@ciber.com>.
I use the cocoon protocol all the time and never have any issues with it... But the only difference is that I don't use a custom-transformer but plain xslt transformers... So my guess is you might wanna double check that transformer.
Here is an example using even input from other blocks:
<!--
| {1}: product-id
-->
<map:match pattern="productinfo2Json/*">
<map:generate src="cocoon:/extractProductInfo/{1}"/>
<map:transform src="xslt/json/convertProductinfo2Json.xslt" type="saxon"/>
<map:serialize type="text"/>
</map:match>
<map:match pattern="productinfo2Table/*">
<map:generate src="cocoon:/extractProductInfo/{1}"/>
<map:transform src="xslt/product2Table.xslt" type="saxon"/>
<map:serialize type="xml"/>
</map:match>
<map:match pattern="extractProductInfo/*">
<map:generate src="servlet:shared:/file/newschema/product/{1}/released"/>
<map:transform src="xslt/extractProductInfo.xslt" type="saxon"/>
<map:serialize type="xml"/>
</map:match>
Works like a charm...
Kind regards,
Robby Pelssers
From: Lochschmied, Alexander [mailto:Alexander.Lochschmied@Vishay.com]
Sent: Friday, November 20, 2009 10:31 AM
To: dev@cocoon.apache.org
Subject: RE: Unbalanced tags not triggering endTransformingElement in Transformer
Hello again!
I think I was wrong, unbalanced tags do not seem to cause it. Here is sample input XML for my transformer:
<rowset xmlns="http://www.vishay.com/rowspan/1.0">
<row>
<P1000>abc</P1000>
<P1001>def</P1001>
<T8400>
<img src="small.jpg">img</img>
<br>br</br>
<a href="javascript:void(0)" onClick="foo(42)">Enlarge</a>
</T8400>
The elements inside T8400 (img, br, a) do not trigger endTransformingElement() but they do trigger startTransformingElement(). And again: This is only a problem if the input XML is coming from another Cocoon processing step. It is not a problem if the input XML is read from file system (with FileGenerator). This is actually the most confusing part for me.
If input comes from a file, they do generate the end events.
Any pointers for me?
Thanks,
Alexander
From: Lochschmied, Alexander
Sent: Donnerstag, 19. November 2009 14:23
To: 'dev@cocoon.apache.org'
Subject: RE: Unbalanced tags not triggering endTransformingElement in Transformer
To avoid confusion, please swap the pattern values of my example; "OK" should be "NOT_OK" and vice versa.
Let me call <br/> "unbalanced" element as opposed to <br></br>.
I'm extending AbstractSAXTransformer and noticed that unbalanced elements do not trigger endTransformingElement(...) if the source (or generator) is cocoon:/something.
Example:
1. Unbalanced tags do NOT trigger endTransformingElement(...)
<map:match pattern="NOT_OK">
<map:generate src="cocoon:/something"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
2. Unbalanced tags do trigger endTransformingElement(...)
<map:match pattern="OK">
<map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
Can somebody explain what I could possibly be missing or is that a bug in Cocoon?
Thanks,
Alexander
From: Lochschmied, Alexander
Sent: Donnerstag, 19. November 2009 13:46
To: dev@cocoon.apache.org
Subject: Unbalanced tags not triggering endTransformingElement in Transformer
Hello!
Let me call <br/> "unbalanced" element as opposed to <br></br>.
I'm extending AbstractSAXTransformer and noticed that unbalanced elements do not trigger endTransformingElement(...) if the source (or generator) is cocoon:/something.
Example:
1. Unbalanced tags do NOT trigger endTransformingElement(...)
<map:match pattern="OK">
<map:generate src="cocoon:/something"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
2. Unbalanced tags do trigger endTransformingElement(...)
<map:match pattern=" NOT_OK">
<map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
Can somebody explain what I'm could possibly be missing or is that a bug in Cocoon?
Thanks,
Alexander
Alexander Lochschmied
Web Programmer - Internet and Commerce
IT Global Web Services
Information Technology
Phone: +49 92 8771 2682
Fax +49 92 8771 2545
Website: www.vishay.com <http://www.vishay.com/>
Vishay Electronic GmbH
Geheimrat-Rosenthal-Str. 100
D-95100 Selb
Amtsgericht/County Court Hof HRB 2894,
Geschäftsführer/Managing Directors: Sieglinde Janker-Buecherl, Arnold Rohr
RE: Unbalanced tags not triggering endTransformingElement in
Transformer
Posted by "Lochschmied, Alexander" <Al...@Vishay.com>.
Hello again!
I think I was wrong, unbalanced tags do not seem to cause it. Here is sample input XML for my transformer:
<rowset xmlns="http://www.vishay.com/rowspan/1.0">
<row>
<P1000>abc</P1000>
<P1001>def</P1001>
<T8400>
<img src="small.jpg">img</img>
<br>br</br>
<a href="javascript:void(0)" onClick="foo(42)">Enlarge</a>
</T8400>
The elements inside T8400 (img, br, a) do not trigger endTransformingElement() but they do trigger startTransformingElement(). And again: This is only a problem if the input XML is coming from another Cocoon processing step. It is not a problem if the input XML is read from file system (with FileGenerator). This is actually the most confusing part for me.
If input comes from a file, they do generate the end events.
Any pointers for me?
Thanks,
Alexander
From: Lochschmied, Alexander
Sent: Donnerstag, 19. November 2009 14:23
To: 'dev@cocoon.apache.org'
Subject: RE: Unbalanced tags not triggering endTransformingElement in Transformer
To avoid confusion, please swap the pattern values of my example; "OK" should be "NOT_OK" and vice versa.
Let me call <br/> "unbalanced" element as opposed to <br></br>.
I'm extending AbstractSAXTransformer and noticed that unbalanced elements do not trigger endTransformingElement(...) if the source (or generator) is cocoon:/something.
Example:
1. Unbalanced tags do NOT trigger endTransformingElement(...)
<map:match pattern="NOT_OK">
<map:generate src="cocoon:/something"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
2. Unbalanced tags do trigger endTransformingElement(...)
<map:match pattern="OK">
<map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
Can somebody explain what I could possibly be missing or is that a bug in Cocoon?
Thanks,
Alexander
From: Lochschmied, Alexander
Sent: Donnerstag, 19. November 2009 13:46
To: dev@cocoon.apache.org
Subject: Unbalanced tags not triggering endTransformingElement in Transformer
Hello!
Let me call <br/> "unbalanced" element as opposed to <br></br>.
I'm extending AbstractSAXTransformer and noticed that unbalanced elements do not trigger endTransformingElement(...) if the source (or generator) is cocoon:/something.
Example:
1. Unbalanced tags do NOT trigger endTransformingElement(...)
<map:match pattern="OK">
<map:generate src="cocoon:/something"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
2. Unbalanced tags do trigger endTransformingElement(...)
<map:match pattern=" NOT_OK">
<map:generate src="same_something_as_above_but_now_as_a_file.xml"/>
<map:transform type="custom-transformer"/>
<map:serialize type="xml"/>
</map:match>
Can somebody explain what I'm could possibly be missing or is that a bug in Cocoon?
Thanks,
Alexander
Alexander Lochschmied
Web Programmer - Internet and Commerce
IT Global Web Services
Information Technology
Phone: +49 92 8771 2682
Fax +49 92 8771 2545
Website: www.vishay.com <http://www.vishay.com/>
Vishay Electronic GmbH
Geheimrat-Rosenthal-Str. 100
D-95100 Selb
Amtsgericht/County Court Hof HRB 2894,
Geschäftsführer/Managing Directors: Sieglinde Janker-Buecherl, Arnold Rohr