To make use of the very flexible factory architecture (and caching),
you should not create element, attribute, etc.. objects directly but
use the create and add methods instead.

Regards,
Edwin

On Wed, 22 Dec 2004 19:42:08 -0700, David Thielen <[EMAIL PROTECTED]> wrote:
> 
> 
> Hi;
> 
> Are you saying we should code as below? Or not code as below and do it a
> different way?
> 
> Thanks - dave
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Edwin Dankert
> Sent: Monday, December 20, 2004 4:14 AM
> To: dom4j-user@lists.sourceforge.net
> Subject: Re: [dom4j-user] Two suggested improvements for dom4j
> 
> Just to make sure that nobody tries to implement the previous code.
> 
> The previous code created objects directly which bypasses the dom4j
> factory and caching mechanisms. Instead of doing it that way, make
> sure to always use a 'factory' method to create objects:
> 
> <code>*
> 
> Document doc = DocumentHelper.createDocument();
> 
> Element data = doc.addElement( "Data");
> Element font = doc.addElement( "Font");
> font.addText( DocumentFactory.createText( "hi there"));
> data.addText( DocumentFactory.createText( "    "));
> data.add( font);
> data.addText( DocumentFactory.createText( "    "));
> 
> </code>
> 
> Code not tested.
> 
> Regards,
> Edwin
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> dom4j-user mailing list
> dom4j-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://productguide.itmanagersjournal.com/
> _______________________________________________
> dom4j-user mailing list
> dom4j-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
> 
>


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to