I am asking a follow-on question to help the OP from a SuperUser question which evolved into a programming question.
As you can see from the screenshots of Eclipse in my answer to that SU question, Eclipse has a robust and configurable engine for formatting XML (I'm using Eclipse Juno release, by the way).
The OP of the SU question chose Eclipse's XML engine as their preferred method of tidying their XML. Unfortunately, the OP prefers to work on the command line, and would like to capture the same functionality from Eclipse's XML formatting engine and make it run as a simple headless program that can be called from, e.g. bash
.
I am aware that Eclipse is extremely modular and extensible, so my intuition tells me that Eclipse would not tightly couple the functionality behind the XML engine with the UI. So, I think that there is some OSGi module in Eclipse that implements only the XML processing routines as a headless I/O interface rather than being coupled to the Eclipse runtime. It's perfectly fine if this interface depends on other parts of Eclipse, as long as it doesn't mandate starting up the Rich Client Platform and a GUI. I'm looking for a headless solution.
At which layer of the Eclipse stack would I be able to access this interface, in order to design a command line program that, essentially, accepts an XML file and a list of formatting preferences similar to the ones in the Eclipse Preferences pane (but specified as command-line arguments) and produces the formatted XML as output?
After some reading online, I think the XML source editor in Eclipse Juno is implemented in WST, but I don't know how to separate out the parts of WST that are unrelated to this project or which have GUI functionality, so that I can only call into the headless "engine" classes that actually do the XML parsing and modifying.
This question is not about how to use the interfaces in question. It's just that the Eclipse platform is so huge that merely discovering the existence of the library interface that I need is a challenge in and of itself, hence this question. Once I find an API that is situated at the right level of abstraction for this task, I will be able to learn about the API from the documentation and write the program without much further help.
The XML formatter is in the "org.eclipse.wst.xml.core" plugin.
org.eclipse.wst.xml.core.internal.formatter.XMLFormatterFormatProcessor
The plugin uses the extension point "org.eclipse.wst.sse.core.formatProcessors" to make it available.