cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Don Saxton" <dsax...@pacbell.net>
Subject Re: [Chiba-developer] chicoon: possible cocoon bug / reading DOM from session attr.
Date Fri, 11 Apr 2003 01:51:08 GMT
Excellent Olli!  I can comfirm that works.

Actually I thought we both had done something wrong rather than
SessionAttributeGenerator sitting around unused and broken, so I spent time
investigating what was happening with cocoon transformers and xalan (until I
was dizzy).  The problem seems to be that each of our seesion DOMs has no
systemid (required by DOMSource), but adding one on a session dom would be
really odd. Still the w3 does say it can be null. Possibly this change
should be a override of XMLUtils.valueOf. It turns out that SAG and RDST are
its only current uses.

That cleared up I find that my instance is  not being updated by chiba
processor (back to the stone).

BTW I add the samefix to the case where there is no root element
SessionAttributeGenerator  like below.

Don

    public void generate() throws IOException, SAXException,
ProcessingException {
        xmlConsumer.startDocument();

        if (this.elementName != null) {
            xmlConsumer.startElement("", this.elementName, this.elementName,
new AttributesImpl());
            // patch to avoid xml declaration inside trigger tag:
            // here we only want the pure xml from the root node on
            if (this.attrObject instanceof Node &&
((Node)this.attrObject).getNodeType() == Node.DOCUMENT_NODE) {
             Node node = ((Document)this.attrObject).getDocumentElement();
             XMLUtils.valueOf(xmlConsumer, node);
            } else {
             XMLUtils.valueOf(xmlConsumer, this.attrObject);
            }
            xmlConsumer.endElement("", this.elementName, this.elementName);
        } else {
     // XMLUtils.valueOf(xmlConsumer, this.attrObject);

            // patch to avoid xml declaration inside trigger tag:
            // here we only want the pure xml from the root node on
            if (this.attrObject instanceof Node &&
((Node)this.attrObject).getNodeType() == Node.DOCUMENT_NODE) {
             Node node = ((Document)this.attrObject).getDocumentElement();
             XMLUtils.valueOf(xmlConsumer, node);
            } else {
             XMLUtils.valueOf(xmlConsumer, this.attrObject);
            }
        }

        xmlConsumer.endDocument();
    }




----- Original Message -----
From: "Oliver Charlet" <oliver.charlet@form4.de>
To: "Chiba-Developer Mailinglist" <chiba-developer@lists.sourceforge.net>;
<cocoon-users@xml.apache.org>
Sent: Thursday, April 10, 2003 5:22 AM
Subject: AW: [Chiba-developer] chicoon: possible cocoon bug / reading DOM
from session attr.


hi don, hi chicoonees,

I tried cocoon with the latest xerces and xalan, but it did not change
anything. I looked at the SessionAttributeGenerator and
ReadDOMSessionTransformer again and I found, that the problem lies within
org.apache.cocoon.xml.XMLUtils. Both components use this class to
getValue(). This Class streams the DOM in the session as SAX events. In the
case of a document node of course all node types are streamed. so is the
declaration for the complete document. Since the generator and the
transformer always include this stream inside or relative to an existing XML
(wrapper / trigger elements) there never is the need for the declaration. So
I patched those two classes (attached) to take the root element node instead
of the whole document. This is probably not a clean solution, but it might
work for most cases. Unfortunately I lack enough knowledge of cocoon to see
the "real solution".
And still the problem of that strange insertion of the declaration inside
the trigger tag is a mistery and probably a problem of the sax engine.

hope that helps someone :-)
:olli

-----Urspr√ľngliche Nachricht-----
Von: Don Saxton [mailto:dsaxton@pacbell.net]
Gesendet: Freitag, 4. April 2003 19:46
An: Oliver Charlet
Betreff: Re: [Chiba-developer] chicoon: possible cocoon bug / reading
DOM from session attr.


olli

Just to show you are not alone I included two mail on this.  I have also
seen the garbled xml result, but won't be able to get back to this until
next week.

Don


----- Original Message -----
From: Don Saxton
To: cocoon-users@xml.apache.org
Sent: Monday, March 31, 2003 4:01 PM
Subject: Failed to execute pipeline.: Errors in XSLT transformation


I have tried several xsl and after double checking each of them  I am
stumped.

I found several zarros in  bugzilla. In mail list I have seen several
"Failed to execute pipeline"  and a couple related to NPE, but none linking
either to "Errors in XSLT".  Worse these other msgs don't indicate what
solved the their problems.

I am running 2.04 on w2k and I sure could use a clue.  All classes
immediately surrounding the error are all cocoon. I have been studiously
avoiding 2.1 beta chaos. Is it now time to dive in?  will that help?

