Well, I do have all object create in an XML Producer class but I have probably 120 objects that can be produced as XML.  Also another option that I was look at was returning null for the DocumentFactory.createText and then in the AbstractElement class in the addText(String) method checking for null returned from the DocumentFactory. If the node isn't null then it would at it to the tree otherwise it would do nothing.  This way there is no consumption of memory and no logical testing for null needed anywhere else on Text nodes.  Does this sound a little better?

Thanks
-daniel

Alessandro Vernet wrote:

Daniel Hopper wrote:

I have numerous places where I produce objects to xml and many times certain properties may be null.  This causes a problem because I don't want to have to test for null every time I am dumping a property.


Allowing null values could break some code that assumes that the text value of a text node is never null. It also looks to me like creating text nodes with a null text does not add useful information; that just consumes memory. If you are trying to avoid the duplication of code that only creates Text node is a value is not null, would it possible to put that code in a helper method, or similar?

Alex


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev





Alessandro Vernet wrote:
Daniel Hopper wrote:

I have numerous places where I produce objects to xml and many times certain properties may be null.  This causes a problem because I don't want to have to test for null every time I am dumping a property.

Allowing null values could break some code that assumes that the text value of a text node is never null. It also looks to me like creating text nodes with a null text does not add useful information; that just consumes memory. If you are trying to avoid the duplication of code that only creates Text node is a value is not null, would it possible to put that code in a helper method, or similar?

Alex


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-dev


Reply via email to