You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by O....@sh.cvut.cz on 2004/01/05 21:38:23 UTC

Inserting XML

Hi, I'd like to ask, how to insert XML-valid fragment into generated XML 
document by XSP. I have stored XML fragment (or XHTML or whatever) in the 
database and I'd like to put it into any element in the serverpages. I tried 
<element><esql:get-string column="xml_part"/></element> or use ESQL helper or 
tried to wrote own replacing method, but always is returned text with replaced 
characters (< to &lt;, > to &gt; etc.). 

Another possibility could be maybe use any features of XSL transformation 
(maybe it could be still better), but I didn't found anything.

Or another (similar) question - how to pull out HTML document (it is not XML 
valid) from database and consequently send it correctly to the browser?

Do you have any idea? Thanks a lot!

otmar

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


AW: Inserting XML

Posted by Markus Heussen <he...@rheinland-online.com>.
Maybe I don't exactly understand your problem. XML documents stored in
database colums you can access using the <esql:get-xml column="name"/>. It
parses the text after loading it from the database and builds valid xml.

http://cocoon.apache.org/2.1/userdocs/xsp/esql.html

If it is no valid xml (just dirty html) you probably have to use the html
generator first. You can cinclude the output of another pipeline matcher in
your xsp page using the cocoon protocol. Try something like the following
(don't even know if it works):

In your XSP page do something like this:

<cinclude:include src="cocoon:/html-include"/>

And in your pipe something like this:

<map:match pattern="html-include">
	<map:generate type="html" src="cocoon:/load-from-db"/>
	<map:serialize type="xml"/>
</map:match>


<map:match pattern="load-from-db">
	<map:generate type="serverpages" src="{a page uses esql:get-string to get
html out of the db}"/>
	<map:serialize type="html"/>
</map:match>


Sources:
http://cocoon.apache.org/2.1/userdocs/generators/html-generator.html
http://cocoon.apache.org/2.1/userdocs/transformers/cinclude-transformer.html

Markus

> -----Ursprüngliche Nachricht-----
> Von: Yatin Shah
> Gesendet: Montag, 5. Januar 2004 22:25
> An: users@cocoon.apache.org
> Betreff: Re: Inserting XML
>
>
> Otmar,
>
> Here is a snipet from my xsp code:
>
>        String xml = appl.getNavigationXML(uriVendorCode);
>
>        System.out.println("*********************************** xml is: "
> + xml);
>
>        if (xml != null) {
>
> <util:include-expr><util:expr><xsp:expr>xml</xsp:expr></util:expr>
> </util:include-expr>
>        }
>
> This includes the xml for navigation within the xml generated by the xsp
> logic.
> In above, the applgetNavigationXML() simply returns a Java string of
> well formed xml.
>
> Hope this helps.
> -Yatin
>
> O.Vobejda@sh.cvut.cz wrote:
>
> >Hi, I'd like to ask, how to insert XML-valid fragment into generated XML
> >document by XSP. I have stored XML fragment (or XHTML or
> whatever) in the
> >database and I'd like to put it into any element in the
> serverpages. I tried
> ><element><esql:get-string column="xml_part"/></element> or use
> ESQL helper or
> >tried to wrote own replacing method, but always is returned text
> with replaced
> >characters (< to &lt;, > to &gt; etc.).
> >
> >Another possibility could be maybe use any features of XSL
> transformation
> >(maybe it could be still better), but I didn't found anything.
> >
> >Or another (similar) question - how to pull out HTML document
> (it is not XML
> >valid) from database and consequently send it correctly to the browser?
> >
> >Do you have any idea? Thanks a lot!
> >
> >otmar
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
>
> --
> Yatin Shah, President                       mailto:ygs@kripa.com
> Kripa Inc.                                  http://www.kripa.com
> Dayton, New Jersey USA                      phone:  732.329.8303
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Developers of real time event driven distributed DB applications
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org


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


Re: Inserting XML

Posted by Yatin Shah <no...@kripa.com>.
Otmar,

Here is a snipet from my xsp code:

       String xml = appl.getNavigationXML(uriVendorCode);

       System.out.println("*********************************** xml is: " 
+ xml);

       if (xml != null) {
             
<util:include-expr><util:expr><xsp:expr>xml</xsp:expr></util:expr></util:include-expr>
       }

This includes the xml for navigation within the xml generated by the xsp 
logic.
In above, the applgetNavigationXML() simply returns a Java string of 
well formed xml.

Hope this helps.
-Yatin

O.Vobejda@sh.cvut.cz wrote:

>Hi, I'd like to ask, how to insert XML-valid fragment into generated XML 
>document by XSP. I have stored XML fragment (or XHTML or whatever) in the 
>database and I'd like to put it into any element in the serverpages. I tried 
><element><esql:get-string column="xml_part"/></element> or use ESQL helper or 
>tried to wrote own replacing method, but always is returned text with replaced 
>characters (< to &lt;, > to &gt; etc.). 
>
>Another possibility could be maybe use any features of XSL transformation 
>(maybe it could be still better), but I didn't found anything.
>
>Or another (similar) question - how to pull out HTML document (it is not XML 
>valid) from database and consequently send it correctly to the browser?
>
>Do you have any idea? Thanks a lot!
>
>otmar
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>For additional commands, e-mail: users-help@cocoon.apache.org
>  
>

-- 
Yatin Shah, President                       mailto:ygs@kripa.com
Kripa Inc.                                  http://www.kripa.com
Dayton, New Jersey USA                      phone:  732.329.8303
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Developers of real time event driven distributed DB applications



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


Re: Inserting XML

Posted by Alex Romayev <ro...@yahoo.com>.
Otmar,

Take a look at CInclude and XInclude transformers.

-Alex

--- O.Vobejda@sh.cvut.cz wrote:
> Hi, I'd like to ask, how to insert XML-valid
> fragment into generated XML 
> document by XSP. I have stored XML fragment (or
> XHTML or whatever) in the 
> database and I'd like to put it into any element in
> the serverpages. I tried 
> <element><esql:get-string
> column="xml_part"/></element> or use ESQL helper or 
> tried to wrote own replacing method, but always is
> returned text with replaced 
> characters (< to &lt;, > to &gt; etc.). 
> 
> Another possibility could be maybe use any features
> of XSL transformation 
> (maybe it could be still better), but I didn't found
> anything.
> 
> Or another (similar) question - how to pull out HTML
> document (it is not XML 
> valid) from database and consequently send it
> correctly to the browser?
> 
> Do you have any idea? Thanks a lot!
> 
> otmar
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail:
> users-help@cocoon.apache.org
> 


=====
Alex Romayev
Software Architect
http://www.romayev.com
romayev@yahoo.com

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