<!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.&nbsp; 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.&nbsp; 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">&lt;!DOCTYPE smil PUBLIC &quot;-//W3C//DTD SMIL 2.0//EN&quot; &quot;<A HREF="http://www.w3.org/2001/SMIL20/SMIL20.dtd">http://www.w3.org/2001/SMIL20/SMIL20.dtd</A>&quot;&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&lt;smil xmlns=&quot;<A HREF="http://www.w3.org/2001/SMIL20/Language">http://www.w3.org/2001/SMIL20/Language</A>&quot;&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp; &lt;head&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp; &lt;layout&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;root-layout/&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;region id=&quot;region1_1&quot; top=&quot;0&quot; left=&quot;0&quot; height=&quot;100%&quot; width=&quot;100%&quot;/&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp; &lt;/layout&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp; &lt;/head&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp; &lt;body&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp; &lt;seq&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;par dur=&quot;5000ms&quot;&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;text src=&quot;slide3.txt&quot; region=&quot;region1_1&quot; /&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/par&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp; &lt;/seq&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp; &lt;/body&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&lt;/smil&gt;</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">after SAXBuilder parsing (new SAXBuilder(false)) it becomes:</FONT>
</P>

<P><FONT SIZE=2 FACE="Arial">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&lt;!DOCTYPE smil PUBLIC &quot;-//W3C//DTD SMIL 2.0//EN&quot; &quot;<A HREF="http://www.w3.org/2001/SMIL20/SMIL20.dtd">http://www.w3.org/2001/SMIL20/SMIL20.dtd</A>&quot;&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&lt;smil xmlns=&quot;<A HREF="http://www.w3.org/2001/SMIL20/Language">http://www.w3.org/2001/SMIL20/Language</A>&quot;&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; &lt;head&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; &lt;layout type=&quot;text/smil-basic-layout&quot;&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;root-layout skip-content=&quot;true&quot; width=&quot;auto&quot; height=&quot;auto&quot; /&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;region id=&quot;region1_1&quot; top=&quot;0&quot; left=&quot;0&quot; height=&quot;100%&quot; width=&quot;100%&quot; skip-content=&quot;true&quot; right=&quot;auto&quot; showBackground=&quot;always&quot; soundLevel=&quot;100%&quot; bottom=&quot;auto&quot; /&gt;</FONT></P>

<P><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; &lt;/layout&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; &lt;/head&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; &lt;body syncBehavior=&quot;default&quot; restartDefault=&quot;inherit&quot; fillDefault=&quot;inherit&quot; max=&quot;indefinite&quot; fill=&quot;default&quot; restart=&quot;default&quot; syncBehaviorDefault=&quot;inherit&quot; min=&quot;0&quot; syncToleranceDefault=&quot;inherit&quot; syncTolerance=&quot;default&quot;&gt;</FONT></P>

<P><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; &lt;seq min=&quot;0&quot; restart=&quot;default&quot; syncTolerance=&quot;default&quot; restartDefault=&quot;inherit&quot; max=&quot;indefinite&quot; fill=&quot;default&quot; syncToleranceDefault=&quot;inherit&quot; syncBehavior=&quot;default&quot; syncBehaviorDefault=&quot;inherit&quot; fillDefault=&quot;inherit&quot;&gt;</FONT></P>

<P><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;par dur=&quot;5000ms&quot; min=&quot;0&quot; endsync=&quot;last&quot; restart=&quot;default&quot; syncTolerance=&quot;default&quot; restartDefault=&quot;inherit&quot; max=&quot;indefinite&quot; fill=&quot;default&quot; syncToleranceDefault=&quot;inherit&quot; syncBehavior=&quot;default&quot; syncBehaviorDefault=&quot;inherit&quot; fillDefault=&quot;inherit&quot;&gt;</FONT></P>

<P><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;text src=&quot;slide3.txt&quot; region=&quot;region1_1&quot; min=&quot;0&quot; endsync=&quot;media&quot; restart=&quot;default&quot; right=&quot;auto&quot; syncTolerance=&quot;default&quot; mediaRepeat=&quot;preserve&quot; restartDefault=&quot;inherit&quot; max=&quot;indefinite&quot; erase=&quot;whenDone&quot; fill=&quot;default&quot; syncToleranceDefault=&quot;inherit&quot; syncBehavior=&quot;default&quot; top=&quot;auto&quot; left=&quot;auto&quot; syncBehaviorDefault=&quot;inherit&quot; height=&quot;auto&quot; bottom=&quot;auto&quot; width=&quot;auto&quot; fillDefault=&quot;inherit&quot; /&gt;</FONT></P>

<P><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/par&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp;&nbsp;&nbsp; &lt;/seq&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&nbsp; &lt;/body&gt;</FONT>

<BR><FONT SIZE=2 FACE="Arial">&lt;/smil&gt;</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).&nbsp; Is there any way to do this with a custom SAXHandler or something?&nbsp; 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.&nbsp; Any suggestions would be appreciated.</FONT></P>

<P><FONT SIZE=2 FACE="Arial">Harry Evans</FONT>
</P>

</BODY>
</HTML>