Hi,
I am reading in an XML file, displaying the elements' values, and changing the elements' values with no problems.
Following some examples I found, I am using classes javax.xml.transform.Transformer and javax.xml.transform.stream.StreamResult to write the changed values back to the file.
This is working: the new values are in the file but I have one problem.
The values in my XML are strings and some of them are fairly long. When Transformer and StreamResult write them back to the file, they break the element into two lines in a way that I do not want:
The <data> nodes are third level nodes and are tabbed 3 times from the left edge; I couldn't figure out how to get this editor to keep those tabs except by putting in \t's; this worked but the \t's are visible: is there a better way to include XML?
original
\t\t\t <data>0. YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING.</data>
\t\t\t <data>AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND
</data>
\t\t\t <data>DOWN A GULLY.</data>
becomes
\t\t\t <data>0. YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING.
</data>
\t\t\t <data>AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND
</data>
\t\t\t <data>DOWN A GULLY.</data>
Is there some way I can correct this so the becames is formatted the same as the original?
By the way, I changed
0. YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING.
to
When in the course of human events it becomes necessary for one people to dissolve
This
string is longer than the original one that is causing me problems but it was written correctly to the file. ???
Here is the code that writes the XML back to the file.
Thanks.