On 4/14/06, Dominik Bruhn <[EMAIL PROTECTED]> wrote:
>
> Hy,
> I know its not a velocity-specific question, but perhaps someone knows a
> solution.
>
> Perhaps you know BBCode: These is a Markup-Language used in
> Web-Bulletin-Boards like PHPBB or VBulletin. BB-Codes makes it possible to
> format the text by the user in easy ways while perserving the security for
> the administrators (no JavaScript, no IFrames, only permitted Tags). For
> example you get the String "[b]This is Bold [i] and this is italic and
> bold[/i][/b]". Now I need a piece of java which converts these Strings
> into
> HTML again, in case of this example to a string like "<b>This is Bold <i>
> and
> this is italic </i></b>". There are some difficult tags like
> [url="http://google.com"]Search Engine[/url] which should be converted to
> "<a
> href="http://google.com"; target="_blank">Search Engine</a>".
>
> I know you could realize this easily by using Regular-Expressions, but
> this is
> not enough: You have to check that every tag opened is closed again,
> otherwise you get ugly HTML or the User is able to format more than his
> code
> because there is no closing Tag.
>
> I know the solution for these problems is to split up the string into a
> tree,
> then check it and merge the tree to the output-string again. Thats how the
> mentioned PHP-Boards do it. I could now realize this code in Java which
> costs
> me many time. Thats why I ask here: Is there someone who knows a
> BBCode-Parser written in Java?
>
> Thanks
> TO


check
http://www.koders.com/java/fid026F81DAE7C88C51203F24179E95959F0DBA4E6D.aspx?s=ToTextRenderer

it is part of the jboss project.  may help.

--
Regards,
Shawn

Reply via email to