[From nobody Fri Aug 6 17:08:11 2004 Return-Path: <jdom-interest-admin@jdom.org> Received: from dorothy.denveronline.net ([66.37.141.4]) by tyner.mail.mindspring.net (Earthlink Mail Service) with ESMTP id 18gIfQ3n3Nl3rs0 for <servlets@mindspring.com>; Tue, 26 Nov 2002 11:08:06 -0500 (EST) Received: from dorothy.denveronline.net (localhost [127.0.0.1]) by dorothy.denveronline.net (Postfix) with ESMTP id 2777A5692; Tue, 26 Nov 2002 09:08:02 -0700 (MST) Delivered-To: jdom-interest-admin@pop.firstlink.com Received: from blueyonder.co.uk (pcow035o.blueyonder.co.uk [195.188.53.121]) by dorothy.denveronline.net (Postfix) with ESMTP id 34DC05692 for <jdom-interest-admin@jdom.org>; Tue, 26 Nov 2002 09:05:28 -0700 (MST) Received: from pcow035o.blueyonder.co.uk ([127.0.0.1]) by blueyonder.co.uk with Microsoft SMTPSVC(5.5.1877.757.75); Tue, 26 Nov 2002 16:04:57 +0000 Received: from den (unverified [80.192.16.72]) by pcow035o.blueyonder.co.uk (Content Technologies SMTPRS 4.2.9) with SMTP id <T5ecd3eebceac1785ed0cf@pcow035o.blueyonder.co.uk> for <jdom-interest-admin@jdom.org>; Tue, 26 Nov 2002 14:52:58 +0000 Message-ID: <001a01c2955b$c7f5c310$4810c050@den> Reply-To: "Phill Perryman" <phill@mizzymead.com> From: "Phill Perryman" <phillip.perryman@blueyonder.co.uk> To: <jdom-interest-admin@jdom.org> Subject: Question Date: Tue, 26 Nov 2002 14:32:29 -0000 Organization: Mizzymead Farm MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0011_01C29558.A5E4A140" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Sender: jdom-interest-owner@jdom.org Errors-To: jdom-interest-owner@jdom.org X-BeenThere: jdom-interest@jdom.org X-Mailman-Version: 2.0.1 Precedence: bulk List-Help: <mailto:jdom-interest-request@jdom.org?subject=help> List-Post: <mailto:jdom-interest@jdom.org> List-Subscribe: <http://lists.denveronline.net/mailman/listinfo/jdom-interest>, <mailto:jdom-interest-request@jdom.org?subject=subscribe> List-Id: JDOM Mailing List for General Issues and Updates <jdom-interest.jdom.org> List-Unsubscribe: <http://lists.denveronline.net/mailman/listinfo/jdom-interest>, <mailto:jdom-interest-request@jdom.org?subject=unsubscribe> List-Archive: <http://lists.denveronline.net/pipermail/jdom-interest/> X-Mozilla-Status2: 00000000 This is a multi-part message in MIME format. ------=_NextPart_000_0011_01C29558.A5E4A140 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Firstly I am new to JDOM (and java come to that). First pass my thanks = onto the authors as JDOM has vastly simplified coding my application as = I started before I found JDOM (in the Java and XML book). I am using JDOM as my internal data model and external storage method = for a Java Application so I can avoid serialisation as the app is = frequently updated.. I have two questions, I have tried searching the = archives with no luck. One of the things I would like to do is easily display xml data in a = tree so I tried to extend Element and Implement MutableTreeNode but run = into a problem with getParent(). Is there a way around this or do I have = to do as I am currently doing create a TreeNode for each JDOM Element = and essentially copy the hierarchy. Secondly I am using Elements/Attributes as a way of holding data = internally so many of my classes extend Element and use the JDOMfactory = to build them, but I would like to Cache some the data for performance = reasons. When I manually create an Element I known when I have finished = but I cannot find a "finishedParsing" type call on an Element or = Document. Is there a way to know when JDOM has finished parsing a = Document and Element. I currently have code like the following which can get called many times = for instance on my Part class (extends Element) double getPrice() { Attribute a =3D getAttribute("list"); if (a !=3D null) { return Double.parseDouble(a.getValue()); } else { return 0.0; } } If there was a notification that this element had finished being parsed = then I could move the above code into the finished parsing method and = replace the code with double getPrice() { return cachedPrice; } ------=_NextPart_000_0011_01C29558.A5E4A140 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 6.00.2719.2200" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2> <DIV><FONT face=3DArial size=3D2>Firstly I am new to JDOM (and java come = to that).=20 First pass my thanks onto the authors as JDOM has vastly simplified = coding my=20 application as I started before I found JDOM (in the Java and XML=20 book).</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV> <DIV><FONT face=3DArial size=3D2>I am using JDOM as my internal data = model and=20 external storage method for a Java Application so I can avoid = serialisation as=20 the app is frequently updated.. I have two questions, I have tried = searching the=20 archives with no luck.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV> <DIV><FONT face=3DArial size=3D2>One of the things I would like to do is = easily=20 display xml data in a tree so I tried to extend Element and Implement=20 MutableTreeNode but run into a problem with getParent(). Is there a way = around=20 this or do I have to do as I am currently doing create a TreeNode for = each JDOM=20 Element and essentially copy the hierarchy.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV> <DIV><FONT face=3DArial size=3D2>Secondly I am using Elements/Attributes = as a way of=20 holding data internally so many of my classes extend Element and use the = JDOMfactory to build them, but I would like to Cache some the data for=20 performance reasons. When I manually create an Element I known when I = have=20 finished but I cannot find a "finishedParsing" type call on an Element = or=20 Document. Is there a way to know when JDOM has finished parsing a = Document and=20 Element.</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=3DArial size=3D2>I currently have code like the = following which can=20 get called many times for instance on my Part class (extends=20 Element)</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV> <DIV><FONT face=3DArial size=3D2>double getPrice() {</FONT></DIV> <DIV><FONT face=3DArial size=3D2>&nbsp; Attribute a =3D=20 getAttribute("list");</FONT></DIV> <DIV><FONT face=3DArial size=3D2>&nbsp; if (a !=3D null) {</FONT></DIV> <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; return=20 Double.parseDouble(a.getValue());</FONT></DIV> <DIV><FONT face=3DArial size=3D2>&nbsp; } else {</FONT></DIV> <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; return = 0.0;</FONT></DIV> <DIV><FONT face=3DArial size=3D2>&nbsp; }</FONT></DIV> <DIV><FONT face=3DArial size=3D2>}</FONT></DIV> <DIV>&nbsp;</DIV> <DIV><FONT face=3DArial size=3D2>If there was a notification that this = element had=20 finished being parsed then I could move the above code into the finished = parsing&nbsp;method and replace the code with</FONT></DIV> <DIV><FONT face=3DArial size=3D2>double getPrice() {</FONT></DIV> <DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; return = cachedPrice;</FONT></DIV> <DIV><FONT face=3DArial = size=3D2>}</FONT></DIV></FONT></DIV></BODY></HTML> ------=_NextPart_000_0011_01C29558.A5E4A140-- ]