Roedy Green<see_website@mindprod.com.invalid> writes:
On Thu, 13 May 2010 19:48:46 +0100, Tom Anderson
<twic@urchin.earth.li> wrote, quoted or indirectly quoted someone who
said :
motive? Contractor may have known precisely what he needed the first
line to look like, but could not bludgeon his XML package to produce it
so gave up and did it manually.
What XML package? I'm not sure what you mean.
He may have experimented with various XML read/write packages, see
http://mindprod.com/jgloss/xml.html and had trouble generating
precisely what he wanted. He then decided to eschew XML packages (at
least for writing) since it is not particularly difficult to do
manually, and since you have precise control.
For what it's worth, here's some code I wrote in 2003. It's part of a
JUnit test for a custom XML parsing framework.
private final static String header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
private final static String doc1 =
header
+ "<root foo='bar' baz='quux'>"
+ "<property name='var' value='value'/>"
+ "<property name='nested' value='var'/>"
+ "yabba dabba doo"
+ "<nested blah='blah blah' subst='${var}' nested-subst='${${nested}}'/>"
+ "</root>";
I didn't use an XML writer because I didn't see any particular point in it.
In 2003 I don't think the Java XML API's had anything.