cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Russell <p...@luminas.co.uk>
Subject Re: Embeding XML from java object.
Date Tue, 19 Sep 2000 08:56:01 GMT
What your method is returning is a string, rather than XML -
I'm not the expert at this, but I suspect if you return a DOM
fragment, you might have more luck. Failing that, you need to
parse the XML you're returning, rather than just plonking the
string into the DOM tree.

On Mon, Sep 18, 2000 at 09:02:37PM -0400, Claude Warren wrote:
> After further testing I found that the output being generated was:
> 
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"
> "http://www.w3.org/TR/REC-html40/strict.dtd">
> <html><head><title>xsp test page</title></head><body>
> 
> 
> &lt;idcard id=&quot;1&quot;&gt;
> &lt;name&gt;
> &lt;family&gt;F_name&lt;/family&gt;
> &lt;given&gt;G_name&lt;/given&gt;
> &lt;sort&gt;F_NAME, G_NAME&lt;/sort&gt;
> &lt;display&gt;G_name F_name&lt;/display&gt;
> &lt;/name&gt;
> &lt;address&gt;
> &lt;line&gt;addr 1&lt;/line&gt;
> &lt;line&gt;addr 2&lt;/line&gt;
> &lt;line&gt;addr 3&lt;/line&gt;
> &lt;line&gt;addr 4&lt;/line&gt;
> &lt;locality&gt;city&lt;/locality&gt;
> &lt;region&gt;state&lt;/region&gt;
> &lt;postalcode&gt;zip code&lt;/postalcode&gt;
> &lt;country&gt;USA&lt;/country&gt;
> &lt;/address&gt;
> &lt;phone prefered=&quot;true&quot;&gt;
> &lt;type&gt;voice&lt;/type&gt;
> &lt;number&gt;+1 803 555 1212&lt;/number&gt;
> &lt;/phone&gt;
> &lt;phone prefered=&quot;false&quot;&gt;
> &lt;type&gt;fax&lt;/type&gt;
> &lt;number&gt;+1 803 555 2121&lt;/number&gt;
> &lt;/phone&gt;
> &lt;email prefered=&quot;true&quot;&gt;
> G_name F_name &lt;eaddr@server.com&gt;&lt;/email&gt;
> &lt;/idcard&gt;
> 
> 
> </body></html>
> 
> 
> So the output is being converted from the "<" to "&lt;" form.  How can I
> stop this so that the input will be processed correctly?"
> 
> 
> Claude Warren wrote:
> 
> > Hello,
> >
> > I have a java object that produces XML output.  This is not a servlet.
> > I  can not seem to get the XML that is output by the object formatted by
> > the xsl.  What am I doing wrong???  I am using cocoon 1.7.4, Apache
> > Server, Apache JServe engine, Linux, IBM java 1.1.8.
> >
> > XML page:
> >
> > <?xml version="1.0"?>
> > <?cocoon-process type="xsp"?>
> > <?cocoon-process type="xslt"?>
> > <?xml-stylesheet href="test-pre.xsl" type="text/xsl"?>
> >
> > <xsp:page language="java"
> > xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> > <page>
> > <xsp:logic>
> >   Class.forName("com.imaginary.sql.msql.MsqlDriver");
> >   String dburl = "jdbc:msql://histio.org/hs";
> >   java.sql.Connection con = java.sql.DriverManager.getConnection(dburl,
> > "test",
> > null);
> >   org.histio.db.Member member = new org.histio.db.Member();
> >   member.setConnection( con );
> >   member.setID( "1" );
> > <xsp:content>
> > <xsp:expr>
> > org.histio.util.xml.XMLTranslator.toXML( member )
> > </xsp:expr>
> > </xsp:content>
> > </xsp:logic>
> > </page>
> > <?xml version="1.0"?>
> > <?cocoon-process type="xsp"?>
> > <?cocoon-process type="xslt"?>
> > <?xml-stylesheet href="test.xsl" type="text/xsl"?>
> >
> > <xsp:page language="java"
> > xmlns:xsp="http://www.apache.org/1999/XSP/Core">
> > <page>
> > <xsp:logic>
> >   Class.forName("com.imaginary.sql.msql.MsqlDriver");
> >   String dburl = "jdbc:msql://localhost/hs";
> >   java.sql.Connection con = java.sql.DriverManager.getConnection(dburl,
> > "test",
> > null);
> >   org.histio.db.Member member = new org.histio.db.Member();
> >   member.setConnection( con );
> >   member.setID( "1" );
> > <xsp:content>
> > <xsp:expr>
> > org.histio.util.xml.XMLTranslator.toXML( member )
> > </xsp:expr>
> > </xsp:content>
> > </xsp:logic>
> > </page>
> > </xsp:page>
> >
> > The output that I get is the XML from the object.  If I reverse the
> > order of the <?cocoon-process type="xsp"?> and <?cocoon-process
> > type="xslt"?> lines I don't even get that.  Any suggestions would be
> > appreciated
> >
> > ---------------------------------------------------------------------
> > 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

-- 
Paul Russell                               <paul@luminas.co.uk>
Technical Director,                   http://www.luminas.co.uk
Luminas Ltd.

Mime
View raw message