colored xml display in swing
Asked Answered
K

2

5

Is there an "easy" way to display xml data to a user via an JEditorPane or JTextPane in colored/highlighted way?

Kurth answered 5/11, 2010 at 19:28 Comment(0)
F
4

An example of XMl Syntax Highligthing for JTextPane you find here

It's a good link, the TAG_PATTERN regex should be enhanced.

Just replace (</?[a-z]*)\\s?>? by (</?\\w+)\\s*>? and it should work perfectly !

Formic answered 5/11, 2010 at 19:37 Comment(0)
B
5

http://java-sl.com/xml_editor_kit.html You can try this as well.

Backman answered 7/11, 2010 at 7:52 Comment(5)
Very interesting site!Thank you.Is it yours? Are there any licensing on your projects?Kurth
No restrictions at all. You can use all the code as you wish.Backman
I tried to use the jar in Netbeans but it seems that it can not find the XMLEditorKit inside the xmleditorkit package. It sees only App,TagView,XMLDocument,XMLReader. So in the line editorPane.setEditorKit(new XMLEditorKit()); Netbeans marks as error and can not find XMLEditorKit in the xmleditor package. Any idea why?Kurth
I just opened the .jar file and see th XMLEditorKit.class. Try t check your imports or you can get all the sources from the .jar (see src directory) and add to you app as normal sources.Backman
hey @Backman i tried using your jar but i can no longer edit my xml anymore on the pane! can you please help me with the same!Blim
F
4

An example of XMl Syntax Highligthing for JTextPane you find here

It's a good link, the TAG_PATTERN regex should be enhanced.

Just replace (</?[a-z]*)\\s?>? by (</?\\w+)\\s*>? and it should work perfectly !

Formic answered 5/11, 2010 at 19:37 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.