[From nobody Fri Aug 6 17:05:25 2004 Delivered-To: jhunter@collab.net Return-Path: jdom-commits-admin@dorothy.denveronline.net Received: (qmail 86041 invoked from network); 16 Dec 2000 04:38:53 -0000 Received: from mail.acm.org (199.222.69.4) by laswell.collab.net with SMTP; 16 Dec 2000 04:38:53 -0000 Received: from dorothy.denveronline.net (dorothy.denveronline.net [206.168.141.2]) by mail.acm.org (8.9.3/8.9.3) with ESMTP id XAA148140 for <jhunter@acm.org>; Fri, 15 Dec 2000 23:38:50 -0500 Received: from dorothy.denveronline.net (localhost [127.0.0.1]) by dorothy.denveronline.net (8.9.3/8.9.3) with ESMTP id VAA02897; Fri, 15 Dec 2000 21:38:07 -0700 (MST) Received: from nmemonix.com (www.nmemonix.com [195.74.128.200]) by dorothy.denveronline.net (8.9.3/8.9.3) with SMTP id VAA02686 for <jdom-commits@jdom.org>; Fri, 15 Dec 2000 21:30:21 -0700 (MST) From: jhunter@cvs.jdom.org Received: (qmail 4148 invoked by uid 514); 16 Dec 2000 04:04:44 -0000 Message-ID: <20001216040443.4147.qmail@nmemonix.com> To: jdom-commits@jdom.org Subject: [jdom-commits] CVS update: jdom/src/java/org/jdom Sender: jdom-commits-admin@dorothy.denveronline.net Errors-To: jdom-commits-admin@dorothy.denveronline.net X-BeenThere: jdom-commits@lists.denveronline.net X-Mailman-Version: 2.0 Precedence: bulk List-Help: <mailto:jdom-commits-request@lists.denveronline.net?subject=help> List-Post: <mailto:jdom-commits@lists.denveronline.net> List-Subscribe: <http://lists.denveronline.net/mailman/listinfo/jdom-commits>, <mailto:jdom-commits-request@lists.denveronline.net?subject=subscribe> List-Id: JDOM Mailing List for CVS Commits <jdom-commits.lists.denveronline.net> List-Unsubscribe: <http://lists.denveronline.net/mailman/listinfo/jdom-commits>, <mailto:jdom-commits-request@lists.denveronline.net?subject=unsubscribe> List-Archive: <http://lists.denveronline.net/lists/jdom-commits/> Date: 16 Dec 2000 04:04:43 -0000 X-Mozilla-Status2: 00000000 Date: Saturday December 16, 2000 @ 4:04 Author: jhunter Update of /home/cvspublic/jdom/src/java/org/jdom In directory www.nmemonix.com:/tmp/cvs-serv3455 Modified Files: Attribute.java CDATA.java Comment.java Document.java Element.java Entity.java IllegalAddException.java ProcessingInstruction.java Verifier.java Log Message: Big change... Added parentage for Attribute, Comment, Element, Entity, and PI! They all now have getParent() methods. All but Attribute have getDocument() methods also (perhaps Attribute should have it too?). The addContent() and addAttribute() methods now check parentage and don't allow an item to be added if it's already held by another. This may break existing programs that use the same item in multiple places in the tree. That's really a good thing tho because we now avoid the weird side effects where an item can exist in multiple places and changing one item value can accidentally change multiple item values. Testing shows no noticeable speed loss. A couple extra gets and sets on each add aren't significant compared to the other work being performed. (OptimizeIt is a great tool.) We are eating extra bytes to hold parentage for Attribute, Comment, Entity, and PI, but we can make sure it's only one variable pointer by using the same object for the containing (Element or Document) object (an optimization for later). Note the PartialList impl does *not* yet check parentage. I left it alone because it's on the slate to be rewritten soon. The rewrite will do the checking. FWIW, I did try a test using a ThreadLocal variable set in SAXBuilder to say "don't bother with sanity checking parentage or XML names" (mostly to save the time doing XML name checking cuz parentage is so fast it doesn't even show up in the OptimizeIt list). But turns out it took more time to access the ThreadLocal variable than to sanity check! Parentage checking is essentially free, and XML name checking is still relatively cheap. Another thing, I removed the deprecated add methods leftover from beta5. With this new model I didn't want to mix the old model. And I removed CDATA.setText(). I wasn't sure about adding parentage to CDATA sections (seems weird since we don't have it for String). And so if we don't manage parentage it should be immutable, lest people get strange bugs with changing one item changing many. I tried various approaches with a Node interface, but XML is so damn quirky that it's hard for Node to be useful. For example, I want to use Node to say this.getParent().removeContent(this) to remove an element and have it work if the "parent" was either an elt or doc. But the sad news is that a document can't have a removeContent(Element) because a doc must always have exactly one root to be well-formed. So then Node really shouldn't have a removeContent(Element) either, and that really limits its generic usefulness. Gotta think more about this. -jh- =================================================================== File: Attribute.java Status: Up-to-date Working revision: 1.18 Sat Dec 16 04:04:37 2000 Repository revision: 1.18 /home/cvspublic/jdom/src/java/org/jdom/Attribute.java,v Existing Tags: start (revision: 1.1.1.1) jdom (branch: 1.1.1) =================================================================== File: CDATA.java Status: Up-to-date Working revision: 1.4 Sat Dec 16 04:04:37 2000 Repository revision: 1.4 /home/cvspublic/jdom/src/java/org/jdom/CDATA.java,v Existing Tags: No Tags Exist =================================================================== File: Comment.java Status: Up-to-date Working revision: 1.10 Sat Dec 16 04:04:38 2000 Repository revision: 1.10 /home/cvspublic/jdom/src/java/org/jdom/Comment.java,v Existing Tags: start (revision: 1.1.1.1) jdom (branch: 1.1.1) =================================================================== File: Document.java Status: Up-to-date Working revision: 1.25 Sat Dec 16 04:04:38 2000 Repository revision: 1.25 /home/cvspublic/jdom/src/java/org/jdom/Document.java,v Existing Tags: start (revision: 1.1.1.1) jdom (branch: 1.1.1) =================================================================== File: Element.java Status: Up-to-date Working revision: 1.49 Sat Dec 16 04:04:39 2000 Repository revision: 1.49 /home/cvspublic/jdom/src/java/org/jdom/Element.java,v Existing Tags: start (revision: 1.1.1.1) jdom (branch: 1.1.1) =================================================================== File: Entity.java Status: Up-to-date Working revision: 1.8 Sat Dec 16 04:04:40 2000 Repository revision: 1.8 /home/cvspublic/jdom/src/java/org/jdom/Entity.java,v Existing Tags: start (revision: 1.1.1.1) jdom (branch: 1.1.1) =================================================================== File: IllegalAddException.java Status: Up-to-date Working revision: 1.7 Sat Dec 16 04:04:40 2000 Repository revision: 1.7 /home/cvspublic/jdom/src/java/org/jdom/IllegalAddException.java,v Existing Tags: start (revision: 1.1.1.1) jdom (branch: 1.1.1) =================================================================== File: ProcessingInstruction.java Status: Up-to-date Working revision: 1.8 Sat Dec 16 04:04:40 2000 Repository revision: 1.8 /home/cvspublic/jdom/src/java/org/jdom/ProcessingInstruction.java,v Existing Tags: start (revision: 1.1.1.1) jdom (branch: 1.1.1) =================================================================== File: Verifier.java Status: Up-to-date Working revision: 1.15 Sat Dec 16 04:04:41 2000 Repository revision: 1.15 /home/cvspublic/jdom/src/java/org/jdom/Verifier.java,v Existing Tags: start (revision: 1.1.1.1) jdom (branch: 1.1.1) _______________________________________________ To control your jdom-commits membership: http://lists.denveronline.net/mailman/options/jdom-commits/youraddr@yourhost.com ]