<!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 5.5.2655.35">
<TITLE>RE: [jdom-interest] Toward beta 9</TITLE>
</HEAD>
<BODY>
<P><FONT SIZE=2>Figured I would have a go...</FONT>
</P>
<P><FONT SIZE=2>Best scheme I could think of was to Add a new JDOM Factory.</FONT>
</P>
<P><FONT SIZE=2>I have not tested it, but the following code/philosophy should work.</FONT>
</P>
<P><FONT SIZE=2>Benefits: Once object (Attribute/element/etc) is created, changes to the data will be verified.</FONT>
<BR><FONT SIZE=2> NO IMPACT ON EXISTING CODE.</FONT>
<BR><FONT SIZE=2>Drawbacks: Once object (Attribute/element/etc) is created, changes to the data will be verified.</FONT>
</P>
<P><FONT SIZE=2>Basic principal: Current scheme is to build the JDOM representation using a JDOMFactory. This is implemented by the DefaultJDOMfactory. This factory creates "standard/Verified" Elements, Attributes, etc. I create an alternate factory, the "LaxJDOMFactory" which creates LaxElements, LaxAttributes, etc. LaxElement extends Element, overriding ONLY THE CONSTRUCTOR, so that Verification does not happen ONLY ON CONSTRUCTION.</FONT></P>
<P><FONT SIZE=2>Any Cloning, manipulation, detaching, etc will be done on the base class.</FONT>
</P>
<P><FONT SIZE=2>To use the Lax mechanism, you would have to:</FONT>
</P>
<P><FONT SIZE=2>SAXBuilder builder = new SAXBuilder();</FONT>
<BR><FONT SIZE=2>builder.setFactory(new LaxJDOMFactory());</FONT>
<BR><FONT SIZE=2>builder.build(.....).</FONT>
</P>
<P><FONT SIZE=2>Thus, attached are:</FONT>
<BR><FONT SIZE=2>org.jdom.inpu.lax.LaxJDOMFactory</FONT>
<BR><FONT SIZE=2>org.jdom.inpu.lax.LaxText</FONT>
<BR><FONT SIZE=2>org.jdom.inpu.lax.LaxElement</FONT>
<BR><FONT SIZE=2>org.jdom.inpu.lax.LaxAttribute</FONT>
<BR><FONT SIZE=2>org.jdom.inpu.lax.LaxCDATA</FONT>
<BR><FONT SIZE=2>org.jdom.inpu.lax.LaxComment</FONT>
<BR><FONT SIZE=2>org.jdom.inpu.lax.LaxEntityRef</FONT>
</P>
<BR>
<P><FONT SIZE=2>Rolf</FONT>
</P>
<BR>
<P><FONT SIZE=2>-----Original Message-----</FONT>
<BR><FONT SIZE=2>From: Rolf Lear [<A HREF="mailto:rlear@algorithmics.com">mailto:rlear@algorithmics.com</A>]</FONT>
<BR><FONT SIZE=2>Sent: Wednesday, April 09, 2003 2:40 PM</FONT>
<BR><FONT SIZE=2>To: jdom-interest</FONT>
<BR><FONT SIZE=2>Subject: RE: [jdom-interest] Toward beta 9</FONT>
</P>
<BR>
<P><FONT SIZE=2>Please hack it then, and post the patch for analysis ... ;-) (preferably with performance deltas). </FONT>
<BR><FONT SIZE=2>Rolf </FONT>
<BR><FONT SIZE=2>-----Original Message----- </FONT>
<BR><FONT SIZE=2>From: Steve Conover [<A HREF="mailto:sgcjr@yahoo.com">mailto:sgcjr@yahoo.com</A>] </FONT>
<BR><FONT SIZE=2>Sent: Wednesday, April 09, 2003 2:36 PM </FONT>
<BR><FONT SIZE=2>To: jdom-interest </FONT>
<BR><FONT SIZE=2>Subject: Re: [jdom-interest] Toward beta 9 </FONT>
</P>
<BR>
<P><FONT SIZE=2>> My proposed solution was to make the verifier a separate, optional </FONT>
<BR><FONT SIZE=2>> step. When the user creates a document in-memory (as opposed to </FONT>
<BR><FONT SIZE=2>> parsing </FONT>
<BR><FONT SIZE=2>> a file), then should run the verifier on it when they're done. Many </FONT>
<BR><FONT SIZE=2>> people won't do this, and that's their prerogative, but at some point </FONT>
<BR><FONT SIZE=2>> down the line some XML parser will find the error when their document </FONT>
<BR><FONT SIZE=2>> gets parsed, so it's not the end of the world. (That's why the parser </FONT>
<BR><FONT SIZE=2>> is </FONT>
<BR><FONT SIZE=2>> required to be so strict, IMO - so the generator doesn't have to be.) </FONT>
<BR><FONT SIZE=2>Just to add a user's opinion - I'm in complete agreement with Alex. </FONT>
<BR><FONT SIZE=2>The code I'm writing is 100% unit tested and the verifier step is just </FONT>
<BR><FONT SIZE=2>wasted cpu cycles. If JDOM is delivered like this I for one will just </FONT>
<BR><FONT SIZE=2>hack it and make it verification-optional. </FONT>
<BR><FONT SIZE=2>Regards, </FONT>
<BR><FONT SIZE=2>Steve </FONT>
<BR><FONT SIZE=2>_______________________________________________ </FONT>
<BR><FONT SIZE=2>To control your jdom-interest membership: </FONT>
<BR><FONT SIZE=2><A HREF="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com" TARGET="_blank">http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com</A> </FONT>
</P>
<P><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT><FONT FACE="Arial" SIZE=2 COLOR="#000000"></FONT>
</BODY>
</HTML>