You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Kevin McDermott <ke...@realise.com> on 2003/05/06 16:53:51 UTC

Converting Entities

Hi All,

We're working on integrating Interwoven's TeamSite with Cocoon, using
TeamSite's Data Capture Records (DCRs) to generate source documents.

TeamSite is "entitising" content that is entered into fields, which Cocoon
keeping through to the browser.

    <main-content>
        <language-block>
            <chunk>
                &lt;p&gt;
                    &lt;H3&gt;Pressure Rising In Oil Market&lt;/H3&gt;g
                &lt;/p&gt;
                &lt;p&gt;
            Oil is a key commodity for the industrialised world,
            </chunk>
        </language-block>
     </main-content>

I've tried overriding the TraxTransformer's "characters" callback like this:

public class DeEntTraxTransformer extends TraxTransformer {

    public void characters(char c[], int start, int len) throws SAXException
{
        String initialString = new String(c, start, len);
        CharacterEntityParser cleaner =
CharacterEntityParser.createHTMLEntityParser();
        String transformedString = cleaner.decodeEntities(initialString);
        int transformedStringLength = transformedString.length();
        super.contentHandler.characters(transformedString.toCharArray(), 0,
transformedStringLength);
    }
}

By the time "characters" gets called tho', the XML parser has (correctly)
resolved the entities, so this does nothing.

I've tried the same thing in the Serialiser, to no avail.

Has anybody got any suggestions, as this is proving a show-stopper...

Thanks

Kevin McDermott
---
Kevin McDermott    Senior Technologist
0131 476 6000   Cert. TeamSite Consult
kevin@realise.com www.realise.com





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