M
Michael Jung
Jason Cavett said:I'm displaying XML in a JTextPane. I was wondering if there was a way
to display the XML formatted with color/text/etc. (Basically, I'm
wondering if I can associated an XML style.) I've searched a bit, but
I haven't been able to get anything to work.
You can transform XML via XSL into (X)HTML and then display it in the
JTextPane. The bit with setting the page without having an URL is
somewhat awkward. I asked a similar question a while ago and got no
answer. I looked at the relevant JDK source code and couldn't really
make out the reason for the different working of setPage(URL) and
setText(String). I rather wrote a URL handler for the "string:"
protocol and registered that. Only a few lines.
Hope that helps.
Michael