Don


org.apache.cocoon.ProcessingException: Failed to execute pipeline.:
java.lang.RuntimeException: Errors in XSLT transformation:
Fatal: java.lang.NullPointerException


 at
org.apache.cocoon.components.pipeline.CachingStreamPipeline.process(CachingS
treamPipeline.java:410)

----- Original Message -----
From: "Joerg Heinicke" <joerg.heinicke@gmx.de>
To: <cocoon-users@xml.apache.org>
Sent: Tuesday, April 01, 2003 11:46 AM
Subject: Re: Failed to execute pipeline.: Errors in XSLT transformation


> Hello Don,
>
> there is nothing wrong the XSLT itself, so "Errors in XSLT" is not a
> correct message. But I can't tell you, what the error is.
>
> I "refactored" the stylesheet using templates instead of for-each. If
> there is a bug in Xalan 2.3.1 (this should be the version used in Cocoon
> 2.0.4), it will maybe already work. Another suggestion is to update the
> Xalan version to 2.4.1. This sometimes solves some problems.
>
> Regards,
>
> Joerg
>
> Don Saxton wrote:
> > Geoff
> >
> > this pipe works and results in the p1.xml attached.
> > generate type="session-attr"
> > serialize type="xml"
> > result is p1.xml (attached)
> >
> > Yet this pipe does not generate type="session-attr"
> > transform src="person.xsl"  (attached )
> > serialize type="html" (never gets here)
> > result is  this error
> >
> > Original exception : java.lang.RuntimeException: Errors in XSLT
> > transformation:
> > Fatal: java.lang.NullPointerException
> >
> > at
> >
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:3170)

----- Original Message -----
From: "Oliver Charlet" <oliver.charlet@form4.de>
To: "Chiba-Developer Mailinglist" <chiba-developer@lists.sourceforge.net>
Sent: Friday, April 04, 2003 7:14 AM
Subject: [Chiba-developer] chicoon: possible cocoon bug / reading DOM from
session attr.


> for all chicoon users:
>
> I experience a major problem while pipelining a xform submission.
> I use an submission with the following action:
> "cocoon:/productsearch/store-shopping-cart" replace: "none"
> I use the store-shopping-cart piepline to store the shopping cart and
> replace/none ignores any returned XML.
> basically I use a SessionAttributeGenerator to get the instance DOM from
the
> session (the new cocoon connectors store it there).
> after that I use cocoon internal components to store some of the xml to a
> database.
>
> When I just use a Serializer to show the XML (switching to replace="all")
I
> see the correct instance XML.
>
> the problem occures only when I add an XSLT Transformer after the
Generator
> to extract the persistent part of the instance xml. the TraxTransformer
> throws a NullpointerEx and it shows behaviour like it does not get any
> input...
> XSL:
> ...
> <xsl:template match="/|*">
> <found>
> <xsl:attribute name="name"><xsl:value-of select="name(.)"
> /></xsl:attribute>
> <xsl:attribute name="childs"><xsl:value-of select="count(*)"
> /></xsl:attribute>
> </found>
> <xsl:apply-templates/>
> </xsl:template>
> ...
>
> Result:
> <?xml version="1.0" encoding="UTF-8"?>
> <found name="" childs="0"/>
>
> further debugging shows, that a readDOMsessionTransformer acts strangly
too:
> using a simple trigger tag shows the follwing result after the transform
> (position="IN"):
> <?xml version="1.0" encoding="UTF-8"?>
> <trigger<?xml version="1.0" encoding="UTF-8"?>
> ><searchresult currentpage="1"
> xmlns:sql="http://apache.org/cocoon/SQL/2.0"><baglist label="Page 1"
> page="1">...cut...</baglist></searchresult>
> </trigger>
>
> the strange insertion of the xml declaration inside the trigger tag made
me
> think, that probably the DOM was not proper.
> I talked to Uli and he told me that only an element node from the original
> instance DOM was put into the session instead of a complete document. So I
> thought, that probably only a document node was expected by the
> SessionAttributeGenerator and the ReadDOMSessionTransformer. So I patched
> chicoon, creating a complete new document with a copy of the orignal
> instance data in it and put that into the session, but: same result!
>
> finally I just created a new cocoon Bug ticket:
> http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18703
>
> maybe one of you has an idea?
>
> greetings
> :olli
>
>
> ------------------------------
> oliver charlet
> form4 GmbH & Co. KG
> rungestr. 19
> 10179 berlin
>
> oliver.charlet@form4.de
> fon +49 (30) 27 87 84 - 0
> fax +49 (30) 27 87 84 - 10
> www.form4.de
> ------------------------------
>





----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-users-help@xml.apache.org


Mime
View raw message