No subject
Fri Aug 6 17:04:17 PDT 2004
allows 'parentless' implementations. On the other hand, you will have to
roll your own Node and Element implementations.
/pmn
-----Original Message-----
From: Martin Schulz [HYPERLINK
"mailto:schulz at videotron.ca"mailto:schulz at videotron.ca]
Sent: Monday, November 11, 2002 2:45 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] Reusable JDOM Elements
Hi,
in a potentially busy server environment, I preconstruct and cache
potentially many JDOM subtrees. Comes usage time, the subtree gets
cloned and attached to a real Document, which is subsequently output to
XML and sent out.
It appears wasteful to have to clone the Elements, even if they are not
going to be changed, for the sole reason that they maintain a reference
to their parent. It seems also to be slightly convoluted to manage
recycling of such subtrees.
Is there a good pattern or solution out there (JDOM or closely related)
which allows me to build Document trees, which are only top-to-bottom
connected or which allows to reuse the constant subtree(s) easily?
Thanks!
Martin
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (HYPERLINK "http://www.grisoft.com"
\nhttp://www.grisoft.com).
Version: 6.0.385 / Virus Database: 217 - Release Date: 04/09/2002
_______________________________________________
To control your jdom-interest membership: HYPERLINK
"http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yo
urhos"
\nhttp://lists.denveronline.net/mailman/options/jdom-interest/youraddr@y
ourhos
t.com
###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft
Exchange. For more information, connect to HYPERLINK
"http://www.F-Secure.com/" \nhttp://www.F-Secure.com/
_______________________________________________
To control your jdom-interest membership: HYPERLINK
"http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yo
urhost.com"
\nhttp://lists.denveronline.net/mailman/options/jdom-interest/youraddr@y
ourhost.com
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.385 / Virus Database: 217 - Release Date: 04/09/2002
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.385 / Virus Database: 217 - Release Date: 04/09/2002
--Boundary_(ID_y5ygoOexKqtM+S2yBwoLng)
Content-type: text/html; charset=Windows-1252
Content-transfer-encoding: 7BIT
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=Windows-1252">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002>Henry,</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>could
you elaborate just a little?</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>A
straight forward reference counting implementation would be intrusive, wouldn't
it?</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>Then
we would still have the problem that an element (or any other 'node') can just
have one parent...</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>Am I
correct in assuming that you used an external reference holder, which was
then used to identify and detach the recyclable
pieces?</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>Now
for me that would only be half of the solution, as I would have to provide
either a pooling solution for multiple</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>copies
of these pieces, or implement a synchronization point for resource
access.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=870072701-12112002>Also
was there a performance gain obtained in your solution?</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002>Thanks!</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002></SPAN></FONT> </DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN
class=870072701-12112002> Martin</SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B>
jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org] <B>On
Behalf Of </B>Henry Charlton<BR><B>Sent:</B> November 11, 2002 3:02
PM<BR><B>To:</B> jdom-interest at jdom.org<BR><B>Subject:</B> RE: [jdom-interest]
Reusable JDOM Elements<BR><BR></FONT></DIV>
<P><FONT size=2>In the past, I have successfully combined JDOM Elements with
reference counting. </FONT></P>
<P><FONT size=2>Once the xml file was generated, I would traverse the document
from the root element, making detach() calls.</FONT> </P><BR>
<P><FONT size=2>--Henry</FONT> </P><BR><BR>
<P><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From:
Norrman Per [<A
href="mailto:per.norrman at canovia.se">mailto:per.norrman at canovia.se</A>]
</FONT><BR><FONT size=2>Sent: Monday, November 11, 2002 4:25 AM</FONT>
<BR><FONT size=2>To: 'Martin Schulz'; jdom-interest at jdom.org</FONT> <BR><FONT
size=2>Subject: RE: [jdom-interest] Reusable JDOM Elements</FONT> </P><BR>
<P><FONT size=2>Hi,</FONT> </P>
<P><FONT size=2>From a quick glance, it appears that dom4j (<A
href="http://www.dom4j.org" target=_blank>http://www.dom4j.org</A>)
</FONT><BR><FONT size=2>allows 'parentless' implementations. On the other
hand, you will have to roll your own Node and Element
implementations.</FONT></P><BR>
<P><FONT size=2>/pmn</FONT> </P>
<P><FONT size=2>-----Original Message-----</FONT> <BR><FONT size=2>From:
Martin Schulz [<A
href="mailto:schulz at videotron.ca">mailto:schulz at videotron.ca</A>]
</FONT><BR><FONT size=2>Sent: Monday, November 11, 2002 2:45 AM</FONT>
<BR><FONT size=2>To: jdom-interest at jdom.org</FONT> <BR><FONT size=2>Subject:
[jdom-interest] Reusable JDOM Elements</FONT> </P><BR>
<P><FONT size=2>Hi,</FONT> </P>
<P><FONT size=2>in a potentially busy server environment, I preconstruct and
cache potentially many JDOM subtrees. Comes usage time, the subtree gets
cloned and attached to a real Document, which is subsequently output to XML
and sent out.</FONT></P>
<P><FONT size=2>It appears wasteful to have to clone the Elements, even if
they are not going to be changed, for the sole reason that they maintain a
reference to their parent. It seems also to be slightly convoluted to
manage recycling of such subtrees.</FONT></P>
<P><FONT size=2>Is there a good pattern or solution out there (JDOM or closely
related) which allows me to build Document trees, which are only top-to-bottom
connected or which allows to reuse the constant subtree(s) easily?</FONT></P>
<P><FONT size=2>Thanks!</FONT> </P>
<P> <FONT size=2>Martin</FONT>
</P><BR>
<P><FONT size=2>---</FONT> <BR><FONT size=2>Outgoing mail is certified Virus
Free.</FONT> <BR><FONT size=2>Checked by AVG anti-virus system (<A
href="http://www.grisoft.com"
target=_blank>http://www.grisoft.com</A>).</FONT> <BR><FONT size=2>Version:
6.0.385 / Virus Database: 217 - Release Date: 04/09/2002</FONT> <BR><FONT
size=2> </FONT> </P>
<P><FONT size=2>_______________________________________________</FONT>
<BR><FONT size=2>To control your jdom-interest membership: <A
href="http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos"
target=_blank>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos</A></FONT>
<BR><FONT size=2>t.com</FONT> <BR><FONT
size=2>###########################################</FONT> </P>
<P><FONT size=2>This message has been scanned by F-Secure Anti-Virus for
Microsoft Exchange. For more information, connect to <A
href="http://www.F-Secure.com/" target=_blank>http://www.F-Secure.com/</A>
_______________________________________________</FONT></P>
<P><FONT size=2>To control your jdom-interest membership: <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><BR>
<P><FONT size=2>---<BR>Incoming mail is certified Virus Free.<BR>Checked by
AVG anti-virus system (http://www.grisoft.com).<BR>Version: 6.0.385 / Virus
Database: 217 - Release Date:
04/09/2002<BR></FONT></P></BLOCKQUOTE></BODY></HTML>
<BR>
<P><FONT SIZE=2>---<BR>
Outgoing mail is certified Virus Free.<BR>
Checked by AVG anti-virus system (http://www.grisoft.com).<BR>
Version: 6.0.385 / Virus Database: 217 - Release Date: 04/09/2002<BR>
</FONT> </P>
--Boundary_(ID_y5ygoOexKqtM+S2yBwoLng)--
More information about the jdom-interest
mailing list