How to reuse XML syntax highlighting in your own editor
If you don’t want to open or edit your data in a new editor TopComponent, but you still want to have nice syntax coloring in your own editor, you can get the EditorKit for the mime type and reuse it in your own JEditorPane.
For example, if you want to nicely display some XML in your own JEditorPane then first make sure all the required modules are loaded then:
String mime = "text/xml";
EditorKit ek = CloneableEditorSupport.getEditorKit(mime);
editorPane.setEditorKit(ek);
editorPane.setContentType(mime);
editorPane.setText(xml);
And you will get nice syntax coloring. However you won’t get line numbers and other editing facilities since they are not provided by the EditorKit.