At the moment, I don't think there is a proper way to solve your issues using dom4j. The problem is that the Attributes argument of the SAX ContentHandler.startElement(...) method also contains the attributes which have a default value according to the DTD, even if they don't occur in the XML document. There is no way to tell if the attribute has been specified in the XML document or not ...
This issue is addressed by the SAX2 1.1 Extensions (http://www.saxproject.org/?selected=ext ). Perhaps the dom4j.io.SAXContentHandler could be changed to check for these extensions. But I don't know how many parsers support these extensions at the moment (Aelfred2 - http://www.gnu.org/software/classpathx/jaxp/jaxp.html does). So it probably won't be that hard to solve your problem if you are using a parser which supports these SAX2 1.1 extensions ...
Could you create a RFE for this to make sure this issue doesn't get lost ... http://sourceforge.net/tracker/?group_id=16035&atid=366035
thanks, Maarten
Donald Ball wrote:
hey guys. i intended to send this to the dom4j users list but am unable to subscribe, sf is complaining about unroutable addresses. so apologies in advance if this is too off-topic.
i'm decorating some xhtml forms with dom4j. everything works great, with the exception of some failing xpath expressions which i've yet to develop a small unit test to demonstrate (but i will when i get a chance). anyway, my new problem is interesting. the output xhtml is adding attributes from the xhtml dtd, and is causing some layout grief in internet explorer (of course). specifically, all of my td elements are getting colspan="1" and rowspan="1" attributes, presumably because the dtd has this chunk:
<!ATTLIST td ... rowspan %Number; "1" colspan %Number; "1" >
any ideas on how i can disable this behavior, short of hacking the dtd manually? I'm using a plain old XMLWriter instance with an OutputFormat set to XHTML true and encoding ISO-8859-1. thanks, and sorry again for the misplaced message.
- donald
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ dom4j-dev mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-dev