So, first off my code is hand jammed since my dev box is airgapped from the internet. I need to code to the java 1.4 standard(I know I know, it'll be updated someday). So the problem that I'm having is this. I wrote a sample xml file to use as a config. It is as follows.
So the problem that I'm having is when I try to add another error it's not indented properly and it looks like this:
Here is the code that I'm using to update it, most of the other code is omitted, but this part is the action performed for the update button. I'll include the parts in here for how I'm loading the xml document, but that is actually an object that lives elsewhere.
Thanks for that helpful reply. I know that the parser doesn't care, but I need it to be human readable. There are situations where this file may need to be hand edited.
[0] Hi. I agree and independently confirm the observation that the passing in DOMSource from edited dom will preserve the "ignorable" whitespace that causes the problem of misalignment. (True, for human-readability). One of the source of obstacle is that the factory method of setIgnoringElementContentWhitespace is only effective when the document is to be validated against a dtd or xsd or others. (There seems to have a unfortunate history of bugs in 1.5 seemingly doing a job but conceptually defective. But, brief...) That stops one from using that facility to re-align the indents. So my above suggestion would not do any good.
[1] In the making of output stream, you can supply, instead of using the build-in identity transformation, a constant & fixed xsl document to do the re-alignment. Let's call it indenter.xsl. It uses xalan extension, though.
[2] With that in the working directory (or relocate it, as long as it is properly pointed to), just modify the line setting up the transformer.