You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Amal Sirvisetti <am...@sirvisetti.com> on 2001/06/17 04:12:29 UTC
XMLFragment and toSAX in C2
Hi,
I have implemented an XMLFragment class based on the AbstractXMLFragment
in C2 (dev-2.1). Within the toSAX() method I call another Java class
that returns me an XML string. I want to insert this string into the XSP
page. However, when I call the hander.characters(...) method, the < and
> signs are getting converted to < and > respectively and the XML
document strcuture is not preserved. Is there an easy way to handle
this? Or, do I need to parse the incoming string and prepare the XML
again using the startElement and endElement methods?
Please advise.
Thanks,
Amal
Sirvisetti Systems
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>
Re: XMLFragment and toSAX in C2
Posted by Sylvain Wallez <sy...@anyware-tech.com>.
Amal Sirvisetti a écrit :
>
> Hi,
>
> I have implemented an XMLFragment class based on the AbstractXMLFragment
> in C2 (dev-2.1). Within the toSAX() method I call another Java class
> that returns me an XML string. I want to insert this string into the XSP
> page. However, when I call the hander.characters(...) method, the < and
> > signs are getting converted to < and > respectively and the XML
> document strcuture is not preserved. Is there an easy way to handle
> this? Or, do I need to parse the incoming string and prepare the XML
> again using the startElement and endElement methods?
>
> Please advise.
>
> Thanks,
> Amal
> Sirvisetti Systems
>
The characters() method in ContentHandler is used to output...
characters. That's why "<" and ">" are escaped to < and >
To achieve the desired behaviour, you need to pass your XML-in-a-String
through a parser that outputs SAX events into the ContentHandler
parameter of toSAX().
--
Sylvain Wallez
Anyware Technologies - http://www.anyware-tech.com
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>