<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.0.6249.1">
<TITLE>SAXBuilder inclusion of default attributes</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">I am working with a third party data source, that submits xml to me. The DTD for this submission contains several elements that have attributes with default values, ie if certain attributes for an element are omitted, they have a default value, as defined by the DTD.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">I am doing some manipulation of this file and then sending it on to a new destination. However, when I use SAXBuilder to build the document (even with validation off), it explicitly includes the default values for omitted attributes in the Document.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">For example:</FONT>
<BR><FONT SIZE=2 FACE="Arial"><!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 2.0//EN" "<A HREF="http://www.w3.org/2001/SMIL20/SMIL20.dtd">http://www.w3.org/2001/SMIL20/SMIL20.dtd</A>"></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <smil xmlns="<A HREF="http://www.w3.org/2001/SMIL20/Language">http://www.w3.org/2001/SMIL20/Language</A>"></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <head></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <layout></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <root-layout/></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <region id="region1_1" top="0" left="0" height="100%" width="100%"/></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </layout></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </head></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <body></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <seq></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <par dur="5000ms"></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <text src="slide3.txt" region="region1_1" /></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </par></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </seq></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </body></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </smil></FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">after SAXBuilder parsing (new SAXBuilder(false)) it becomes:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial"><?xml version="1.0" encoding="UTF-8"?></FONT>
<BR><FONT SIZE=2 FACE="Arial"><!DOCTYPE smil PUBLIC "-//W3C//DTD SMIL 2.0//EN" "<A HREF="http://www.w3.org/2001/SMIL20/SMIL20.dtd">http://www.w3.org/2001/SMIL20/SMIL20.dtd</A>"></FONT>
<BR><FONT SIZE=2 FACE="Arial"><smil xmlns="<A HREF="http://www.w3.org/2001/SMIL20/Language">http://www.w3.org/2001/SMIL20/Language</A>"></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <head></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <layout type="text/smil-basic-layout"></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <root-layout skip-content="true" width="auto" height="auto" /></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <region id="region1_1" top="0" left="0" height="100%" width="100%" skip-content="true" right="auto" showBackground="always" soundLevel="100%" bottom="auto" /></FONT></P>
<P><FONT SIZE=2 FACE="Arial"> </layout></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </head></FONT>
<BR><FONT SIZE=2 FACE="Arial"> <body syncBehavior="default" restartDefault="inherit" fillDefault="inherit" max="indefinite" fill="default" restart="default" syncBehaviorDefault="inherit" min="0" syncToleranceDefault="inherit" syncTolerance="default"></FONT></P>
<P><FONT SIZE=2 FACE="Arial"> <seq min="0" restart="default" syncTolerance="default" restartDefault="inherit" max="indefinite" fill="default" syncToleranceDefault="inherit" syncBehavior="default" syncBehaviorDefault="inherit" fillDefault="inherit"></FONT></P>
<P><FONT SIZE=2 FACE="Arial"> <par dur="5000ms" min="0" endsync="last" restart="default" syncTolerance="default" restartDefault="inherit" max="indefinite" fill="default" syncToleranceDefault="inherit" syncBehavior="default" syncBehaviorDefault="inherit" fillDefault="inherit"></FONT></P>
<P><FONT SIZE=2 FACE="Arial"> <text src="slide3.txt" region="region1_1" min="0" endsync="media" restart="default" right="auto" syncTolerance="default" mediaRepeat="preserve" restartDefault="inherit" max="indefinite" erase="whenDone" fill="default" syncToleranceDefault="inherit" syncBehavior="default" top="auto" left="auto" syncBehaviorDefault="inherit" height="auto" bottom="auto" width="auto" fillDefault="inherit" /></FONT></P>
<P><FONT SIZE=2 FACE="Arial"> </par></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </seq></FONT>
<BR><FONT SIZE=2 FACE="Arial"> </body></FONT>
<BR><FONT SIZE=2 FACE="Arial"></smil></FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">This is fine (in fact, they are actually equivalent documents), except that I am sending this data to mobile phones (this is a simple smil for an MMS message) and would prefer to omit the attributes with default values (or at least attributes with default values that were omitted from the original document). Is there any way to do this with a custom SAXHandler or something? I don't need validation, but I do need to stop swelling the document with attributes that are implied by the DTD, and can be filled in by the end device. Any suggestions would be appreciated.</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Harry Evans</FONT>
</P>
</BODY>
</HTML>