Have a set of XML files that need some optional tags adding - so
they're being SAX parsed (xerces 2.6.0, jdk 1.4.1).
However - the important point is not to modify the XML more than
necessary - and that includes not adding default attributes for
attributes that have a default specified in the DTD. I've seen a
couple of mails that suggest removing these defaults from the DTD but
this is not an option - they are required by other parts of the
system.
So - I had a look at
http://xml.apache.org/xerces2-j/features.html#nonvalidating.load-dtd-grammar
and have the code:
XMLReader reader = saxParser.getXMLReader();
reader.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar",
false);
which from the docs looks like it should "not use the default
attributes and attribute types".
However - the attrs in startElement still contain the default values
for non-present attributes.
I've also tried setting validation to false (should be default) - no
difference.
Any ideas? Have I misunderstood the feature?
Regards
--
Chris Searle
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|