cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Derek Hohls" <DHo...@csir.co.za>
Subject Re: REPOST: HTML Tags from a database field
Date Mon, 14 Jan 2008 05:57:01 GMT
Grzegorz
 
That could be the issue - the database field may *contain* XML tags
but does not necessarily *start* with one.  Maybe I could wrap the
whole field in a "<div>" tag before posting it, although that seems a 
little clumsy - I agree it would be easier to specifically request a field
as XML, with the option to add a wrapper, at request time.
 
Any chance this approach can be "patched" as part of the 2.1.x series?
 
Derek

>>> Grzegorz Kossakowski <gkossakowski@apache.org> 2008/01/13 02:06 AM >>>
Derek Hohls pisze:
> Tobia
>  
> Whew!  Sounds like a lot of work for what I thought would be a
> simple config issue.   Any chance you could make the stylesheets
> available - maybe upload them to the wiki?

I just looked at the code of SQLTransformer and found this, which is rather interesting to
you:
        protected void serializeData(String value)
        throws SQLException, SAXException {
            if (value != null) {
                value = value.trim();
                // Could this be XML ?
                if (value.length() > 0 && value.charAt(0) == '<') {
                    try {
                        stream(value);
                    } catch (Exception ignored) {
                        // FIXME: bad coding "catch(Exception)"
                        // If an exception occured the data was not (valid) xml
                        data(value);
                    }
                } else {
                    data(value);
                }
            }
        }

As you see, SQLTransformer checks for possibility that it got an XML as value. The check is
quite
silly but should work. The question is: does the XML stored in a database starts with "<"
as a first
character or something else?

BTW. I'm quite surprised that it seems there is no way to explicitly tell the SQLTransformer
to
handle some columns as a serialized XML content that needs parsing...

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/ 

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


-- 
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice,
and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for their support.


Mime
View raw message