Title: RE: Getting XML from request

The XMLizable object I am using is from

org.apache.cocoon.components.source.URLSource

Which gets an xml file from a url.  The file is a regular xml file with a couple of nodes in it.

This class extends from

org.apache.cocoon.components.source.AbstractStreamSource

which is where the actual toSax() code is.

    public void toSAX(ContentHandler handler) throws SAXException, ProcessingException {
        Parser parser = null;
        try {
            parser = (Parser)this.manager.lookup(Parser.ROLE);

            parser.parse( this.getInputSource(), handler);
        } catch (SAXException e) {
            // Preserve original exception
            throw e;
        } catch (Exception e){
            throw new ProcessingException("Exception during processing of "
                                          + this.getSystemId(), e);
        } finally {
            if (parser != null) this.manager.release(parser);
        }
    }

So I haven't found where/how the classname@memory-address is getting added to the xml.

Thanks for continuing to work with me on this, I really need the help.



-----Original Message-----
From: Vadim Gritsenko [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 10:37 AM
To: [EMAIL PROTECTED]
Subject: RE: Getting XML from request


Now you can go to XSPObjectHelper.xspExpr and see that if object is
XMLizable it does not print anything like classname@memory-address.

Can it come from your XMLizable object? Test it.


Vadim


-----Original Message-----
From: Mike Ash [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 11:16 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Getting XML from request

I did and here is the line in java
   XSPObjectHelper.xspExpr(contentHandler,
request.getAttribute("xmlData"));
the XSPObjectHelper.xspExpr is suppossed to work with the XMLizable
object to get the xml.  So is this saying that the URLSource object I
put in there is not doing the toSax() method correctly?

-----Original Message-----
From: Vadim Gritsenko [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 9:44 AM
To: [EMAIL PROTECTED]
Subject: RE: Getting XML from request

Check Java code generated from the XSP, in tomcat/work directory.

Vadim

-----Original Message-----
From: Mike Ash [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 10, 2002 8:26 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Getting XML from request
Well I finally got an XMLizable object (URLSource) put into the request,

however when I try to get it like this
<xsp-request:get-attribute name="xmldata" as="xml" />
it returns the xml but also
my.class.name@memoryaddress
the above line make the xml it returns invalid.
Anyone know how to turn off the extra line?  It looks to me like it is
calling the toString() method on my object.
-----Original Message-----
From: Vadim Gritsenko [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 12:09 PM
To: [EMAIL PROTECTED]
Subject: RE: Getting XML from request
Your object must be XMLizable (best), or DOM Node, but not String.
Other (not effective) way is to use util logicsheet to parse your String

into XML. Answers about it are in the archives, with periodicity one
week or so.
Vadim
-----Original Message-----
From: Mike Ash [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 12:25 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Getting XML from request
Sorry about not using plain text.
What I would like to end up with is nodes from the xsp page that contain

the nodes from the object i put in the request.
<page>
        <para>
                <mynode>
                        <mychildnode>
                                ....
                        </mychildnode>
                </mynode>
        </para>
</page>
               
What I am getting now is
<page>
        <para>
                <xsp-request:attribute name="xmlData">
                <!-- these are not nodes but the value of the above node

-->
                        &lt;mynode&gt;
                                &lt;mychildnode&gt;
                                        ....
                                &lt;/mychildnode&gt;
                        &lt;/mynode&gt;
                </xsp-request:attribute>
        </para>
</page>
-----Original Message-----
From: Vadim Gritsenko [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 11:10 AM
To: [EMAIL PROTECTED]
Subject: RE: Getting XML from request
> I need that object back as xml in an xsp page, when I try this
> xsp:request:get-attribute name="xmlData" as="xml"
Correct syntax is:
<xsp-request:get-attribute name="xmlData" as="xml"/>
Result will be (IIRC):
<xsp-request:attribute name="xmlData">value of
attribute</xsp-request:attribute>
For:
<xsp-request:get-attribute name="xmlData" as="string"/>
Result will be:
value of attribute
For:
Object o = <xsp-request:get-attribute name="xmlData" as="object"/>;
Result will be assigned to object 'o'.
> The question is then how do I get the data into the xsp as
> real xml nodes that I can use in a transformation step with xsl?
What do you mean?
PS PLEASE SEND PLAIN TEXT EMAILS
Vadim
-----Original Message-----
From: Mike Ash [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, June 05, 2002 11:25 AM
To: '[EMAIL PROTECTED]'
Subject: Getting XML from request
I am storing xml data in the request object by using
request.setAttribute("xmlData", someObject);
I need that object back as xml in an xsp page, when I try this
xsp:request:get-attribute name="xmlData" as="xml"
it returns the "xml" as a node value instead of individual nodes.
The question is then how do I get the data into the xsp as real xml
nodes that I can use in a transformation step with xsl?
 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to