From jean-guillaume.battaglia at inexware.fr Fri Mar 1 07:25:01 2002 From: jean-guillaume.battaglia at inexware.fr (jean-guillaume.battaglia@inexware.fr) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Jdom DTD validation error state Message-ID: An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020301/3d19188d/attachment.htm From jhunter at apache.org Sat Mar 2 00:30:24 2002 From: jhunter at apache.org (Jason Hunter) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] insertBefore : again References: Message-ID: <3C808DA0.E1740809@apache.org> > Example when I've got : > > > > > > > I would like to have : > > > click here > > > Use the List API. It's noted in the FAQ. elt1.getContent().add(0, ahrefelt); -jh- P.S. Please don't use HTML mail to post to this list. Not everyone can read it, so you'll get fewer replies than if you post plain text. From noamt at yahoo.com Sat Mar 2 04:13:36 2002 From: noamt at yahoo.com (Noam Tamim) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Re: [jdom-commits] CVS update: jdom/src/java/org/jdom/input In-Reply-To: <20020302133154.0AD471D801D@jools.org> Message-ID: <20020302121336.15089.qmail@web13908.mail.yahoo.com> --- cvs@jools.org wrote: > Changed some string comparators from != to !.equals(). The former works > so long as the parser interns strings, and although Xerces and Crimson do, > not all parsers do. So using !.equals() is safer. Brad Huffman ran some > tests to see if this had much of a performance impact, and surprisingly > it didn't and in fact sometimes ran *faster*. Below is his table, for > future reference. Of-course it doesn't have much of a performance impact. Look at the first three lines of String.equals() : if (this == anObject) { return true; } So, asking if (str1.equals(str2)) is just like asking if (str1==str2 || str1.equals(str2)) ===== Noam. __________________________________________________ Do You Yahoo!? Yahoo! Sports - sign up for Fantasy Baseball http://sports.yahoo.com From rajesh.pandia at matrixone.com Sat Mar 2 13:05:14 2002 From: rajesh.pandia at matrixone.com (Pandia, Rajesh) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Removing from an XML doc ? ? Message-ID: <9150DCE0CCB4D411A7DB00508BB0DBF20156E48B@msx1am.matrixone.net> Hi: I need to remove this first line "" generated from a document like: COV_VPW GM_GPS GPS LISTRFQ How do I do that using JDOM ? I have generated this using JDOM. Thanks in Advance for your immediate help. From jhunter at acm.org Sat Mar 2 15:54:18 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Re: [jdom-commits] CVS update: jdom/src/java/org/jdom/input References: <20020302121336.15089.qmail@web13908.mail.yahoo.com> Message-ID: <3C81662A.F937D253@acm.org> > --- cvs@jools.org wrote: > > Changed some string comparators from != to !.equals(). The former works > > so long as the parser interns strings, and although Xerces and Crimson do, > > not all parsers do. So using !.equals() is safer. Brad Huffman ran some > > tests to see if this had much of a performance impact, and surprisingly > > it didn't and in fact sometimes ran *faster*. Below is his table, for > > future reference. > > Of-course it doesn't have much of a performance impact. Look at > the first three lines of String.equals() : > > if (this == anObject) { > return true; > } > > So, asking > if (str1.equals(str2)) > is just like asking > if (str1==str2 || str1.equals(str2)) Yes, in the rare event of an exact reference match it's fast. But that doesn't happen often. So your != gets to go right to false while the .equals() has to start looking at characters. Luckily most strings appear to differ on their initial chars and char indexing isn't too slow. -jh- From jhunter at acm.org Sat Mar 2 15:55:37 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Removing from an XML doc ?? References: <9150DCE0CCB4D411A7DB00508BB0DBF20156E48B@msx1am.matrixone.net> Message-ID: <3C816679.516EC6A4@acm.org> You need to omit the declaration on output. Conveniently, that's what outputter.setOmitDeclaration() does. -jh- "Pandia, Rajesh" wrote: > > Hi: > > I need to remove this first line > > "" > > generated from a document like: > > > > > COV_VPW > > > GM_GPS > > GPS > LISTRFQ > deliveryReceiptRequ > ested="Unsigned" /> > > > How do I do that using JDOM ? I have generated this using JDOM. > > Thanks in Advance for your immediate help. > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From jdom at jasm.org Sun Mar 3 10:12:39 2002 From: jdom at jasm.org (Michel Gutierrez) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Removing from an XML doc ? ? In-Reply-To: <9150DCE0CCB4D411A7DB00508BB0DBF20156E48B@msx1am.matrixone.net> References: <9150DCE0CCB4D411A7DB00508BB0DBF20156E48B@msx1am.matrixone.net> Message-ID: <0203031912390A.05548@mew.home> I presume if you use the output method on the document's root element instead of the document itelf, that should do it. On Saturday 02 March 2002 22:05, Pandia, Rajesh wrote: > Hi: > > I need to remove this first line > > "" > > generated from a document like: > > > > > COV_VPW > > > GM_GPS > > GPS > LISTRFQ > deliveryReceiptRequ > ested="Unsigned" /> > > > How do I do that using JDOM ? I have generated this using JDOM. > > Thanks in Advance for your immediate help. > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho >st.com From MDoraisamy at SELECTICA.com Sun Mar 3 22:43:36 2002 From: MDoraisamy at SELECTICA.com (Mani Doraisamy) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] JDOM and XSLT Message-ID: Again i am stuck with this! Now i need to say that i need to get only one child with 2 level of nesting and other children removed from an element to do XSLT. My XSLT has become very slow. Has anyone tried something like a view on the JDOM structure which will get a part of the structure for XSLT, so as to increase performance? mani -----Original Message----- From: Mani Doraisamy Sent: Thursday, February 28, 2002 1:07 AM To: Laurent Bihanic Cc: jdom-interest@jdom.org Subject: RE: [jdom-interest] JDOM and XSLT thanks. the problem in applying a stylesheet to the sub tree is that, i might not need the child elements as well. it would be too much of overhead to loop through the content and detach the child elements. Also it should be able to specify till what level i need nested children for XSLT. I am thinking of creating a dummy Element which gets the actual node and the number of the neting i need, in the contructor and recursively loop till the number of nesting. i am not sure if this would create a problem though. mani -----Original Message----- From: Laurent Bihanic [ mailto:laurent.bihanic@atosorigin.com ] Sent: Wednesday, February 27, 2002 8:11 PM To: Mani Doraisamy Cc: jdom-interest@jdom.org Subject: Re: [jdom-interest] JDOM and XSLT Hi, Mani Doraisamy wrote: > Hi all, > What is the fastest XSLT processor available in market. I am > using JDOM and I would like to do XSLT so that I can present > it as HTML. Saxon ( http://saxon.sourceforge.net ) can be up to 3 times faster than Xalan, depending on your stylesheet, and is very stable. > Another question, > my JDOM structure is huge and the Elements in the structure > actually gets the value from performance intensive calculations > and database operations, by overriding getText() method. Now > when i want to do XSLT i wouldnt want the entire tree for XSLT. > Although i can pass the whole tree for XSLT, what is the most > performant way of doing XSLT for the subtree? XSLT processes an entire document. So the only way to apply a stylesheet to only a part of a document is to detach that part and make it a standalone document. You can then apply the stylesheet to this "small" document and attach the result back to the original document. Hope this helps, Laurent -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020304/64f3be0a/attachment.htm From jhunter at acm.org Sun Mar 3 23:25:52 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Removing from an XML doc ? ? References: <9150DCE0CCB4D411A7DB00508BB0DBF20156E48B@msx1am.matrixone.net> <0203031912390A.05548@mew.home> Message-ID: <3C832180.A76A9A47@acm.org> But then you would miss out on any content outside the root element, like PIs or comments. That's why you need the special method. -jh- Michel Gutierrez wrote: > > I presume if you use the output method on the document's root element instead > of the document itelf, that should do it. > > On Saturday 02 March 2002 22:05, Pandia, Rajesh wrote: > > Hi: > > > > I need to remove this first line > > > > "" > > > > generated from a document like: > > > > > > > > > > COV_VPW > > > > > > GM_GPS > > > > GPS > > LISTRFQ > > > deliveryReceiptRequ > > ested="Unsigned" /> > > > > > > How do I do that using JDOM ? I have generated this using JDOM. > > > > Thanks in Advance for your immediate help. > > > > _______________________________________________ > > To control your jdom-interest membership: > > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho > >st.com > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From Noam.BOROVOY at oami.eu.int Mon Mar 4 03:37:50 2002 From: Noam.BOROVOY at oami.eu.int (BOROVOY Noam) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Split document output Message-ID: I'm a JDOM newbie, and have run into the following problem: At times I need to generate very large XML documents (100's of megs) - therefore making creating the full document tree in memory not practical - what I would like is to be able to output the document's opening tags, then generate and output a large number of elements one by one, and then output the closing tags of the document. As is this does not seem possible with JDOM - so I need to "hard code" the opening and closing portions of the document and root element. Any ideas welcome... Thanks, Noam From camille at odaiko.com Mon Mar 4 04:24:06 2002 From: camille at odaiko.com (Camille Troillard) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Split document output In-Reply-To: Message-ID: Hello, I think you need to use something less "high-level" than JDOM. You should take a look at SAX compliant parsers (please correct me if I am wrong or not precise enough.) SAX is an XML parser specification based on event sending, that is why you can handle very big files with SAX. On the other hand, DOM "needs" to load the whole model into memory which is best for small documents. Camille On Monday, March 4, 2002, at 12:37 PM, BOROVOY Noam wrote: > I'm a JDOM newbie, and have run into the following problem: > At times I need to generate very large XML documents (100's of megs) - > therefore making creating the full document tree in memory not > practical - > what I would like is to be able to output the document's opening tags, > then > generate and output a large number of elements one by one, and then > output > the closing tags of the document. > As is this does not seem possible with JDOM - so I need to "hard code" > the > opening and closing portions of the document and root element. > > Any ideas welcome... > > Thanks, > Noam > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom- > interest/youraddr@yourhost.com > From Noam.BOROVOY at oami.eu.int Mon Mar 4 05:12:34 2002 From: Noam.BOROVOY at oami.eu.int (BOROVOY Noam) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Split document output Message-ID: This isn't for parsing the document it's for writing it - outputting XML doesn't seem complex - until you start working with schemas and namespaces... JDOM is great for handling the namespaces and also encoding the content and escaping XML entities. ---------- From: Camille Troillard [SMTP:camille@odaiko.com] Sent: 04 March 2002 13:24 To: BOROVOY Noam Cc: 'jdom-interest@jdom.org' Subject: Re: [jdom-interest] Split document output Hello, I think you need to use something less "high-level" than JDOM. You should take a look at SAX compliant parsers (please correct me if I am wrong or not precise enough.) SAX is an XML parser specification based on event sending, that is why you can handle very big files with SAX. On the other hand, DOM "needs" to load the whole model into memory which is best for small documents. Camille On Monday, March 4, 2002, at 12:37 PM, BOROVOY Noam wrote: > I'm a JDOM newbie, and have run into the following problem: > At times I need to generate very large XML documents (100's of megs) - > therefore making creating the full document tree in memory not > practical - > what I would like is to be able to output the document's opening tags, > then > generate and output a large number of elements one by one, and then > output > the closing tags of the document. > As is this does not seem possible with JDOM - so I need to "hard code" > the > opening and closing portions of the document and root element. > > Any ideas welcome... > > Thanks, > Noam > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom- > interest/youraddr@yourhost.com > From jdom at frontloader.net Mon Mar 4 10:43:59 2002 From: jdom at frontloader.net (craig r) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] XML variables Message-ID: Hi, I'm using JDOM to access an XML document I have created. In this XML document I have would like to create a variable for a string I use throughout the document rather than type it each time. The effect I would like to achieve is the same as that which is used in ANT build.xml files where the xml element "property" has a name and a value. Thereafter the property is referred as "${name}". How is this acheived and can are there any "shortcuts" to doing so using JDOM? XML does not provide for a way to create variables like this does it? Or is it entirely up to the code that interprets the XML to flag such "property" elements and create the variables? Thanks for any pointers, Craig R. From Boerries.Ludwig at t-systems.com Mon Mar 4 10:55:42 2002 From: Boerries.Ludwig at t-systems.com (=?iso-8859-1?Q?B=F6rries_Ludwig?=) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] IllegalAccessError In-Reply-To: <3C7E6FE7.80908@sosnoski.com> Message-ID: Hi, I wanted to change the XMLOutputter so that
is outputted as
. I subclassed XMLOutputter and I changed printElement(Element element, Writer out, int indentLevel, NamespaceStack namespaces). I also had to copy a lot of unnecessary methods, because they where private to the superclass XMLOutputter Everything worked fine in VisualAge. When I deployed my code to Tomcat, I got the exception below. What's wrong ? Help is very welcome. Boerries --------------------- if (empty) { if (!expandEmptyElements) { if (qualifiedName.equalsIgnoreCase("BR")) out.write(">"); else out.write(" />"); } else { out.write(">"); } } java.lang.IllegalAccessError: try to access class org.jdom.output.XMLOutputter$NamespaceStack from class com.debis.xml.HTMLOutputter at com.debis.xml.HTMLOutputter.printElement(HTMLOutputter.java:1015) at com.debis.xml.HTMLOutputter.output(HTMLOutputter.java:458) at com.debis.xml.HTMLOutputter.output(HTMLOutputter.java:426) at com.debis.servlet.ServletManager.service(ServletManager.java:173) at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java :446) at org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:201) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 66) From jhunter at acm.org Mon Mar 4 12:31:32 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] IllegalAccessError References: Message-ID: <3C83D9A4.39C6FA1B@acm.org> If you look at XMLOutputter you'll see a little trick regarding how NamespaceStack is made accessible. Seems like Tomcat's funky class loader strategy may cause this problems. You're going to need a classloader superguru to identify the cause. Meanwhile, be careful: if you output
instead of
you're no longer writing XML. -jh- B?rries Ludwig wrote: > > Hi, > > I wanted to change the XMLOutputter so that
is outputted as
. I > subclassed XMLOutputter and I changed printElement(Element element, Writer > out, int indentLevel, NamespaceStack namespaces). I also had to copy a lot > of unnecessary methods, because they where private to the superclass > XMLOutputter > > Everything worked fine in VisualAge. When I deployed my code to Tomcat, I > got the exception below. What's wrong ? > > Help is very welcome. > > Boerries > > --------------------- > > if (empty) { > if (!expandEmptyElements) { > if (qualifiedName.equalsIgnoreCase("BR")) > out.write(">"); > else > out.write(" />"); > } > else { > out.write("> out.write(qualifiedName); > out.write(">"); > } > } > > java.lang.IllegalAccessError: try to access class > org.jdom.output.XMLOutputter$NamespaceStack from class > com.debis.xml.HTMLOutputter > at com.debis.xml.HTMLOutputter.printElement(HTMLOutputter.java:1015) > at com.debis.xml.HTMLOutputter.output(HTMLOutputter.java:458) > at com.debis.xml.HTMLOutputter.output(HTMLOutputter.java:426) > at com.debis.servlet.ServletManager.service(ServletManager.java:173) > at > org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java > :446) > at > org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:180) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application > FilterChain.java:247) > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh > ain.java:193) > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja > va:243) > at > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 > 66) > at > org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) > at > org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja > va:201) > at > org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5 > 66) > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From ben at kopic.org Mon Mar 4 14:50:53 2002 From: ben at kopic.org (Benjamin Kopic) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] XML variables In-Reply-To: Message-ID: Why not use Entity References? As far as I know &name; is same as ${name} You can declare entities in DocType object. The only difference is that you can declare property anywhere you wish in a buildfile and with proper XML you can only declare them in the DOOCTYPE section. > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of craig r > Sent: 04 March 2002 18:44 > To: jdom-interest@jdom.org > Subject: [jdom-interest] XML variables > > > > Hi, I'm using JDOM to access an XML document I have created. In > this XML document I have would like to create a variable for a string > I use throughout the document rather than type it each time. The > effect I would like to achieve is the same as that which is used > in ANT build.xml files where the xml element "property" has a name > and a value. Thereafter the property is referred as "${name}". > How is this acheived and can are there any "shortcuts" to doing so > using JDOM? XML does not provide for a way to create variables like > this does it? Or is it entirely up to the code that interprets the > XML to flag such "property" elements and create the variables? > > Thanks for any pointers, > > Craig R. > > > > > > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yourad dr@yourhost.com From ben at kopic.org Mon Mar 4 14:50:55 2002 From: ben at kopic.org (Benjamin Kopic) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Split document output In-Reply-To: Message-ID: I am about to something similar so I am quite intrigued by this issue. How deep is your XML tree? If it is relatively flat, you may want to look into SAXOutputer. Otherwise, try subclassing XMLOutputer and output once text once you reach a leaf node. I presume you are constructing a Document object in memory from scratch? Do you have to have Document in memory? Best regards Ben > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of BOROVOY Noam > Sent: 04 March 2002 13:13 > To: 'Camille Troillard' > Cc: 'jdom-interest@jdom.org' > Subject: RE: [jdom-interest] Split document output > > > > This isn't for parsing the document it's for writing it - outputting XML > doesn't seem complex - until you start working with schemas and > namespaces... JDOM is great for handling the namespaces and also encoding > the content and escaping XML entities. > > ---------- > From: Camille Troillard [SMTP:camille@odaiko.com] > Sent: 04 March 2002 13:24 > To: BOROVOY Noam > Cc: 'jdom-interest@jdom.org' > Subject: Re: [jdom-interest] Split document output > > Hello, > > I think you need to use something less "high-level" than JDOM. > You should take a look at SAX compliant parsers (please correct me > if I > am wrong or not precise enough.) > > SAX is an XML parser specification based on event sending, that is > why > you can handle very big files with SAX. On the other hand, DOM > "needs" > to load the whole model into memory which is best for small > documents. > > Camille > > > On Monday, March 4, 2002, at 12:37 PM, BOROVOY Noam wrote: > > > I'm a JDOM newbie, and have run into the following problem: > > At times I need to generate very large XML documents (100's of > megs) - > > therefore making creating the full document tree in memory not > > practical - > > what I would like is to be able to output the document's opening > tags, > > then > > generate and output a large number of elements one by one, and > then > > output > > the closing tags of the document. > > As is this does not seem possible with JDOM - so I need to "hard > code" > > the > > opening and closing portions of the document and root element. > > > > Any ideas welcome... > > > > Thanks, > > Noam > > > > _______________________________________________ > > To control your jdom-interest membership: > > http://lists.denveronline.net/mailman/options/jdom- > > interest/youraddr@yourhost.com > > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yourad dr@yourhost.com From yuri.dewit at metaserver.com Mon Mar 4 15:59:23 2002 From: yuri.dewit at metaserver.com (Yuri de Wit) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] JDOM Beta 8 Message-ID: Any ideas on when is JDOM Beta 8 planned to be cut? Thanks, Yuri -------------- next part -------------- A non-text attachment was scrubbed... Name: Yuri de Wit.vcf Type: application/octet-stream Size: 379 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020304/569e78bc/YurideWit.obj From collinp at telus.net Mon Mar 4 20:43:37 2002 From: collinp at telus.net (Collin Peters) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] retrieving an element based on an attribute Message-ID: <20020305044337.GA2347@proximity> Newbie question: Is there any way to retrieve an element based on an attribute beside looping though the possible elements and looking for the attribute? For example, in the following text from the javaworld.com documentation: 21 34 55 89 144 233 377 610 987 1597 Is there a one line piece of code to get the fibonacci number at index 12? The only other way I see to do it is to get the children where the element name is fibonacci and then loop through looking for the attribute where index=12 Collin Peters From bob at werken.com Mon Mar 4 20:50:07 2002 From: bob at werken.com (bob mcwhirter) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] retrieving an element based on an attribute In-Reply-To: <20020305044337.GA2347@proximity> Message-ID: When in doubt, XPath (http://jaxen.org/) XPath xpath = new XPath( "/thingies/fibonacci[@index='12']" ); xpath.selectSingleNode( myDoc ); -bob On Mon, 4 Mar 2002, Collin Peters wrote: > Newbie question: > > Is there any way to retrieve an element based on an attribute beside looping > though the possible elements and looking for the attribute? > > For example, in the following text from the javaworld.com documentation: > > 21 > 34 > 55 > 89 > 144 > 233 > 377 > 610 > 987 > 1597 > > Is there a one line piece of code to get the fibonacci number at index 12? > The only other way I see to do it is to get the children where the element > name is fibonacci and then loop through looking for the attribute where > index=12 > > Collin Peters > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com > From laurent.bihanic at atosorigin.com Tue Mar 5 04:38:10 2002 From: laurent.bihanic at atosorigin.com (Laurent Bihanic) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] XML variables References: Message-ID: <3C84BC32.9090706@atosorigin.com> Hi, DTDs provide a mecanism that may suit you: ID and IDREF attributes. An ID is an attribute of an element that is used to uniquely identify this element throughout the XML document. IDREFs can then be used to convey the value of one or several ID attributes, hence allowing one element to reference other elements. Please note that this mecanism only supports referencing elements but not strings (attribute values, text...). Of course for JDOM to be aware of ID and IDREF attributes, you need to attach a DTD to you documents. Once this done, the org.jdom.contrib.ids.IdFactory can help you to create documents supporting the method getElementById(String). Laurent craig r wrote: > Hi, I'm using JDOM to access an XML document I have created. In > this XML document I have would like to create a variable for a string > I use throughout the document rather than type it each time. The > effect I would like to achieve is the same as that which is used > in ANT build.xml files where the xml element "property" has a name > and a value. Thereafter the property is referred as "${name}". > How is this acheived and can are there any "shortcuts" to doing so > using JDOM? XML does not provide for a way to create variables like > this does it? Or is it entirely up to the code that interprets the > XML to flag such "property" elements and create the variables? > > Thanks for any pointers, > > Craig R. From ddlucas at lse.com Tue Mar 5 04:55:39 2002 From: ddlucas at lse.com (David D. Lucas) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Stack & Threads Message-ID: <3C84C04B.5020501@lse.com> I noticed in several classes JDOM uses Stack which is JDK 1.1 type that extends Vector. Seeing that no one is recommending use of JDOM between threads, is this a potential synchronization hotspot with the constant locking and unlocking when using the stack? Is there a way to migrate over to JDK 1.2 collections and use the ArrayList instead? Also, I noticed some thread access checking code in ContentList and wondered if it works or should even be there, again based on the comments that we should not be using JDOM between threads concurrently. Thoughts? Thanks, Dave -- +------------------------------------------------------------+ | David Lucas mailto:ddlucas@lse.com | | Lucas Software Engineering, Inc. (740) 964-6248 Voice | | Unix,Java,C++,CORBA,XML,EJB (614) 668-4020 Mobile | | Middleware,Frameworks (888) 866-4728 Fax/Msg | +------------------------------------------------------------+ | GPS Location: 40.0150 deg Lat, -82.6378 deg Long | | IMHC: "Jesus Christ is the way, the truth, and the life." | | IMHC: "I know where I am; I know where I'm going." <>< | +------------------------------------------------------------+ Notes: PGP Key Block=http://www.lse.com/~ddlucas/pgpblock.txt IMHO="in my humble opinion" IMHC="in my humble conviction" All trademarks above are those of their respective owners. From karpov at sigma.ispras.ru Tue Mar 5 06:20:46 2002 From: karpov at sigma.ispras.ru (Eugene Karpov) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] SAXHandler bug Message-ID: <200203051416.g25EG9K05868@gate.ispras.ru> JDom crashed when using it with Oracle parser: java.lang.StringIndexOutOfBoundsException: String index out of range: 0 at java.lang.String.charAt(String.java:516) at org.jdom.input.SAXHandler.getAttributeType(SAXHandler.java:1050) at org.jdom.input.SAXHandler.startElement(SAXHandler.java:612) at oracle.xml.parser.v2.DefaultXMLDocumentHandler.startElement(DefaultXMLDocumentHandler.java:118) at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1093) at oracle.xml.parser.v2.ValidatingParser.parseRootElement(ValidatingParser.java:133) at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:235) at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:140) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:354) at org.jdom.input.SAXBuilder.build(SAXBuilder.java:707) Any idea? -- B.R. Eugene From Q.M.Qasim at Bradford.ac.uk Tue Mar 5 08:34:12 2002 From: Q.M.Qasim at Bradford.ac.uk (Qasim) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Removing an element Message-ID: Hi I am trying to remove an element from my xml file. the structure of my xml file is as follws: I search the xml file with a username and url and if my search matches a username and url, I want to delete that element. For instance if the username is 'qasim' and url is '143.53.31.174', I would like to delete the whole user element. I have written the follwing code, but it does not work. can some one help: public void removeElement(String username,String location) { Element root =document.getRootElement(); List users = root.getChildren("user"); Iterator i=users.iterator(); while (i.hasNext()) { Element user= (Element)i.next(); int count=0; String u=user.getAttributeValue("username"); String l=user.getAttributeValue("url"); int q = username.compareTo(u); int r= location.compareTo(l); if ((q==0) || (r==0)) { root.removeChild("user"); count++; } if (count==-1) { System.out.println("none deleted "); } } // increment number of description tag found /// end of loop// } --------------------------------- Qasim Q.M.Qasim@bradford.ac.uk From jhunter at acm.org Tue Mar 5 10:25:44 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] Stack & Threads References: <3C84C04B.5020501@lse.com> Message-ID: <3C850DA8.76E03202@acm.org> "David D. Lucas" wrote: > > I noticed in several classes JDOM uses Stack which is JDK 1.1 type that > extends Vector. Seeing that no one is recommending use of JDOM between > threads, is this a potential synchronization hotspot with the constant > locking and unlocking when using the stack? Good point on the synchronization! The only place I see Stack still used is in SAXHandler to manage the SAX state. Do you see it elsewhere? NamespaceStack is our own creation. If you want to change SAXHandler to use an ArrayList instead of a Stack and look for any build time improvement, that would be very useful. > Is there a way to migrate over to JDK 1.2 collections and use the > ArrayList instead? Sure, we're using Java 2 collections everywhere else. > Also, I noticed some thread access checking code in ContentList and > wondered if it works or should even be there, again based on the > comments that we should not be using JDOM between threads concurrently. The concurrent modification checking follows the collections model with "fail fast" behavior -- actions aren't synchronized, but you do get an exception if the data you're relying on has been altered by another thread. -jh- From jhunter at acm.org Tue Mar 5 10:27:01 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:26 2004 Subject: [jdom-interest] SAXHandler bug References: <200203051416.g25EG9K05868@gate.ispras.ru> Message-ID: <3C850DF5.C8910D5E@acm.org> I can tell from the trace that's not the latest jdom code. Please try with that, and if it still fails send in the stack trace along with a program demonstrating the error if possible. -jh- Eugene Karpov wrote: > > JDom crashed when using it with Oracle parser: > > java.lang.StringIndexOutOfBoundsException: String index out of range: 0 > at java.lang.String.charAt(String.java:516) > at org.jdom.input.SAXHandler.getAttributeType(SAXHandler.java:1050) > at org.jdom.input.SAXHandler.startElement(SAXHandler.java:612) > at oracle.xml.parser.v2.DefaultXMLDocumentHandler.startElement(DefaultXMLDocumentHandler.java:118) > at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1093) > at oracle.xml.parser.v2.ValidatingParser.parseRootElement(ValidatingParser.java:133) > at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:235) > at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:140) > at org.jdom.input.SAXBuilder.build(SAXBuilder.java:354) > at org.jdom.input.SAXBuilder.build(SAXBuilder.java:707) > > Any idea? > -- > B.R. > Eugene > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From arosen at silverstream.com Tue Mar 5 10:40:15 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Stack & Threads In-Reply-To: <3C850DA8.76E03202@acm.org> Message-ID: <004101c1c475$31a46680$6a65810a@silverstream.com> > The concurrent modification checking follows the collections model with > "fail fast" behavior -- actions aren't synchronized, but you do get an > exception if the data you're relying on has been altered by another > thread. ... or in the same thread, but not via the iterator. The concurrent-modification-checking code is only in the iterator, so that we'll fail-fast if someone changes the underlying list out from under us. Alex From James.Cook at jobpartners.com Tue Mar 5 10:48:36 2002 From: James.Cook at jobpartners.com (James Cook) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Removing an element Message-ID: <7B5FE861D6DDD51191FB001083FC3DA9077C08@haverbrook.jhq> Your line: root.removeChild("user"); will always remove the first child name "user" You need to modify the live List, maintain a count (i) of where you are in the iterator, then replace the line above with: users.remove(i); Be warned though this will only work for the first instance that you find, once you have removed it, you should break, else the iterator will not represent the list. If you have to keep going, build a vector of those that should be removed and then remove them in a loop afterwards. Regards James -----Original Message----- From: Qasim [mailto:Q.M.Qasim@Bradford.ac.uk] Sent: 05 March 2002 16:34 To: jdom-interest@jdom.org Subject: [jdom-interest] Removing an element Hi I am trying to remove an element from my xml file. the structure of my xml file is as follws: I search the xml file with a username and url and if my search matches a username and url, I want to delete that element. For instance if the username is 'qasim' and url is '143.53.31.174', I would like to delete the whole user element. I have written the follwing code, but it does not work. can some one help: public void removeElement(String username,String location) { Element root =document.getRootElement(); List users = root.getChildren("user"); Iterator i=users.iterator(); while (i.hasNext()) { Element user= (Element)i.next(); int count=0; String u=user.getAttributeValue("username"); String l=user.getAttributeValue("url"); int q = username.compareTo(u); int r= location.compareTo(l); if ((q==0) || (r==0)) { root.removeChild("user"); count++; } if (count==-1) { System.out.println("none deleted "); } } // increment number of description tag found /// end of loop// } --------------------------------- Qasim Q.M.Qasim@bradford.ac.uk _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com This e-mail and any attachments are confidential and may also be privileged. If you are not the named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose, or store or copy the information in any medium. Any views or opinions presented are solely those of the author and do not necessarily represent those of Jobpartners. Jobpartners is unable to guarantee the security (especially that of attached files) of any email content outside of our own computer systems. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020305/6a02e5af/attachment.htm From bob at werken.com Tue Mar 5 11:29:24 2002 From: bob at werken.com (bob mcwhirter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Removing an element In-Reply-To: <7B5FE861D6DDD51191FB001083FC3DA9077C08@haverbrook.jhq> Message-ID: Or better yet, use the ListIterator(), and call remove() upon it, and you can keep trucking, removing/inserting as you please through-out the iteration. -bob On Tue, 5 Mar 2002, James Cook wrote: > Your line: > root.removeChild("user"); > will always remove the first child name "user" > > You need to modify the live List, maintain a count (i) of where you are in > the iterator, then replace the line above with: > users.remove(i); > > Be warned though this will only work for the first instance that you find, > once you have removed it, you should break, else the iterator will not > represent the list. If you have to keep going, build a vector of those that > should be removed and then remove them in a loop afterwards. > > Regards > James > > -----Original Message----- > From: Qasim [mailto:Q.M.Qasim@Bradford.ac.uk] > Sent: 05 March 2002 16:34 > To: jdom-interest@jdom.org > Subject: [jdom-interest] Removing an element > > > Hi > I am trying to remove an element from my xml file. the structure of my > xml file is as follws: > > > > > > > > I search the xml file with a username and url and if my search matches > a username and url, I want to delete that element. For instance if the > username is 'qasim' and url is '143.53.31.174', I would like to delete > the whole user element. > > I have written the follwing code, but it does not work. can some one > help: > > public void removeElement(String username,String location) > { > Element root =document.getRootElement(); > > List users = root.getChildren("user"); > Iterator i=users.iterator(); > while (i.hasNext()) > { > Element user= (Element)i.next(); > int count=0; > > String u=user.getAttributeValue("username"); > String l=user.getAttributeValue("url"); > > int q = username.compareTo(u); > int r= location.compareTo(l); > if ((q==0) || (r==0)) > { > root.removeChild("user"); > count++; > } > if (count==-1) > { > System.out.println("none deleted "); > } > } > // increment number of description tag found > /// end of loop// > > } > --------------------------------- > Qasim > Q.M.Qasim@bradford.ac.uk > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos > t.com > > > This e-mail and any attachments are confidential and may also be privileged. > If you are not the named recipient, please notify the sender immediately and > do not disclose the contents to another person, use it for any purpose, or > store or copy the information in any medium. Any views or opinions presented > are solely those of the author and do not necessarily represent those of > Jobpartners. Jobpartners is unable to guarantee the security (especially > that of attached files) of any email content outside of our own computer > systems. > From jozart at csi.com Tue Mar 5 23:42:38 2002 From: jozart at csi.com (Joseph Bowbeer) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Re: Stack & Threads References: <200203060704.AAA19536@dorothy.denveronline.net> Message-ID: <030601c1c4e2$7d626d20$0a0a0a0a@REPLICANT> Clarification: Despite its name, ConcurrentModificationException is only guaranteed to fail-fast if modifications are made in the same thread. Modifications made in a separate thread may not be visible to the thread in question until both threads synchronize on the same object. (A bit of a catch-22.) --- original message --- From: "Alex Rosen" Subject: RE: [jdom-interest] Stack & Threads Date: Tue, 5 Mar 2002 13:40:15 -0500 Jason Hunter writes: > The concurrent modification checking follows the collections model with > "fail fast" behavior -- actions aren't synchronized, but you do get an > exception if the data you're relying on has been altered by another > thread. ... or in the same thread, but not via the iterator. The concurrent-modification-checking code is only in the iterator, so that we'll fail-fast if someone changes the underlying list out from under us. Alex From Q.M.Qasim at Bradford.ac.uk Wed Mar 6 05:10:45 2002 From: Q.M.Qasim at Bradford.ac.uk (Qasim) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Removing an element In-Reply-To: <7B5FE861D6DDD51191FB001083FC3DA9077C08@haverbrook.jhq> Message-ID: Thanks for your response. Actually my initial code was correct ( it could delete the 'user' tag). However, I was forgetting to save the XML file after the manipulation. the working code is: public void removeElement(String username,String location) { Element root =document.getRootElement(); List users = root.getChildren("user"); Iterator i=users.iterator(); while (i.hasNext()) { Element user= (Element)i.next(); int count=0; String us=user.getName(); String u=user.getAttributeValue("username"); String l=user.getAttributeValue("url"); int q = username.compareTo(u); int r= location.compareTo(l); if ((q==0) || (r==0)) { root.removeContent(user); System.out.println("removed "+ us); count++; } if (count==-1) { System.out.println("none deleted "); } } try { XMLOutputter outputter = new XMLOutputter(" ", true); //output to a file FileWriter writer = new FileWriter("users.xml"); outputter.output(document, writer); writer.close(); } catch(java.io.IOException e) { System.err.println("Problem with writing to file " ); e.printStackTrace(); } } Thanks Qasim r 2002 18:48:36 -0000 James Cook wrote: > Your line: > root.removeChild("user"); > will always remove the first child name "user" > > You need to modify the live List, maintain a count (i) of where you are in > the iterator, then replace the line above with: > users.remove(i); > > Be warned though this will only work for the first instance that you find, > once you have removed it, you should break, else the iterator will not > represent the list. If you have to keep going, build a vector of those that > should be removed and then remove them in a loop afterwards. > > Regards > James > > -----Original Message----- > From: Qasim [mailto:Q.M.Qasim@Bradford.ac.uk] > Sent: 05 March 2002 16:34 > To: jdom-interest@jdom.org > Subject: [jdom-interest] Removing an element > > > Hi > I am trying to remove an element from my xml file. the structure of my > xml file is as follws: > > > > > > > > I search the xml file with a username and url and if my search matches > a username and url, I want to delete that element. For instance if the > username is 'qasim' and url is '143.53.31.174', I would like to delete > the whole user element. > > I have written the follwing code, but it does not work. can some one > help: > > public void removeElement(String username,String location) > { > Element root =document.getRootElement(); > > List users = root.getChildren("user"); > Iterator i=users.iterator(); > while (i.hasNext()) > { > Element user= (Element)i.next(); > int count=0; > > String u=user.getAttributeValue("username"); > String l=user.getAttributeValue("url"); > > int q = username.compareTo(u); > int r= location.compareTo(l); > if ((q==0) || (r==0)) > { > root.removeChild("user"); > count++; > } > if (count==-1) > { > System.out.println("none deleted "); > } > } > // increment number of description tag found > /// end of loop// > > } > --------------------------------- > Qasim > Q.M.Qasim@bradford.ac.uk > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos > t.com > > > This e-mail and any attachments are confidential and may also be privileged. > If you are not the named recipient, please notify the sender immediately and > do not disclose the contents to another person, use it for any purpose, or > store or copy the information in any medium. Any views or opinions presented > are solely those of the author and do not necessarily represent those of > Jobpartners. Jobpartners is unable to guarantee the security (especially > that of attached files) of any email content outside of our own computer > systems. --------------------------------- Qasim Q.M.Qasim@bradford.ac.uk From jhunter at servlets.com Wed Mar 6 10:43:25 2002 From: jhunter at servlets.com (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [Fwd: [jdom-interest] SAXHandler bug] Message-ID: <3C86634D.C596338@servlets.com> The exception is in this code: private int getAttributeType(String typeName) { Integer type = (Integer)(attrNameToTypeMap.get(typeName)); if (type == null) { if (typeName.charAt(0) == '(') { <-- It works for Xerces and Crimson, but Oracle's parser appears to be passing in a zero-length typeName. Seems like to work around Oracle we should code up: private int getAttributeType(String typeName) { Integer type = (Integer)(attrNameToTypeMap.get(typeName)); if (type == null) { if (typeName != null && typeName.length() > 0 && typeName.charAt(0) == '(') { Comments from anyone really familiar with this? Laurent? -jh- -------------- next part -------------- An embedded message was scrubbed... From: Eugene Karpov Subject: Re: [jdom-interest] SAXHandler bug Date: Wed, 6 Mar 2002 15:34:12 +0300 Size: 4027 Url: http://jdom.org/pipermail/jdom-interest/attachments/20020306/430823cb/attachment.eml From kenneth.lee at hongkong.com Wed Mar 6 11:19:56 2002 From: kenneth.lee at hongkong.com (Kenneth Lee) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Custom adapter? Message-ID: <000b01c1c543$e6d27f00$0779dacb@kenneth> Hi all, What should I do if I want to have access to the underlying parser object? Will a custom adapter fit for this purpose, and if so, what's the correct way to implement it? Thanks, Kenneth Lee PS. Pls CC a copy as I'm on the digest. Thx. From jhunter at servlets.com Wed Mar 6 14:14:29 2002 From: jhunter at servlets.com (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Custom adapter? References: <000b01c1c543$e6d27f00$0779dacb@kenneth> Message-ID: <3C8694C5.2A5BA86D@servlets.com> If you're doing SAX builds, you can call setFeature and setProperty on the builder. If you need more control, it's not available. Adapters are used for DOM builds only to get around the DOM problem of no standard starter interface, and probably not what you need to be worrying about. -jh- Kenneth Lee wrote: > > Hi all, > > What should I do if I want to have access to the underlying parser object? > Will a custom adapter fit for this purpose, and if so, what's the correct > way to implement it? > > Thanks, > Kenneth Lee > > PS. Pls CC a copy as I'm on the digest. Thx. > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From arosen at silverstream.com Wed Mar 6 14:48:18 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Custom adapter? In-Reply-To: <3C8694C5.2A5BA86D@servlets.com> Message-ID: <002201c1c561$035c1330$6a65810a@silverstream.com> Of course, you can always subclass SAXBuilder and override a method like configureParser, and have your way with the parser. Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Jason Hunter > Sent: Wednesday, March 06, 2002 5:14 PM > To: Kenneth Lee > Cc: jdom-interest@jdom.org > Subject: Re: [jdom-interest] Custom adapter? > > > If you're doing SAX builds, you can call setFeature and setProperty on > the builder. If you need more control, it's not available. Adapters > are used for DOM builds only to get around the DOM problem of no > standard starter interface, and probably not what you need to be > worrying about. > > -jh- > > Kenneth Lee wrote: > > > > Hi all, > > > > What should I do if I want to have access to the underlying > parser object? > > Will a custom adapter fit for this purpose, and if so, > what's the correct > > way to implement it? > > > > Thanks, > > Kenneth Lee > > > > PS. Pls CC a copy as I'm on the digest. Thx. > > > > _______________________________________________ > > To control your jdom-interest membership: > > > http://lists.denveronline.net/mailman/options/jdom-interest/yo uraddr@yourhost.com _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com From elharo at metalab.unc.edu Wed Mar 6 18:48:03 2002 From: elharo at metalab.unc.edu (Elliotte Rusty Harold) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Nightly drops In-Reply-To: <3C86634D.C596338@servlets.com> References: <3C86634D.C596338@servlets.com> Message-ID: There don't appear to be any nightly drops of the source tree on cvs.jdom.org anymore. I've finally got CVS more or less consistently working on my main machine, but Iw as hoping to grab a quick copy of the latest source on my laptop for a conference and couldn't do that. Any chance this can be fixed? Or can somebody point me to where the tar files are hiding? -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ From paul at morrow.net Wed Mar 6 22:27:36 2002 From: paul at morrow.net (Paul Morrow) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] jdom b7 does not appear to work with the 1.4.0 j2se Message-ID: <003201c1c5a1$2cc6b0f0$2801a8c0@amd1600> Has anyone had any luck running the jdom b7 examples with the 1.4.0 j2se? I get the following error, even after rebuilding the jdom.jar: Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at PC=0x6D35DDFE Function=JVM_DisableCompiler+0x874C Library=i:\J2SDK_~1\JDK14~1.0\jre\bin\client\jvm.dll Current Java thread: at java.lang.Throwable.fillInStackTrace(Native Method) - locked <02B9AC18> (a java.lang.AbstractMethodError) at java.lang.Throwable.(Throwable.java:180) at java.lang.Error.(Error.java:37) at java.lang.LinkageError.(LinkageError.java:26) at java.lang.IncompatibleClassChangeError.(IncompatibleClassChangeError.java:26) at java.lang.AbstractMethodError.(AbstractMethodError.java:27) Thanks. Paul Morrow MMS Incentives, Inc. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020306/eaece674/attachment.htm From jhunter at servlets.com Wed Mar 6 20:48:27 2002 From: jhunter at servlets.com (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] jdom b7 does not appear to work with the 1.4.0 j2se References: <003201c1c5a1$2cc6b0f0$2801a8c0@amd1600> Message-ID: <3C86F11B.845BEB63@servlets.com> That's a JVM bug. Please report it to Sun, along with a small reproducible test case if possible. Also, please try the latest code in CVS and see if it still happens. -jh- > Paul Morrow wrote: > > Has anyone had any luck running the jdom b7 examples with the 1.4.0 > j2se? I get the following error, even after rebuilding the jdom.jar: > > > Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at > PC=0x6D35DDFE > Function=JVM_DisableCompiler+0x874C > Library=i:\J2SDK_~1\JDK14~1.0\jre\bin\client\jvm.dll > > Current Java thread: > at java.lang.Throwable.fillInStackTrace(Native Method) > - locked <02B9AC18> (a java.lang.AbstractMethodError) > at java.lang.Throwable.(Throwable.java:180) > at java.lang.Error.(Error.java:37) > at java.lang.LinkageError.(LinkageError.java:26) > at > java.lang.IncompatibleClassChangeError.(IncompatibleClassChangeError.java:26) > at > java.lang.AbstractMethodError.(AbstractMethodError.java:27) > > > Thanks. > > Paul Morrow > MMS Incentives, Inc. From bart at wdi.co.uk Thu Mar 7 02:16:03 2002 From: bart at wdi.co.uk (Bart Read) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] jdom b7 does not appear to work with the 1.4.0 j2se References: <003201c1c5a1$2cc6b0f0$2801a8c0@amd1600> <3C86F11B.845BEB63@servlets.com> Message-ID: <004301c1c5c1$1cdb0400$dc00a8c0@JOHNNYBRAVO> Dear Paul, Just out of interest, what OS are you running on? (I don't have any clever suggestions no matter what the answer is unfortunately.) Bart ================================= Bart Read Senior Developer Abbotsbury Software Ltd Abbotsbury, DORSET DT3 4JT Tel: +44 (0) 1305 871543 E-mail: bart@wdi.co.uk ================================= ----- Original Message ----- From: "Jason Hunter" To: "Paul Morrow" Cc: Sent: Thursday, March 07, 2002 4:48 AM Subject: Re: [jdom-interest] jdom b7 does not appear to work with the 1.4.0 j2se > That's a JVM bug. Please report it to Sun, along with a small > reproducible test case if possible. > > Also, please try the latest code in CVS and see if it still happens. > > -jh- > > > Paul Morrow wrote: > > > > Has anyone had any luck running the jdom b7 examples with the 1.4.0 > > j2se? I get the following error, even after rebuilding the jdom.jar: > > > > > > Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at > > PC=0x6D35DDFE > > Function=JVM_DisableCompiler+0x874C > > Library=i:\J2SDK_~1\JDK14~1.0\jre\bin\client\jvm.dll > > > > Current Java thread: > > at java.lang.Throwable.fillInStackTrace(Native Method) > > - locked <02B9AC18> (a java.lang.AbstractMethodError) > > at java.lang.Throwable.(Throwable.java:180) > > at java.lang.Error.(Error.java:37) > > at java.lang.LinkageError.(LinkageError.java:26) > > at > > java.lang.IncompatibleClassChangeError.(IncompatibleClassChangeError.j ava:26) > > at > > java.lang.AbstractMethodError.(AbstractMethodError.java:27) > > > > > > Thanks. > > > > Paul Morrow > > MMS Incentives, Inc. > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com > > ---------- Automatically inserted by WDI Mailserver ---------------- > This message has been scanned for virus, trojans, illegal relays and > spam. If you have any comments, problems or questions please do not > hesitate to contact: > Abbotsbury Software Ltd > Tel: +44 1305 871543 Fax: +44 1305 871688 > Email: postmaster@wdi.co.uk > Web: http://www.wdi.co.uk/virus.phtml From laurent.bihanic at atosorigin.com Thu Mar 7 03:25:05 2002 From: laurent.bihanic at atosorigin.com (Laurent Bihanic) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] jdom b7 does not appear to work with the 1.4.0 j2se References: <003201c1c5a1$2cc6b0f0$2801a8c0@amd1600> <3C86F11B.845BEB63@servlets.com> Message-ID: <3C874E11.6060802@atosorigin.com> Jason Hunter wrote: > That's a JVM bug. Please report it to Sun, along with a small > reproducible test case if possible. The crash is indeed a JVM bug but the exception being processed at the time of the crash (IncompatibleClassChangeError) indicates that at least one class needs to be recompiled against the new JDK, either in JDOM or in the application. As I successfully ran JDOM beta7 with JDK 1.4, I'd suggest checking the application. A full stack trace would have helped. Laurent From paul at morrow.net Thu Mar 7 04:51:26 2002 From: paul at morrow.net (Paul Morrow) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] jdom b7 does not appear to work with the 1.4.0 j2se References: <003201c1c5a1$2cc6b0f0$2801a8c0@amd1600> <3C86F11B.845BEB63@servlets.com> <004301c1c5c1$1cdb0400$dc00a8c0@JOHNNYBRAVO> Message-ID: <002301c1c5d6$cbd7df40$33018080@ntdomain1> NT 4.0 build 1381, service pack 6 ----- Original Message ----- From: "Bart Read" To: "Jason Hunter" ; "Paul Morrow" Cc: Sent: Thursday, March 07, 2002 5:16 AM Subject: Re: [jdom-interest] jdom b7 does not appear to work with the 1.4.0 j2se > Dear Paul, > > > Just out of interest, what OS are you running on? (I don't have any clever > suggestions no matter what the answer is unfortunately.) > > > Bart > > > > ================================= > Bart Read > Senior Developer > Abbotsbury Software Ltd > Abbotsbury, DORSET DT3 4JT > Tel: +44 (0) 1305 871543 > E-mail: bart@wdi.co.uk > ================================= > ----- Original Message ----- > From: "Jason Hunter" > To: "Paul Morrow" > Cc: > Sent: Thursday, March 07, 2002 4:48 AM > Subject: Re: [jdom-interest] jdom b7 does not appear to work with the 1.4.0 > j2se > > > > That's a JVM bug. Please report it to Sun, along with a small > > reproducible test case if possible. > > > > Also, please try the latest code in CVS and see if it still happens. > > > > -jh- > > > > > Paul Morrow wrote: > > > > > > Has anyone had any luck running the jdom b7 examples with the 1.4.0 > > > j2se? I get the following error, even after rebuilding the jdom.jar: > > > > > > > > > Unexpected Signal : EXCEPTION_ACCESS_VIOLATION occurred at > > > PC=0x6D35DDFE > > > Function=JVM_DisableCompiler+0x874C > > > Library=i:\J2SDK_~1\JDK14~1.0\jre\bin\client\jvm.dll > > > > > > Current Java thread: > > > at java.lang.Throwable.fillInStackTrace(Native Method) > > > - locked <02B9AC18> (a java.lang.AbstractMethodError) > > > at java.lang.Throwable.(Throwable.java:180) > > > at java.lang.Error.(Error.java:37) > > > at java.lang.LinkageError.(LinkageError.java:26) > > > at > > > > java.lang.IncompatibleClassChangeError.(IncompatibleClassChangeError.j > ava:26) > > > at > > > java.lang.AbstractMethodError.(AbstractMethodError.java:27) > > > > > > > > > Thanks. > > > > > > Paul Morrow > > > MMS Incentives, Inc. > > _______________________________________________ > > To control your jdom-interest membership: > > > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos > t.com > > > > ---------- Automatically inserted by WDI Mailserver ---------------- > > This message has been scanned for virus, trojans, illegal relays and > > spam. If you have any comments, problems or questions please do not > > hesitate to contact: > > Abbotsbury Software Ltd > > Tel: +44 1305 871543 Fax: +44 1305 871688 > > Email: postmaster@wdi.co.uk > > Web: http://www.wdi.co.uk/virus.phtml > > From flierl at fmi.uni-passau.de Thu Mar 7 08:25:39 2002 From: flierl at fmi.uni-passau.de (Jakob Flierl) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] JDOM tree manipulating java bean Message-ID: <20020307172539.A19169@cosel.fmi.uni-passau.de> Hello, I'm searching for a java bean, which is able to display and manipulate the contents of a JDOM tree object. Regards, jf From jonbaer at digitalanywhere.com Thu Mar 7 09:26:10 2002 From: jonbaer at digitalanywhere.com (Jon Baer) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Need help (filters) on SAXHandler ... Message-ID: <3C87A2B2.8970EE10@digitalanywhere.com> Here is my current problem (after going through the archives and looking at FilterList and Filter subject, I realize it hasn't been discussed). I am interested in creating a Builder that does not return a JDOM Document. Strange but true. Basically what I want to do is create an Event/Listener with Elements that doesn't really return anything. Before I dive in after looking at SAXHandler code I was wondering if there was a normal or more easy way of doing this. I saw that the FilterList and Filtering in general mostly pertained to a JDOM Document model after it was built. For this reason Im not really interested in XPath either.. The thing is I don't really want to use SAX either because Im really after the JDOM Element object for other purposes. Does this make sense: NullBuilder b = new NullBuilder(); b.setElementListener("foo", this); b.setElementListener("bar", this); b.build(); public void elementReceived(Element e) { if (e.getName().equals("foo")) {} if (e.getName().equals("bar")) {} } The easiest step in seeming to do this is to rework stack.push(element); with some logic in SAXHandler being used. Correct? Any ideas? The thing I want to do is simply wrap up the Element once everything has been received send it to the listerner, do it's business, and get rid of it. - Jon From stueken at conterra.de Thu Mar 7 09:41:39 2002 From: stueken at conterra.de (Dieter Stueken) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] get version info Message-ID: <3C87A653.42A7D075@conterra.de> my little test sample works under Linux but does not work under Sun Solaris, until I found I'm using different jdom.jar files. Is there any trick to find out the difference or what version they are? Looking into the source I find some "private static final String CVS_ID", but as it is private (why?), I can't look into. I usually use "strings" to grep such information from binaries, but Java Strings are 16 bit coded :-( May be the jar file was compiled by a different SDK version... any idea Dieter. -- Dieter St?ken, con terra GmbH, M?nster stueken@conterra.de stueken@qgp.uni-muenster.de http://www.conterra.de/ http://qgp.uni-muenster.de/~stueken (0)251-980-2027 (0)251-83-334974 From jonbaer at digitalanywhere.com Thu Mar 7 09:56:40 2002 From: jonbaer at digitalanywhere.com (Jon Baer) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] get version info References: <3C87A653.42A7D075@conterra.de> Message-ID: <3C87A9D8.491F415F@digitalanywhere.com> Try: java -cp jdom.jar JDOMAbout - Jon Dieter Stueken wrote: > my little test sample works under Linux but does not work > under Sun Solaris, until I found I'm using different jdom.jar > files. Is there any trick to find out the difference or what > version they are? Looking into the source I find some > "private static final String CVS_ID", but as it is private (why?), > I can't look into. I usually use "strings" to grep such > information from binaries, but Java Strings are 16 bit coded :-( > May be the jar file was compiled by a different SDK version... > > any idea > > Dieter. > -- > Dieter St?ken, con terra GmbH, M?nster > stueken@conterra.de stueken@qgp.uni-muenster.de > http://www.conterra.de/ http://qgp.uni-muenster.de/~stueken > (0)251-980-2027 (0)251-83-334974 > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From jonbaer at digitalanywhere.com Thu Mar 7 10:15:49 2002 From: jonbaer at digitalanywhere.com (Jon Baer) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Need help (filters) on SAXHandler ... References: <3C87A2B2.8970EE10@digitalanywhere.com> Message-ID: <3C87AE55.548CC804@digitalanywhere.com> Just a quick follow up question I forgot in my last email ... Why isn't there a setContentHandler method for setting say saxContentHandler in the SAXBuilder? Under build(InputSource in) it always makes the assumption that you are using that specific handler no matter what yet every other part can be configured. Im trying to determine if I can still use SAXBuilder by just creating a setElementHandler() to it and just use a modified SAXHandler. (Am I just not reading into the XMLFilter feature enough?) - Jon From jonbaer at digitalanywhere.com Thu Mar 7 13:04:53 2002 From: jonbaer at digitalanywhere.com (Jon Baer) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Re: get version info References: <560BB48D9A412D42AEF874777A93511E10F6D8@exchq5.cinfin.com> Message-ID: <3C87D5F5.A828099F@digitalanywhere.com> Look in the /package directory of your JDOM ... you don't really need much except if you see /META-INF/info.xml that contain's the info, so all the jars like Ant, etc would need an XML parser, JDOM just assumes you already have one if you are using it, but Im sure an About.class would be nice for other things. It's probably just a design decision to create a Main.class or About.class with your package. All you basically need to do is not set it inside a named package: About.class com.mypackage.MyClass.class Then when you run java -jar mylib.jar About ... You can run main(String[] args) and just return a static version string or some other info output. - Jon "Nagulapalli, Srinivas" wrote: > Jon Baer [mailto:jonbaer@digitalanywhere.com] wrote: > >Try: > > > >java -cp jdom.jar JDOMAbout > > > > Thanks Jon, it truly works. I don't know why they don't write About > classes > for other jar(s) like Ant's, (AntRunner) or log4j!! JDOM is leading the > way! > I am just curious, if I make a jar of my project, what do I have to do > to get the functionality that the command you wrote above gives? > Thanks > -Srini From ted.toth at vincera.com Thu Mar 7 08:31:27 2002 From: ted.toth at vincera.com (Ted Toth) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] percent signs and XML parsing when internal DTD entities declared Message-ID: <0A7538BA9E7A564F82D22097FB9812DF0CFBD5@vin-msg-01.scoville.com> I've slightly altered the inline.xml file adding a link from the catalog.xml file which contains "%". This causes an exception that doesn't make any sense to me. I'm not sure this is a JDOM issue since the original exception is a SAXParseException. I think it has something to do with the internal DTD declaration. Any ideas? ------- altered inline.xml ---------------------------------------------------------- ]> God fortsättning på det nya millenniet! Two by Three -------- exception generated by running DOMBuilderDemo sample with new inline.xml -------------------------------------------------- org.jdom.JDOMException: Error on line 16: Parameter entity references must not appear within markup declarations in the internal DTD subset. at org.jdom.input.DOMBuilder.build(DOMBuilder.java:278) at org.jdom.input.DOMBuilder.build(DOMBuilder.java:307) at samples.DOMBuilderDemo.main(DOMBuilderDemo.java:113) Caused by: org.xml.sax.SAXParseException: Parameter entity references must not appear within markup declarations in the internal DTD subset. at org.jdom.input.DOMBuilder.build(DOMBuilder.java:246) at org.jdom.input.DOMBuilder.build(DOMBuilder.java:307) at samples.DOMBuilderDemo.main(DOMBuilderDemo.java:113) Ted Toth Vincera 6801 N. Capital of Texas Highway Building 1, Suite 101 Austin, TX 78731 512.233.5517 512.233.5501 fax From jhunter at apache.org Thu Mar 7 15:02:02 2002 From: jhunter at apache.org (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Re: get version info References: <560BB48D9A412D42AEF874777A93511E10F6D8@exchq5.cinfin.com> <3C87D5F5.A828099F@digitalanywhere.com> Message-ID: <3C87F16A.87AA45AD@apache.org> Note that we removed the "java -jar jdom.jar" functionality recently. To run we had to have xerces or another parser listed as a class-path and that caused applets to look for the class on the server. Now you can still type "java JDOMAbout" with the JAR in your classpath, but the slick -jar feature isn't enabled. For more info, see the archives. -jh- Jon Baer wrote: > > Look in the /package directory of your JDOM ... you don't really need much > except if you see /META-INF/info.xml that contain's the info, so all the jars > like Ant, etc would need an XML parser, JDOM just assumes you already have > one if you are using it, but Im sure an About.class would be nice for other > things. It's probably just a design decision to create a Main.class or > About.class with your package. > > All you basically need to do is not set it inside a named package: > > About.class > com.mypackage.MyClass.class > > Then when you run java -jar mylib.jar About ... > > You can run main(String[] args) and just return a static version string or > some other info output. > > - Jon > > "Nagulapalli, Srinivas" wrote: > > > Jon Baer [mailto:jonbaer@digitalanywhere.com] wrote: > > >Try: > > > > > >java -cp jdom.jar JDOMAbout > > > > > > > Thanks Jon, it truly works. I don't know why they don't write About > > classes > > for other jar(s) like Ant's, (AntRunner) or log4j!! JDOM is leading the > > way! > > I am just curious, if I make a jar of my project, what do I have to do > > to get the functionality that the command you wrote above gives? > > Thanks > > -Srini > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From jhunter at apache.org Thu Mar 7 15:03:25 2002 From: jhunter at apache.org (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] get version info References: <3C87A653.42A7D075@conterra.de> Message-ID: <3C87F1BD.2ACFA386@apache.org> In jdom-contrib there's an Ident program that prints the ID strings. They're meant for grepping with "strings", which does work for me and others. Java writes strings in the class files as UTF-8 which has ASCII chars stay as ASCII and be nicely found. -jh- Dieter Stueken wrote: > > my little test sample works under Linux but does not work > under Sun Solaris, until I found I'm using different jdom.jar > files. Is there any trick to find out the difference or what > version they are? Looking into the source I find some > "private static final String CVS_ID", but as it is private (why?), > I can't look into. I usually use "strings" to grep such > information from binaries, but Java Strings are 16 bit coded :-( > May be the jar file was compiled by a different SDK version... > > any idea > > Dieter. > -- > Dieter St?ken, con terra GmbH, M?nster > stueken@conterra.de stueken@qgp.uni-muenster.de > http://www.conterra.de/ http://qgp.uni-muenster.de/~stueken > (0)251-980-2027 (0)251-83-334974 > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From ddlucas at lse.com Thu Mar 7 20:16:52 2002 From: ddlucas at lse.com (David D. Lucas) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] ConcurrentModificationException Message-ID: <3C883B34.1010700@lse.com> java.util.ConcurrentModificationException at org.jdom.ContentList$FilterListIterator.checkConcurrentModification(ContentList.java:1204) at org.jdom.ContentList$FilterListIterator.hasNext(ContentList.java:926) at blah, blah, blah I do not have time to verify the logic on the expected versus modified, but I have run the code under JDOM 1.0 b7 without any problems between multiple threads. Will there be a flag or property to turn this check off? I believe the expected is not being properly accounted for when things are added or removed either directly or through an iterator. I need this fix with the release of Beta 8 or I will never be able to move forward. Thanks, Dave +------------------------------------------------------------+ | David Lucas mailto:ddlucas@lse.com | | Lucas Software Engineering, Inc. (740) 964-6248 Voice | | Unix,Java,C++,CORBA,XML (614) 668-4020 Mobile | | Middleware,Frameworks (888) 866-4728 Fax | +------------------------------------------------------------+ | GPS Location: 40 deg 00' 51" N, 82 deg 38' 11" W | | IMHC: "Jesus Christ is the way, the truth, and the life." | | IMHC: "I know where I am; I know where I'm going." <>< | +------------------------------------------------------------+ Notes: PGP Key Block=http://www.lse.com/~ddlucas/pgpblock.txt IMHO="in my humble opinion" IMHC="in my humble conviction" All trademarks above are those of their respective owners. From jhunter at acm.org Thu Mar 7 22:17:01 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] ConcurrentModificationException References: <3C883B34.1010700@lse.com> Message-ID: <3C88575D.C424BCE7@acm.org> To help you please send in: The full stack trace Whether this happens sometimes or always If the app is multithreaded or not What was happening when the exception was thrown (simple walk, removals, etc?) A simple reproducible test case (a test case means we can surely fix it, no test case means we might be able to fix it) -jh- "David D. Lucas" wrote: > > java.util.ConcurrentModificationException > at > org.jdom.ContentList$FilterListIterator.checkConcurrentModification(ContentList.java:1204) > at > org.jdom.ContentList$FilterListIterator.hasNext(ContentList.java:926) > at > > blah, blah, blah > > I do not have time to verify the logic on the expected versus modified, > but I have run the code under JDOM 1.0 b7 without any problems between > multiple threads. Will there be a flag or property to turn this check off? > > I believe the expected is not being properly accounted for when things > are added or removed either directly or through an iterator. > > I need this fix with the release of Beta 8 or I will never be able to > move forward. > > Thanks, > Dave > > > > +------------------------------------------------------------+ > | David Lucas mailto:ddlucas@lse.com | > | Lucas Software Engineering, Inc. (740) 964-6248 Voice | > | Unix,Java,C++,CORBA,XML (614) 668-4020 Mobile | > | Middleware,Frameworks (888) 866-4728 Fax | > +------------------------------------------------------------+ > | GPS Location: 40 deg 00' 51" N, 82 deg 38' 11" W | > | IMHC: "Jesus Christ is the way, the truth, and the life." | > | IMHC: "I know where I am; I know where I'm going." <>< | > +------------------------------------------------------------+ > > Notes: PGP Key Block=http://www.lse.com/~ddlucas/pgpblock.txt > IMHO="in my humble opinion" IMHC="in my humble conviction" > All trademarks above are those of their respective owners. > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From christian.holmqvist at posten.se Fri Mar 8 00:27:19 2002 From: christian.holmqvist at posten.se (Christian Holmqvist, IT, Posten) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Standalone attribute in Hi! I'm rather new to XML so bare with me if I don't have all the exactly correct terms and expressions going on yet... *smile* How to I add the standalone attribute to the Message-ID: <3C887A67.7060405@atosorigin.com> Hi, You may be interested in org.jdom.contrib.input.scanner.ElementScanner (in the jdom-contrib module). ElementScanner is a SAX filter that uses XPath-like expressions to select element nodes to build and notifies listeners when these elements becomes available during the SAX parse. (Note that this is not real XPath as ElementScanner uses regular expressions to match elements in SAXHandler's element stack.) Using it may be as simple as: ElementScanner f = new ElementScanner(); f.addElementListener(listener1, "foo"); // same as "//foo" f.addElementListener(listener2, "bar"); f.parse(new InputSource("test.xml")); with listener1 and listener2 instances of your implementation of the ElementListener interface. Hope this helps, Laurent Jon Baer wrote: > Here is my current problem (after going through the archives and looking > at FilterList and Filter subject, I realize it hasn't been discussed). > > I am interested in creating a Builder that does not return a JDOM > Document. Strange but true. Basically what I want to do is create an > Event/Listener with Elements that doesn't really return anything. > Before I dive in after looking at SAXHandler code I was wondering if > there was a normal or more easy way of doing this. I saw that the > FilterList and Filtering in general mostly pertained to a JDOM Document > model after it was built. For this reason Im not really interested in > XPath either.. > > The thing is I don't really want to use SAX either because Im really > after the JDOM Element object for other purposes. > > Does this make sense: > > NullBuilder b = new NullBuilder(); > b.setElementListener("foo", this); > b.setElementListener("bar", this); > b.build(); > > public void elementReceived(Element e) { > if (e.getName().equals("foo")) {} > if (e.getName().equals("bar")) {} > } > > The easiest step in seeming to do this is to rework stack.push(element); > with some logic in SAXHandler being used. Correct? Any ideas? The > thing I want to do is simply wrap up the Element once everything has > been received send it to the listerner, do it's business, and get rid of > it. > > - Jon > > > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com > > -- wWw Zzzzz (- -) -------------ooO-(_)-Ooo----------------------------------------------- Laurent Bihanic | Tel: +33 (0)1 55.91.21.93 (Direct line) Atos Origin | +33 (0)1 55.91.20.00 Int?gration - e-Business | Fax: +33 (0)1 55.91.22.31 Les Miroirs - Bat. C | 18, avenue d'Alsace | F-92926 La Defense Cedex | e-Mail: laurent.bihanic@atosorigin.com ----------------------------------------------------------------------- "Microsoft isn't the answer. Microsoft is the question and the answer is no." DISCLAIMER: The opinions expressed are entirely my own and may not necessarily be those of my employer. Also, I am not now nor have I ever been a lawyer. My opinions are provided as-is with absolutely no warrantee of merchantability or fitness for any particular use. Besides, you can't prove I typed this. No body saw me type this. Who says I typed this? From jmb at cogsci.ed.ac.uk Fri Mar 8 03:25:10 2002 From: jmb at cogsci.ed.ac.uk (Jason Baldridge) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] efficient Java collections Message-ID: <15496.40854.217865.933689@smith> Hi all, I'm passing this correspondence with Jason Hunter along to the JDOM interest group regarding using the trove collections (http://trove4j.sf.net) in JDOM. It shouldn't be too difficult to do, so it could be a nice task for someone who wanted to play with the code but not worry about making any fundamental changes -- just swapping in more efficient collection implementations! Jason Jason Hunter writes: > Interesting. We stopped using LinkedList after b7 actually (ArrayList > was much better in all respects despite what we initially thought), but > this is an interesting library. I'd suggest you post about it to > jdom-interest and see if anyone wants to give it a test whirl. I myself > am too swamped to do it, but someone on the list might like > experimenting. > > -jh- > > Jason Baldridge wrote: > > > > Jason and Brett, > > > > Just in case you haven't heard about it yet, there is a project > > (trove4j) on sourceforge for efficient Java collections, licensed > > under the LGPL. Memory and speed is often significantly improved, and > > there is a linked list implementation that actually behaves like a > > linked list in terms of performance. I've seen here and there in JDOM > > code that you use linked lists, and the trove lists will use much less > > memory and be a good deal faster. There is also support for > > collections of primitive types. > > > > Anyway, you can check it out at http://trove4j.sf.net. The switchover > > to using trove classes is trivial in most cases. The linked lists > > require you to implement the TLinkable interface, which is not tough, > > but does require either extending TLinkableAdaptor or implementing a > > few methods in every class that you want to use in a TLinkedList. > > > > I saw that JDOM beta 8 is nearing completion --- looking forward to > > it! Thanks for creating JDOM, it's been a real help in my work. > > > > Cheers, > > Jason Baldridge > From JBeech at dmu.ac.uk Fri Mar 8 04:34:05 2002 From: JBeech at dmu.ac.uk (Steve Beech) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] List problem... Message-ID: <6D2CACF507A7D31187AF00508B5E194B0546300E@atnas.dmu.ac.uk> Dear All, I've managed to adjust something (outside of the code) and now my previously working JDOM parsing class doesn't compile. Instead I get the following error: java.lang.NoClassDefFoundError: com/sun/java/util/collections/List at angelUM.WEBINF.Classes.JDOMTest.newDocument(JDOMTest.java:43) at angelUM.WEBINF.Classes.JDOMTest.main(JDOMTest.java:95) Exception in thread "main" I was under the impression that the list of elements I am creating was of type java.util.List, not java.util.collections.List. If I mount the collections.jar file then I get an incompatible type error between java.util.List and java.util.Collections.List. Does anyone know what I've done to cause this error? TIA Steve From jhunter at acm.org Fri Mar 8 10:03:29 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] JavaOne presentations (flame -- continued) Message-ID: <3C88FCF1.11EFE638@acm.org> This is part two in my never-ending story about the crazy things they do to JavaOne presentations... After the events of the last email, I bit the bullet and changed my slides to a format where they could be approved by The Training Alliance (hereafter referred to as the "Slide Nazis"). If you recall, my major concern was trying to make the slides useful to someone *after* the show while keeping within their rule of having just a few lines per slide with 8 words per line. After a little thinking, I realized this was just a *whitespace problem*! If you're willing to add a couple slides and take what was a sentence and make it into two 8-word bullet points, you can have whatever content you want within any whitespace boundaries! Problem solved! SlideOutputter slideOutputter = new SlideOutputter(); slideOutputter.setFormat("JavaOne"); slideOutputter.output(pdfResult, jdomTalk); The next challenge came this morning: Legal Review. You'll never believe what they changed in the name of legal review! First, the changed my title. What was the catchy "JDOM Makes XML Easy" is now something reminiscent of a scientific journal: "JSR-102 ('JDOM 1.0') Makes XML Easy". I can't imagine why this change was made during legal review. On the bright side, it's better than last year when they changed "JDOM" to "The Document Object Model for Java". Second, they changed a quote I was using (remember I needed to add a quote to pass TTA review). Where the person really said, "Java and XML" it's been changed so they now say "Java *technology* and XML". Isn't it risky legally to put words in someone's mouth -- adding something they didn't really say -- probably more risky than to let the world know they said the word Java without the word "technology" after it? Third, on the page about myself I had a nice small picture of my book cover. It was removed! It's clear where it used to be because they left the big gap. What legal justification is there for removing a book cover promo? Maybe I'll bring a copy of my book and have someone hold it up at that spot in the slide. To my slight surprise, those are the only changes they made. I guess that's because many of the slides are code, and lawyers don't like reading code any more than coders like reading legal documents. Makes me think of another possible hack. If you want to say something that would be censored, put it in a code comment! I bet that would sneak through. :-) -jh- From jozart at csi.com Sat Mar 9 00:09:01 2002 From: jozart at csi.com (Joseph Bowbeer) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Re: efficient Java collections References: <200203090704.AAA23860@dorothy.denveronline.net> Message-ID: <013601c1c741$ac747700$0a0a0a0a@REPLICANT> Jason Baldridge writes: > It shouldn't be too difficult to do, [...] -- just swapping > in more efficient collection implementations! And then benchmark the results to verify that significantly better performance and/or memory savings are actually achieved... Based on my quick inspection, however, I don't believe trove is a good match. 1. Most of the optimizations are aimed at homogeneous collections of int/long/float, etc., which won't help JDom. 2. Concerning the TLinkedList implementation, only instances of TLinkable can be added to the list. Ouch. 3. Also, won't the LGPL license be a problem for a JCP-sanctioned reference implementation? By the way, there's a small repository of Collections implementations at: http://javacollections.org/ --- original message --- From: Jason Baldridge Date: Fri, 8 Mar 2002 11:25:10 +0000 (GMT) To: jdom-interest@jdom.org Reply-To: Jason Baldridge Subject: [jdom-interest] efficient Java collections Hi all, I'm passing this correspondence with Jason Hunter along to the JDOM interest group regarding using the trove collections (http://trove4j.sf.net) in JDOM. It shouldn't be too difficult to do, so it could be a nice task for someone who wanted to play with the code but not worry about making any fundamental changes -- just swapping in more efficient collection implementations! Jason Jason Hunter writes: > Interesting. We stopped using LinkedList after b7 actually (ArrayList > was much better in all respects despite what we initially thought), but > this is an interesting library. I'd suggest you post about it to > jdom-interest and see if anyone wants to give it a test whirl. I myself > am too swamped to do it, but someone on the list might like > experimenting. > > -jh- > > Jason Baldridge wrote: > > > > Jason and Brett, > > > > Just in case you haven't heard about it yet, there is a project > > (trove4j) on sourceforge for efficient Java collections, licensed > > under the LGPL. Memory and speed is often significantly improved, and > > there is a linked list implementation that actually behaves like a > > linked list in terms of performance. I've seen here and there in JDOM > > code that you use linked lists, and the trove lists will use much less > > memory and be a good deal faster. There is also support for > > collections of primitive types. > > > > Anyway, you can check it out at http://trove4j.sf.net. The switchover > > to using trove classes is trivial in most cases. The linked lists > > require you to implement the TLinkable interface, which is not tough, > > but does require either extending TLinkableAdaptor or implementing a > > few methods in every class that you want to use in a TLinkedList. > > > > I saw that JDOM beta 8 is nearing completion --- looking forward to > > it! Thanks for creating JDOM, it's been a real help in my work. > > > > Cheers, > > Jason Baldridge > From dmkarr at earthlink.net Sat Mar 9 14:25:30 2002 From: dmkarr at earthlink.net (David M. Karr) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Debugging jdom event handling Message-ID: <86y9h1js4l.fsf@earthlink.net> I'm trying to figure out how to make jdom more "verbose", so I can track all the document pieces it is finding. I need to do this because I'm getting a parsing error from it that I don't understand. I'm seeing the following exception: org.jdom.JDOMException: Error on line 7: Value must be quoted. The beginning of the document I'm trying to parse is this: ------------------ Birthdays Holidays In-Service Days Miscellaneous ------------------ I've stared and stared at this, and I don't see anything wrong with line 7, or any of the lines around it. I was thinking that if I could interpose event handlers so I could add print statements, I could watch the process a little closer. I also had some trouble getting the "DOCTYPE" element correct, the system identifier in particular. I tried using just "file:calendarData.dtd", but that got an exception: Relative URI "file:calendarData.dtd"; can not be resolved without a base URI. -- =================================================================== David M. Karr ; Java/J2EE/XML/Unix/C++ dmkarr@earthlink.net From alex_den at pchome.com.tw Sun Mar 10 20:08:02 2002 From: alex_den at pchome.com.tw (alex_pchome) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] What's difference between beta 7 and beta 8? References: <200203090704.AAA23860@dorothy.denveronline.net> <013601c1c741$ac747700$0a0a0a0a@REPLICANT> Message-ID: <01a001c1c8b2$56e44960$9436728c@mars> Hi all I have a question. What's difference between beta 7 and beta 8? Is jdom support XPATH? Where can I get beta 8? Very Thanks!! Regard Alex ========================================================== PC home ?q?l?H?c?A????????: http://www.pchome.com.tw PC home Online ?????a?x?G?|?????@?A?x?W???j???J?f???? ========================================================== From arosen at silverstream.com Sun Mar 10 22:04:51 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Debugging jdom event handling In-Reply-To: <86y9h1js4l.fsf@earthlink.net> Message-ID: <000001c1c8c2$a94d4a70$6601a8c0@silverstream.com> You're parsing a document, right? This error is coming from the underlying XML parser, not from JDOM. SAXBuilder uses an XML parser like Xerces or Crimson to parse the document, so you'll have to look there for answers. You might try testing it with a different parser also. (Your file looks fine to me, though.) Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of David M. Karr > Sent: Saturday, March 09, 2002 5:26 PM > To: jdom-interest@jdom.org > Subject: [jdom-interest] Debugging jdom event handling > > > I'm trying to figure out how to make jdom more "verbose", so > I can track all > the document pieces it is finding. I need to do this because > I'm getting a > parsing error from it that I don't understand. > > I'm seeing the following exception: > > org.jdom.JDOMException: Error on line 7: Value must be quoted. > > The beginning of the document I'm trying to parse is this: > ------------------ > > > > > Birthdays > Holidays > In-Service > Days > Miscellaneous > > ------------------ > > I've stared and stared at this, and I don't see anything > wrong with line 7, or > any of the lines around it. I was thinking that if I could > interpose event > handlers so I could add print statements, I could watch the > process a little > closer. > > I also had some trouble getting the "DOCTYPE" element > correct, the system > identifier in particular. I tried using just > "file:calendarData.dtd", but that > got an exception: > > Relative URI "file:calendarData.dtd"; can not be resolved > without a base URI. > > -- > =================================================================== > David M. Karr ; Java/J2EE/XML/Unix/C++ > dmkarr@earthlink.net > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yo uraddr@yourhost.com From m.pask at videonetworks.com Mon Mar 11 00:05:11 2002 From: m.pask at videonetworks.com (Mike Pask) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] JDOM on a KVM Message-ID: Hi, I am currently designing a system to run under CLDC (KVM) with 4Mb. I would like to use XML as the data source as this will give the maximum of flexibility. I was wondering if JDOM had been tested on such a platform, what extra is required etc. If not then are is anything available which could help me in terms of memory usage etc. I intend to keep the documents small. I believe they will be < 10k. At present I am thinking that I might need to build my own simple string parser, to simulate a full JDOM, keeping my documents as a subset of XML, eg. no attributes etc. Any advise would be appreciated thanks Mike Pask Senior Service Architect Video Networks m.pask@videonetworks.com From jhunter at acm.org Mon Mar 11 00:34:38 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] What's difference between beta 7 and beta 8? References: <200203090704.AAA23860@dorothy.denveronline.net> <013601c1c741$ac747700$0a0a0a0a@REPLICANT> <01a001c1c8b2$56e44960$9436728c@mars> Message-ID: <3C8C6C1E.421C193A@acm.org> > What's difference between beta 7 and beta 8? Look in CHANGES.txt in the CVS distribution. > Is jdom support XPATH? Look in the FAQ online. > Where can I get beta 8? You can't yet, since it's not out. -jh- From JBeech at dmu.ac.uk Mon Mar 11 01:26:09 2002 From: JBeech at dmu.ac.uk (Steve Beech) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Base vs. Relative URI? Message-ID: <6D2CACF507A7D31187AF00508B5E194B05463018@atnas.dmu.ac.uk> Dear All, I'm running a server app and using JDOM to parse my configuration file. This works fine from inside my IDE but when I try to run from the command line I get the following error: Exception in thread "main" java.io.IOException: Error on line 2: Relative URI "C:\User_Manager\UM_config.dtd"; can not be resolved without a base URI. at User_Manager.UM_configuration.parseConfiguration(UM_configuration.java:104) at User_Manager.UM_configuration.(UM_configuration.java:49) at User_Manager.UM_configuration.(UM_configuration.java:40) at User_Manager.UM_multiServer.main(UM_multiServer.java:35) My xml config file contains the following dtd reference: In my code I create a validating SAXBuilder using: SAXBuilder builder = new SAXBuilder(true); System.out.println("SAXBuilder created ok"); Document doc = builder.build(in); I get the 'SAXBuilder created ok' message but the doc never gets built. The URI given appears to me to be a base URI and not relative - so does anyone know why I might be getting this error? Thanks in advance, Steve Beech From laurent.bihanic at atosorigin.com Mon Mar 11 02:07:08 2002 From: laurent.bihanic at atosorigin.com (Laurent Bihanic) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Base vs. Relative URI? References: <6D2CACF507A7D31187AF00508B5E194B05463018@atnas.dmu.ac.uk> Message-ID: <3C8C81CC.4070105@atosorigin.com> Hi Steve, The parser understands it as relative because you do not define the protocol to use. Try adding a protocol prefix ("file://"): "file:///c:/User_Manager/UM_config.dtd" Laurent Steve Beech wrote: > Dear All, > > I'm running a server app and using JDOM to parse my configuration file. This > works fine from inside my IDE but when I try to run from the command line I > get the following error: > > Exception in thread "main" java.io.IOException: Error on line 2: Relative > URI "C:\User_Manager\UM_config.dtd"; can not be resolved without a base URI. > at > User_Manager.UM_configuration.parseConfiguration(UM_configuration.java:104) > at User_Manager.UM_configuration.(UM_configuration.java:49) > at User_Manager.UM_configuration.(UM_configuration.java:40) > at User_Manager.UM_multiServer.main(UM_multiServer.java:35) > > My xml config file contains the following dtd reference: > > > > > In my code I create a validating SAXBuilder using: > > SAXBuilder builder = new SAXBuilder(true); > System.out.println("SAXBuilder created ok"); > Document doc = builder.build(in); > > I get the 'SAXBuilder created ok' message but the doc never gets built. > > The URI given appears to me to be a base URI and not relative - so does > anyone know why I might be getting this error? > > Thanks in advance, > > Steve Beech From markw at wilsoncom.de Mon Mar 11 02:39:21 2002 From: markw at wilsoncom.de (MarkW) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Base vs. Relative URI? In-Reply-To: <6D2CACF507A7D31187AF00508B5E194B05463018@atnas.dmu.ac.uk> Message-ID: <000001c1c8e9$01c44660$5b00a8c0@ws20001> Hi, try path relative to "localhost" or "127.0.0.1" ie. //localhost/User_Manager/...... Mark > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org] On Behalf Of Steve Beech > Sent: Monday, March 11, 2002 10:26 AM > To: 'jdom-interest@jdom.org' > Subject: [jdom-interest] Base vs. Relative URI? > > > Dear All, > > I'm running a server app and using JDOM to parse my > configuration file. This > works fine from inside my IDE but when I try to run from the > command line I > get the following error: > > Exception in thread "main" java.io.IOException: Error on line > 2: Relative > URI "C:\User_Manager\UM_config.dtd"; can not be resolved > without a base URI. > at > User_Manager.UM_configuration.parseConfiguration(UM_configurat > ion.java:104) > at > User_Manager.UM_configuration.(UM_configuration.java:49) > at > User_Manager.UM_configuration.(UM_configuration.java:40) > at User_Manager.UM_multiServer.main(UM_multiServer.java:35) > > My xml config file contains the following dtd reference: > > > > > In my code I create a validating SAXBuilder using: > > SAXBuilder builder = new SAXBuilder(true); > System.out.println("SAXBuilder created ok"); > Document doc = builder.build(in); > > I get the 'SAXBuilder created ok' message but the doc never > gets built. > > The URI given appears to me to be a base URI and not relative > - so does > anyone know why I might be getting this error? > > Thanks in advance, > > Steve Beech > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yo uraddr@yourhost.com From JBeech at dmu.ac.uk Mon Mar 11 04:06:35 2002 From: JBeech at dmu.ac.uk (Steve Beech) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] NoSuchMethodError? Message-ID: <6D2CACF507A7D31187AF00508B5E194B0546301E@atnas.dmu.ac.uk> Dear All, When I try and run my app I get the following Exception: Exception in thread "main" java.lang.NoSuchMethodError: org.jdom.Element.getChildren(Ljava/lang/String;Lorg/jdom/namespace;)Ljava/ut il/List; I'm assuming that there is a file missing from my classpath but am not sure which - or even if this is really the problem. Any ideas? Thanks Steve. From ian.lea at blackwell.co.uk Mon Mar 11 04:34:04 2002 From: ian.lea at blackwell.co.uk (Ian Lea) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] NoSuchMethodError? References: <6D2CACF507A7D31187AF00508B5E194B0546301E@atnas.dmu.ac.uk> Message-ID: <3C8CA43C.EDEDAA77@blackwell.co.uk> Certainly looks like a classpath problem, and one with jdom itself, but it seems a strange method call to hit the problem on. Hadn't your app already made jdom calls by then? Could it be that you've got different versions of the jdom jar file floating around? -- Ian. > > Dear All, > > When I try and run my app I get the following Exception: > > Exception in thread "main" java.lang.NoSuchMethodError: > org.jdom.Element.getChildren(Ljava/lang/String;Lorg/jdom/namespace;)Ljava/ut > il/List; > > I'm assuming that there is a file missing from my classpath but am not sure > which - or even if this is really the problem. > > Any ideas? > > Thanks > Steve. From liuwei00 at mails.tsinghua.edu.cn Mon Mar 11 06:11:09 2002 From: liuwei00 at mails.tsinghua.edu.cn (ÁõΪ Golden) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] quesion of EntifyRef and DocType Message-ID: <200203111411.HAA25713@dorothy.denveronline.net> Hi,all: I use jdom API to process my XML files,and I find it is powerful. Recently,I want to add some entity and dtd to my XML files,and then I have some question about the usage of the EntityRef and DodcType classes. I look over the javaDoc of the Jdom,but I got little information which could answer my questions. Are there some to give me some example program about how to use these two classes? Thanks! From jhunter at apache.org Mon Mar 11 15:44:59 2002 From: jhunter at apache.org (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] [Fwd: JDOM ?] Message-ID: <3C8D417B.47D35F0B@apache.org> Please include Kim on any replies. -jh- -------------- next part -------------- An embedded message was scrubbed... From: "K.Gillies" Subject: JDOM ? Date: Mon, 11 Mar 2002 16:28:14 -0700 Size: 2632 Url: http://jdom.org/pipermail/jdom-interest/attachments/20020311/313a0506/attachment.eml From jhunter at jdom.org Mon Mar 11 17:08:10 2002 From: jhunter at jdom.org (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] JDOM Beta 8, Release Candidate #1 Message-ID: <3C8D54FA.2196AD1C@jdom.org> I just posted to http://jdom.org the first JDOM Beta 8 release candidate. The list of improvements over Beta7 (as recorded in CHANGES.txt) is astounding. Among the top items: Dramatically improved the List implementation. Added the notion of a content "filter". Made the input and output classes more robust and reliable. Added support for DTD internal subsets. Finalized the EntityRef architecture. Added support for attribute "types" (not yet available in DOM). Incorporated the Text class to help XPath implementations. Upgraded the Xerces and Crimson parsers. This isn't the final Beta8 release. It's intended for people to upgrade against so they can identify any showstopper issues before the formal b8 release. If your product uses JDOM, I strongly encourage you to get the RC1 and test against it. That way we can find any problems that affect you now and not after release. Please report bugs to jdom-interest. http://www.jdom.org/dist/binary I also have added a Weblog to my Servlets.com site, with a JDOM category. It will contain news and thoughts that aren't quite worth the long process necessary to add something to the official JDOM site. It will be especially useful for people who aren't on the jdom-interest mailing list. If you want to follow along: http://www.servlets.com/blog/jdom.html The first topic is a JavaOne gathering. -jh- From dms at sosnoski.com Mon Mar 11 18:07:49 2002 From: dms at sosnoski.com (Dennis Sosnoski) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] [Fwd: JDOM ?] References: <3C8D417B.47D35F0B@apache.org> Message-ID: <3C8D62F5.2080203@sosnoski.com> You can subclass SAXBuilder and override the createParser method to only create a parser the first time through. That's probably the simplest solution to get reusability (though I haven't looked into whether there might be other issues). It seems like this is a reasonable thing for SAXBuilder to do by default, though. Is there any reason you'd want the code to always build a new parser? I can't think of any. - Dennis Jason Hunter wrote: >Please include Kim on any replies. > >-jh- > > > ------------------------------------------------------------------------ > > Subject: > > JDOM ? > From: > > "K.Gillies" > Date: > > Mon, 11 Mar 2002 16:28:14 -0700 > To: > > jhunter@acm.org > > > Hi Jason, > I apologize for writing you directly. I'm not a regular watcher of > the JDOM > lists although I'm use JDOM -- and I like it! So if you like, please > give me > advice. > > I have an application that reads many XML files that must be > validated to > several DTDs. Someone suggested that creating XML parsers and > configuring > every time a new file must be parsed was rather expensive and that > parsers > should be cached like JDBC connections are often cached. A new parser > isn't needed for every document. I didn't do any measurements since > it seemed like a reasonable statement. > > So I built a class to provide a central cache of SAXBuilders (one to > start with) and allowed clients of the cache to add EntityResolver > instances > to locally return entities. My single EntityResolver just goes through > all the client EntityResolvers one by one. > > All was good until I tried parsing multiple documents, then I got a > JDOMException "Error in building: Stream closed" > > I then went to the SAXBuilder source to look around. What I found > is that > SAXBuilder always creates a new parser in the build method. So all my > efforts > were misplaced. It appears that SAXBuilder can't be resued. > > Do you have any comments on this? Shouldn't I be concerned about > the cost of > creating/configuring parsers every time a new document must be > parsed? One > case where this seems important is a web service that needs to handle XML > messages (like a service using SOAP). > > Is there a way to reuse a SAXBuilder and not create a new parser for > every > document? > > Thanks for any advice you have. > > Kim Gillies > > From jhunter at acm.org Mon Mar 11 17:11:56 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] JDK 1.1 support Message-ID: <3C8D55DC.698C4DDF@acm.org> While building the B8 RC, I noticed that our use of statics inside inner classes is not supported with JDK 1.1 compilers, as shown below. I'm wondering, do we want to fix this for B8, or just decide that we've supported JDK 1.1 long enough? It's been this way in CVS for a couple months and no one's complained. Who would complain if we didn't support JDK 1.1 anymore? -jh- compile: [javac] Compiling 43 source files to /tmp/jdom-b8/build/classes [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable CREATE can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable HASPREV can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable HASNEXT can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable PREV can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable NEXT can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable ADD can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable REMOVE can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable SET can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/output/XMLOutputter.java:217: Variable STANDARD_INDENT can't be static in inner class org.jdom.output.XMLOutputter. Format. Only members of interfaces and top-level classes can be static. [javac] class Format implements Cloneable { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/output/XMLOutputter.java:217: Variable STANDARD_LINE_SEPARATOR can't be static in inner class org.jdom.output.XMLOutputter. Format. Only members of interfaces and top-level classes can be static. [javac] class Format implements Cloneable { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/input/SAXHandler.java:717: Method substring(int) not found in class java.lang.StringBuffer. [javac] String data = textBuffer.substring(0); [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/output/XMLOutputter.java:530: Can't make a static reference to nonstatic variable STANDARD_INDENT in inner class org.jdom.output.XMLOutputter. Format. [javac] defaultFormat.indent = Format.STANDARD_INDENT; [javac] ^ [javac] 12 errors BUILD FAILED From jozart at csi.com Tue Mar 12 00:18:36 2002 From: jozart at csi.com (Joseph Bowbeer) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Re: JDOM on a KVM References: <200203120726.AAA04799@dorothy.denveronline.net> Message-ID: <00b001c1c99e$82864d60$0a0a0a0a@REPLICANT> Mike Pask writes: > I was wondering if JDOM had been tested on [CLDC] platform. JDOM is based on Collections, which is not part of CLDC, but if you build JDOM for JDK1.1 using the JDK1.1-compatible collections.jar it should be CLDC-compatible -- or very close. More information about XML on CLDC can be found below: http://www.ericgiguere.com/microjava/cldc_xml.html http://wireless.java.sun.com/configurations/ttips/xmlparse/ http://www.networkcomputing.com/netdesign/1221java4.html -- Joe Bowbeer From jozart at csi.com Tue Mar 12 00:35:36 2002 From: jozart at csi.com (Joseph Bowbeer) Date: Fri Aug 6 17:07:27 2004 Subject: [jdom-interest] Re: JDK 1.1 support References: <200203120726.AAA04799@dorothy.denveronline.net> Message-ID: <00b401c1c9a0$e20ae640$0a0a0a0a@REPLICANT> Jason Hunter writes: > Who would complain if we didn't support JDK 1.1 anymore? Is this a deficiency in the old compiler or the old class-file format? That is, can you compile using a newer javac using "-target 1.1" ? (I bet you can.) As I was just pointing out to Mike P, the JDK1.1 build is the shortest path to CLDC-compatibility. (Also PersonalJava compatibility, as Collections are only optional in PersonalJava.) Whether anyone is actually using JDOM on these platforms, I don't know... -- Joe Bowbeer UIEvolution.Com --- original message --- Date: Mon, 11 Mar 2002 17:11:56 -0800 From: Jason Hunter To: JDOM Interest Subject: [jdom-interest] JDK 1.1 support While building the B8 RC, I noticed that our use of statics inside inner classes is not supported with JDK 1.1 compilers, as shown below. I'm wondering, do we want to fix this for B8, or just decide that we've supported JDK 1.1 long enough? It's been this way in CVS for a couple months and no one's complained. Who would complain if we didn't support JDK 1.1 anymore? -jh- compile: [javac] Compiling 43 source files to /tmp/jdom-b8/build/classes [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable CREATE can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable HASPREV can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable HASNEXT can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable PREV can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable NEXT can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable ADD can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable REMOVE can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/ContentList.java:880: Variable SET can't be static in inner class org.jdom.ContentList. FilterListIterator. Only members of interfaces and top-level classes can be static. [javac] class FilterListIterator implements ListIterator { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/output/XMLOutputter.java:217: Variable STANDARD_INDENT can't be static in inner class org.jdom.output.XMLOutputter. Format. Only members of interfaces and top-level classes can be static. [javac] class Format implements Cloneable { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/output/XMLOutputter.java:217: Variable STANDARD_LINE_SEPARATOR can't be static in inner class org.jdom.output.XMLOutputter. Format. Only members of interfaces and top-level classes can be static. [javac] class Format implements Cloneable { [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/input/SAXHandler.java:717: Method substring(int) not found in class java.lang.StringBuffer. [javac] String data = textBuffer.substring(0); [javac] ^ [javac] /tmp/jdom-b8/build/src/org/jdom/output/XMLOutputter.java:530: Can't make a static reference to nonstatic variable STANDARD_INDENT in inner class org.jdom.output.XMLOutputter. Format. [javac] defaultFormat.indent = Format.STANDARD_INDENT; [javac] ^ [javac] 12 errors BUILD FAILED From arosen at silverstream.com Tue Mar 12 07:39:47 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] [Fwd: JDOM ?] In-Reply-To: <3C8D62F5.2080203@sosnoski.com> Message-ID: <001401c1c9dc$24fe53c0$6a65810a@silverstream.com> If we're sure that all parser support being reused (or are supposed to support it), then it does seem like a good idea. Doing a quick search, I found that the original (i.e. very old) IBM4J parser says this about its parsing methods: "Once this method is invoked, the parser instance is of no further use, and should NOT be reused." I don't know about newer parsers. The JAXP spec doesn't say one way or the other... http://www-4.ibm.com/software/webservers/appserv/doc/v20dcadv/doc/apidocs/co m.ibm.xml.parser.Parser.html Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Dennis Sosnoski > Sent: Monday, March 11, 2002 9:08 PM > To: Jason Hunter > Cc: JDOM Interest; K.Gillies > Subject: Re: [jdom-interest] [Fwd: JDOM ?] > > > You can subclass SAXBuilder and override the createParser > method to only > create a parser the first time through. That's probably the simplest > solution to get reusability (though I haven't looked into > whether there > might be other issues). > > It seems like this is a reasonable thing for SAXBuilder to do by > default, though. Is there any reason you'd want the code to > always build > a new parser? I can't think of any. > > - Dennis From dms at sosnoski.com Tue Mar 12 09:08:32 2002 From: dms at sosnoski.com (Dennis Sosnoski) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] [Fwd: JDOM ?] References: <001401c1c9dc$24fe53c0$6a65810a@silverstream.com> Message-ID: <3C8E3610.7040409@sosnoski.com> The SAX specification says that parser instances are reusable: http://www.saxproject.org/apidoc/org/xml/sax/XMLReader.html#parse(org.xml.sax.InputSource): "Once a parse is complete, an application may reuse the same XMLReader object, possibly with a different input source." - Dennis Alex Rosen wrote: >If we're sure that all parser support being reused (or are supposed to >support it), then it does seem like a good idea. Doing a quick search, I >found that the original (i.e. very old) IBM4J parser says this about its >parsing methods: "Once this method is invoked, the parser instance is of no >further use, and should NOT be reused." I don't know about newer parsers. >The JAXP spec doesn't say one way or the other... > >http://www-4.ibm.com/software/webservers/appserv/doc/v20dcadv/doc/apidocs/co >m.ibm.xml.parser.Parser.html > >Alex > >>-----Original Message----- >>From: jdom-interest-admin@jdom.org >>[mailto:jdom-interest-admin@jdom.org]On Behalf Of Dennis Sosnoski >>Sent: Monday, March 11, 2002 9:08 PM >>To: Jason Hunter >>Cc: JDOM Interest; K.Gillies >>Subject: Re: [jdom-interest] [Fwd: JDOM ?] >> >> >>You can subclass SAXBuilder and override the createParser >>method to only >>create a parser the first time through. That's probably the simplest >>solution to get reusability (though I haven't looked into >>whether there >>might be other issues). >> >>It seems like this is a reasonable thing for SAXBuilder to do by >>default, though. Is there any reason you'd want the code to >>always build >>a new parser? I can't think of any. >> >> - Dennis >> > From arosen at silverstream.com Tue Mar 12 10:17:53 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Standalone attribute in Message-ID: <002d01c1c9f2$3b189560$6a65810a@silverstream.com> The standalone attribute is not currently supported by XMLOutputter, but it could easily be added, and for completeness it seems like it should be. You'd have to allow it to be "yes" or "no" or absent altogether, so maybe setStandaloneValue(String) would be the simplest API. It is tempting to make the XML declaration a PI, but I don't think it's the right thing to do. The spec defines it as not being a PI, and when parsing it's not passed along as a PI. If you added it to your document as a PI to control the XML delcaration, then the document that you read back in afterwards would be different from the one you emitted (because this special PI would no longer be there). Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Christian Holmqvist, > IT, Posten > Sent: Friday, March 08, 2002 3:27 AM > To: Jdom-Interest (E-mail) > Subject: [jdom-interest] Standalone attribute in > > Hi! > > I'm rather new to XML so bare with me if I don't have all the exactly > correct terms and expressions going on yet... *smile* > > How to I add the standalone attribute to the ProcessInstruction (or > more exactly xml file first line) or how do I change it from > YES to NO and > the other way around? > > I have been looking throgh the archive and seen some discussions about > putting the control of this (together with encoding) in the > XMLOutPutter > thingy. The thing is that I can not see the different between this > ProcessIntruction and other PIs (oki, parsing and well form > ness is hard to > do without it...). Why not let can be changed, > removed and added. If it is missed when trying to pass it to > a parser the > parser WILL complain with some form of error msg... > > Hmm oki, thank you for your time! > > /Christian > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yo > uraddr@yourhost.com From jozart at csi.com Tue Mar 12 09:32:27 2002 From: jozart at csi.com (Joseph Bowbeer) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Re: [Fwd: JDOM ?] Message-ID: <016801c1c9eb$e1851f60$0a0a0a0a@REPLICANT> "Once this method is invoked, the parser instance is of no further use, and should NOT be reused." Should we say the same about SAXBuilder's build method? In my experience with some older parsers, the parsers are not reusable after they've thrown an exception -- even if they are reusable normally. Perhaps we can say one SAXBuilder == one parser and leave it to the re-user to throw-away the SAXBuilder if an error is encountered. (To be safe, and to keep the memory footprint low, I create a new SAXBuilder for every document.) --- original message --- From: Alex Rosen arosen@silverstream.com Date: Tue, 12 Mar 2002 10:39:47 -0500 If we're sure that all parser support being reused (or are supposed to support it), then it does seem like a good idea. Doing a quick search, I found that the original (i.e. very old) IBM4J parser says this about its parsing methods: "Once this method is invoked, the parser instance is of no further use, and should NOT be reused." I don't know about newer parsers. The JAXP spec doesn't say one way or the other... From Jacob.Robertson at argushealth.com Tue Mar 12 12:41:49 2002 From: Jacob.Robertson at argushealth.com (Robertson, Jacob) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Beta 8 ElementFilter Bug Message-ID: Did anyone else catch the coding error in the matches(Object) method of ElementFilter? The line that says else namespace.equals(element.getNamespace()); Should probably say else return namespace.equals(element.getNamespace()); This is the problem with writing code that doesn't use the "else" portion of the if statement. Many people think it's a matter of coding style, but if the entire method had been written with elses for every if statement then this coding bug would have been caught by the compiler. Just my 2 cents.. From dtreves at fastmail.fm Wed Mar 13 03:14:26 2002 From: dtreves at fastmail.fm (David Treves) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Add an XML reference to an XML file Message-ID: <20020313111426.8483B394069@fastmail.fm> Hi, I wrote an application using JDOM in order to generate XML files. I wish to use XSL to format the data. How do I add the XSL file reference () to the XML using JDOM API? Thanks! David. -- David Treves, Java 2 Certified Programmer. From MDoraisamy at SELECTICA.com Wed Mar 13 04:12:06 2002 From: MDoraisamy at SELECTICA.com (Mani Doraisamy) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Add an XML reference to an XML file Message-ID: use org.jdom.ProcessingInstruction public final static String STYLESHEET = "xml-stylesheet"; public final static String STYLEPROCESSINGINSTRUCTION = "type=\"text/xsl\" href=\""; ProcessingInstruction stylesheet = new ProcessingInstruction(STYLESHEET, STYLEPROCESSINGINSTRUCTION+mStyleUrl+"\""); doc.addContent(stylesheet); mani -----Original Message----- From: David Treves [mailto:dtreves@fastmail.fm] Sent: Wednesday, March 13, 2002 4:44 PM To: jdom-interest@jdom.org Subject: [jdom-interest] Add an XML reference to an XML file Hi, I wrote an application using JDOM in order to generate XML files. I wish to use XSL to format the data. How do I add the XSL file reference () to the XML using JDOM API? Thanks! David. -- David Treves, Java 2 Certified Programmer. _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020313/00353052/attachment.htm From jhunter at acm.org Wed Mar 13 18:20:47 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] XPath class Message-ID: <3C9008FF.6A3AC7E6@acm.org> Laurent Bihanic wrote an XPath class that wraps an XPath engine (aka Jaxen) and makes it real easy to get going with XPath. I've attached it for comments, before I check it in. The thought is to put it in org.jdom.xpath, and to add the jaxen and saxpath JARs to the lib directory. If you want to test it out, you can get these two JARs in jdom-contrib/lib. We pondered a bit together about if it was better to use a separate class for this or to add the methods on Element, Attribute, Document, etc. It does seem to be nice to isolate all XPath topics into one unit. If you think about it, XSLT is external to the data structures, and perhaps XPath should be also. Having it separate also encourages you to compile an XPath expression (faster to compile once) and then use it against various contexts. And if there's another competitor to XPath later, that could be added externally also. The methods are the standard Jaxen methods. I'm wondering if we should add a matches() method. Thoughts on that appreciated. And XPath gurus, please give this a test run and see how she handles. -jh- -------------- next part -------------- /*-- $Id:$ Copyright (C) 2000 Brett McLaughlin & Jason Hunter. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions, and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions, and the disclaimer that follows these conditions in the documentation and/or other materials provided with the distribution. 3. The name "JDOM" must not be used to endorse or promote products derived from this software without prior written permission. For written permission, please contact license@jdom.org. 4. Products derived from this software may not be called "JDOM", nor may "JDOM" appear in their name, without prior written permission from the JDOM Project Management (pm@jdom.org). In addition, we request (but do not require) that you include in the end-user documentation provided with the redistribution and/or in the software itself an acknowledgement equivalent to the following: "This product includes software developed by the JDOM Project (http://www.jdom.org/)." Alternatively, the acknowledgment may be graphical using the logos available at http://www.jdom.org/images/logos. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. This software consists of voluntary contributions made by many individuals on behalf of the JDOM Project and was originally created by Brett McLaughlin and Jason Hunter . For more information on the JDOM Project, please see . */ package org.jdom.xpath; import java.io.Serializable; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.IOException; import java.util.List; import org.jdom.JDOMException; import org.saxpath.SAXPathException; import org.jaxen.JaxenException; // import org.jaxen.jdom.XPath; /** * A JDOM-oriented wrapper around XPath engines. * * @author Laurent Bihanic * @version $Revision: 1.114 $, $Date: 2002/03/12 06:53:57 $ */ public final class XPath implements Serializable { private static final String CVS_ID = "@(#) $RCSfile: Element.java,v $ $Revision: 1.114 $ $Date: 2002/03/12 06:53: 57 $ $Name: $"; /** * The compiled XPath object to select nodes. This attribute can * not be made final as it needs to be set upon object * deserialization. */ private org.jaxen.jdom.XPath xPath; /** * Creates a new XPath wrapper object, compiling the specified * XPath expression. * * @param expr the XPath expression to wrap. * * @throws JDOMException if the XPath expression is invalid. */ public XPath(String expr) throws JDOMException { setXPath(expr); } /** * Compiles and sets the XPath expression wrapped by this object. * * @param expr the XPath expression to wrap. * * @throws JDOMException if the XPath expression is invalid. */ private void setXPath(String expr) throws JDOMException { try { xPath = new org.jaxen.jdom.XPath(expr); } catch (SAXPathException ex1) { throw (new JDOMException( "Invalid XPath expression: \"" + expr + "\"", ex1)); } } /** * Returns the wrapped XPath expression as a string. * * @return the wrapped XPath expression as a string. */ public String getXPath() { return (xPath.toString()); } /** * Evaluates the wrapped XPath expression and returns the list * of selected nodes. * * @param context the node to use as context for evaluating * the XPath expression. * * @return the list of selected nodes, which can be instances of * the following JDOM classes: {@link Element}, * {@link Attribute}, {@link Text}, {@link CDATA}, * {@link Comment} or {@link ProcessingInstruction}. * * @throws JDOMException if the evaluation of the XPath * expression on the specified context * failed. */ public List selectNodes(Object context) throws JDOMException { try { return (xPath.selectNodes(context)); } catch (JaxenException ex1) { throw (new JDOMException("XPath error while evaluating \"" + xPath.toString() + "\": " + ex1.getMessage(), ex1)); } } /** * Evaluates the wrapped XPath expression and returns the first * entry in the list of selected nodes. * * @param context the node to use as context for evaluating * the XPath expression. * * @return the first selected nodes, which is an instance of one * of the following JDOM classes: {@link Element}, * {@link Attribute}, {@link Text}, {@link CDATA}, * {@link Comment} or {@link ProcessingInstruction}. * * @throws JDOMException if the evaluation of the XPath * expression on the specified context * failed. */ public Object selectSingleNode(Object context) throws JDOMException { try { return (xPath.selectSingleNode(context)); } catch (JaxenException ex1) { throw (new JDOMException("XPath error while evaluating \"" + xPath.toString() + "\": " + ex1.getMessage(), ex1)); } } /** * Evaluates an XPath expression and returns the list of selected * nodes. *

* Note: This method should not be used when the * same XPath expression needs to be applied several times (on the * same or different contexts) as it requires the expression to be * compiled before being evaluated. In such cases, * {@link #newInstance allocating} an XPath wrapper instance and * {@link #selectNodes(java.lang.Object) evaluating} it several * times is way more efficient.

* * @param context the node to use as context for evaluating * the XPath expression. * @param path the XPath expression to evaluate. * * @return the list of selected nodes, which can be instances of * the following JDOM classes: {@link Element}, * {@link Attribute}, {@link Text}, {@link CDATA}, * {@link Comment} or {@link ProcessingInstruction}. * * @throws JDOMException if the XPath expression is invalid or * its evaluation on the specified context * failed. */ public static List selectNodes(Object context, String path) throws JDOMException { return (new XPath(path).selectNodes(context)); } /** * Evaluates the wrapped XPath expression and returns the first * entry in the list of selected nodes. *

* Note: This method should not be used when the * same XPath expression needs to be applied several times (on the * same or different contexts) as it requires the expression to be * compiled before being evaluated. In such cases, * {@link #newInstance allocating} an XPath wrapper instance and * {@link #selectSingleNode(java.lang.Object) evaluating} it * several times is way more efficient.

* * @param context the element to use as context for evaluating * the XPath expression. * @param path the XPath expression to evaluate. * * @return the first selected nodes, which is an instance of one * of the following JDOM classes: {@link Element}, * {@link Attribute}, {@link Text}, {@link CDATA}, * {@link Comment} or {@link ProcessingInstruction}. * * @throws JDOMException if the XPath expression is invalid or * its evaluation on the specified context * failed. */ public static Object selectSingleNode(Object context, String path) throws JDOMException { return (new XPath(path).selectSingleNode(context)); } /** * Returns the string value of the XPath expression as applied to the * given context. * * @param context the element to use as context for evaluating * the XPath expression. * @return the string value of the XPath expression as applied to the * given context * * @throws JDOMException if the XPath expression is invalid or * its evaluation on the specified context * failed. */ public String valueOf(Object context) throws JDOMException { try { return (xPath.valueOf(context)); } catch (JaxenException ex1) { throw (new JDOMException("XPath error while evaluating \"" + xPath.toString() + "\": " + ex1.getMessage(), ex1)); } } /** * Returns the number value of the XPath expression as applied to the * given context. * * @param context the element to use as context for evaluating * the XPath expression. * @return the number value of the XPath expression as applied to the * given context * * @throws JDOMException if the XPath expression is invalid or * its evaluation on the specified context * failed. */ public Number numberValueOf(Object context) throws JDOMException { try { return (xPath.numberValueOf(context)); } catch (JaxenException ex1) { throw (new JDOMException("XPath error while evaluating \"" + xPath.toString() + "\": " + ex1.getMessage(), ex1)); } } public String toString() { return (xPath.toString()); } public boolean equals(Object o) { if (o instanceof XPath) { XPath x = (XPath)o; return ((super.equals(o)) && (xPath.toString().equals(x.xPath.toString()))); } return (false); } public int hashCode() { return (xPath.hashCode()); } /** * Serializes this object on the specified object stream. * * @param out the object stream to write the serialized * object to. * * @throws IOException if thrown by the output stream. */ private void writeObject(ObjectOutputStream out) throws IOException { out.writeUTF(getXPath()); } /** * Deserializes this object from the specified object stream. * * @param in the object stream to read the serialized * object from. * * @throws IOException if thrown by the input stream. */ private void readObject(ObjectInputStream in) throws IOException { try { this.setXPath(in.readUTF()); } catch (JDOMException ex1) { throw (new IOException(ex1.toString())); } } } From PMcFarlane at lendx.com Wed Mar 13 18:39:55 2002 From: PMcFarlane at lendx.com (Patrick McFarlane) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] problem with detaching Attributes in JDOM Beta 8, Release Candida te #1 ??? Message-ID: <001260FC91ADD511907400D0B79EC1BF0B8A61@mail.lendx.com> Hello, I'm currently using code like the following to remove an attribute from one element and then add it to another. Element currCompElem...... Element refElem = ew.getReferencedElement(); Attribute nameAttr = currCompElem.getAttribute("name"); nameAttr.detach(); refElem.setAttribute(nameAttr); I was able to use this code in JDOM Beta 7 without error. However with JDOM Beta 8 I get the following error... java.lang.ExceptionInInitializerError: org.jdom.IllegalAddException: The attribute already has an existing parent "component" at org.jdom.AttributeList.add(AttributeList.java, Compiled Code) at org.jdom.AttributeList.add(AttributeList.java, Compiled Code) at org.jdom.AttributeList.set(AttributeList.java:445) at org.jdom.AttributeList.add(AttributeList.java, Compiled Code) at org.jdom.Element.setAttribute(Element.java, Compiled Code) at com.lendex.xml.templates.XMLTemplateObjectCreator.buildComponent(XMLTemplate ObjectCreator.java:195) any ideas??? thanks, patrick From bob at werken.com Wed Mar 13 18:57:54 2002 From: bob at werken.com (bob mcwhirter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] XPath class In-Reply-To: <3C9008FF.6A3AC7E6@acm.org> Message-ID: > And XPath gurus, please give this a test run and see how she handles. > > -jh- Will do. btw, I haven't tested Jaxen against the beta-8 candidate, but I've been trying to track CVS closely (ie, we use the Text nodes) so hopefully everything still works. ;) -bob From jhunter at acm.org Wed Mar 13 18:59:16 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] problem with detaching Attributes in JDOM Beta 8, Release Candidate #1 ??? References: <001260FC91ADD511907400D0B79EC1BF0B8A61@mail.lendx.com> Message-ID: <3C901204.A020F49A@acm.org> Please do two things. First, run without the JIT so we can see line numbers in the trace. Second, try to get this down to a reproducible test case. It's always easier to know you fixed something when you can see it break beforehand. -jh- Patrick McFarlane wrote: > > Hello, > > I'm currently using code like the following to remove an attribute from one > element and then add it to another. > > Element currCompElem...... > Element refElem = ew.getReferencedElement(); > Attribute nameAttr = currCompElem.getAttribute("name"); > nameAttr.detach(); > refElem.setAttribute(nameAttr); > > I was able to use this code in JDOM Beta 7 without error. However with JDOM > Beta 8 I get the following error... > > java.lang.ExceptionInInitializerError: org.jdom.IllegalAddException: The > attribute already has an existing parent "component" > at org.jdom.AttributeList.add(AttributeList.java, Compiled Code) > at org.jdom.AttributeList.add(AttributeList.java, Compiled Code) > at org.jdom.AttributeList.set(AttributeList.java:445) > at org.jdom.AttributeList.add(AttributeList.java, Compiled Code) > at org.jdom.Element.setAttribute(Element.java, Compiled Code) > at > com.lendex.xml.templates.XMLTemplateObjectCreator.buildComponent(XMLTemplate > ObjectCreator.java:195) > > any ideas??? > > thanks, > patrick > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From hal at idi.ntnu.no Thu Mar 14 00:17:06 2002 From: hal at idi.ntnu.no (Hallvard Tratteberg) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] XPath class In-Reply-To: <3C9008FF.6A3AC7E6@acm.org> Message-ID: Jason, > Laurent Bihanic wrote an XPath class that wraps an XPath engine (aka > Jaxen) and makes it real easy to get going with XPath. I've attached it > for comments, before I check it in. I've been using XPath with JDOM for a while and I certainly find it very convenient for navigating in a document. In my XPath wrapper I've added caching of xpath expressions, to reduce the cost of using strings constants instead of Xpath fields. The idea is to lookup an expression string and return a prebuilt Xpath in case of match, or else create, cache and return an existing one: private static Map xpaths = new Hashtable(); public static XPath makeXPath(String s) throws JDOMException { try { XPath xp = null; if (xpaths.containsKey(s)) xp = (XPath)(xpaths.get(s)); else { xp = new RhinoXPath(s); xpaths.put(s, xp); } return xp; } catch (SAXPathException ex1) { throw (new JDOMException( "Invalid XPath expression: \"" + expr + "\"", ex1)); } } public static XPath makeXPath(String s, Object args[]) throws JDOMException { return makeXPath(MessageFormat.format(s, args));} Caching xpath objects loses if many expressions are dynamically generated, e.g. to handle different predicates. This can be handled by using xpath variables, e.g. use makeXPath("/game/thing[@owner=$playerId") instead of makeXPath("/game/thing[@owner='"+playerId+"']"). This requires a function for setting xpath variables, before the xpath is used for selecting nodes. My function looks (something) like this: public void setVariable(String var, Object val) { Object o = xpath.getVariableContext(); if (o instanceof SimpleVariableContext) ((SimpleVariableContext)o).setVariableValue(null, var, val); } > We pondered a bit together about if it was better to use a separate > class for this or to add the methods on Element, Attribute, Document, etc. I like the suggestion of having a separate class in a org.jdom.xpath package. It may however be better to define an xpath interface or abstract class and put implementation specific classes in specific packages, like org.jdom.xpath.jaxen for Laurent's code. Jaxen itself does it this way to interface to dom and jdom. When speaking of extensions. I've been working with the Rhino javascript implementation and have defined classes and methods for making jdom objects look like javascript objects, manage scripts embedded in xml documents and use xpath in javascript and vica versa. I imagine this could be packaged as a contrib. Do you have any thoughts on adding an ord.jdom.scripting package? Hallvard From jhunter at acm.org Thu Mar 14 01:28:28 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] XPath class References: Message-ID: <3C906D3C.7ACE36CE@acm.org> > I like the suggestion of having a separate class in a org.jdom.xpath > package. It may however be better to define an xpath interface or abstract > class and put implementation specific classes in specific packages, like > org.jdom.xpath.jaxen for Laurent's code. Jaxen itself does it this way to > interface to dom and jdom. I've been wondering about this. It would be also possible (if we care to provide different XPath impls) to follow the JAXP model where the XPath class delegates construction to an implementation specified by a system property. The JAXP way is nice since it lets you change impls without recompiling. -jh- From hal at idi.ntnu.no Thu Mar 14 01:39:20 2002 From: hal at idi.ntnu.no (Hallvard Tratteberg) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] XPath class In-Reply-To: <3C906D3C.7ACE36CE@acm.org> Message-ID: Jason, > I've been wondering about this. It would be also possible (if we care > to provide different XPath impls) to follow the JAXP model where the > XPath class delegates construction to an implementation specified by a > system property. The JAXP way is nice since it lets you change impls > without recompiling. If the abstract XPath class has a public static makeXPath method, like the one I sent, it may easily be changed to support this. If we instead rely on using a constructor (new) we cannot do this. BTW, this is one of the most elegant things in Dylan. Instead of using a special operator and constructors, each class has a make method, which may be overridden, that may create an instance of a sub-class depending on the arguments, and possible an existing instance. Hallvard From hans.prueller at igs.at Thu Mar 14 02:07:40 2002 From: hans.prueller at igs.at (Hans =?iso-8859-1?q?Pr=FCller?=) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] JDOM and Xerces-J 2.0.1 Message-ID: hi guys, i can't bring xerces-j 2.0.1 to work with jdom but have no problems with 1.4.4 are there any jdom-sided differences between 1.4 and 2.0 ??? regards, hans From elharo at metalab.unc.edu Thu Mar 14 07:21:25 2002 From: elharo at metalab.unc.edu (Elliotte Rusty Harold) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] JDK 1.1 support In-Reply-To: <3C8D55DC.698C4DDF@acm.org> References: <3C8D55DC.698C4DDF@acm.org> Message-ID: At 5:11 PM -0800 3/11/02, Jason Hunter wrote: >While building the B8 RC, I noticed that our use of statics inside inner >classes is not supported with JDK 1.1 compilers, as shown below. I'm >wondering, do we want to fix this for B8, or just decide that we've >supported JDK 1.1 long enough? It's been this way in CVS for a couple >months and no one's complained. Who would complain if we didn't support >JDK 1.1 anymore? > Fix it. JDK 1.1 is still a fact of life in the majority of Macs and the majority of web browsers. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ From laurent.bihanic at atosorigin.com Thu Mar 14 07:47:51 2002 From: laurent.bihanic at atosorigin.com (Laurent Bihanic) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] XPath class References: Message-ID: <3C90C627.6000700@atosorigin.com> Hi, Hallvard Tratteberg wrote: > I've been using XPath with JDOM for a while and I certainly find it very > convenient for navigating in a document. In my XPath wrapper I've added > caching of xpath expressions, to reduce the cost of using strings constants > instead of Xpath fields. The idea is to lookup an expression string and > return a prebuilt Xpath in case of match, or else create, cache and return > an existing one: > The problem here is that the class we provide shall not force applications to work one way or another: Some applications needs caching, others do not. > Caching xpath objects loses if many expressions are dynamically generated, > e.g. to handle different predicates. This can be handled by using xpath > variables, e.g. use makeXPath("/game/thing[@owner=$playerId") instead of > makeXPath("/game/thing[@owner='"+playerId+"']"). This requires a function > for setting xpath variables, before the xpath is used for selecting nodes. I agree, adding a method setVariable() is a good idea. We can even go one step further and offer a method getImpl() to give access to the underlying implementation for expert Jaxen users. > I like the suggestion of having a separate class in a org.jdom.xpath > package. It may however be better to define an xpath interface or abstract > class and put implementation specific classes in specific packages, like > org.jdom.xpath.jaxen for Laurent's code. Jaxen itself does it this way to > interface to dom and jdom. > Or we could simply add a static method newInstance(String) that relies on a property to decide which (sub-)class to instanciate. This would be lighter that requiring application to first create a factory instance. Laurent From arosen at silverstream.com Thu Mar 14 08:38:28 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] problem with detaching Attributes in JDOM Beta 8, Release Candida te #1 ??? In-Reply-To: <001260FC91ADD511907400D0B79EC1BF0B8A61@mail.lendx.com> Message-ID: <002c01c1cb76$ad7f8700$6a65810a@silverstream.com> I fixed the problem in AttributeList - one of the remove() methods wasn't detaching the parent. These patches also contain a couple of very minor fixes: - In ContentList, rearranged the instanceof tests to be more in order of expected frequency (specifically I moved up the check for Text nodes higher up). May result in a tiny speedup. - Pet peeve: The argument to AttributeList.removeParent() should *always* be an Attribute, or else something's very wrong with the JDOM code; we were checking the object's type (in order to avoid the ClassCastException), but doing nothing in the error case. This is worse than not checking - it was making in fail silently. I removed the check, so now it would throw a ClassCastException. (You could also keep the check and throw a different, more helpful exception. I've never been a fan of that - this exception would indicate a serious bug in the JDOM code itself, not the use of JDOM. I don't know if it's worth the added code and string size...) Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Patrick McFarlane > Sent: Wednesday, March 13, 2002 9:40 PM > To: 'jdom-interest@jdom.org' > Subject: [jdom-interest] problem with detaching Attributes in > JDOM Beta > 8, Release Candida te #1 ??? > > > Hello, > > I'm currently using code like the following to remove an > attribute from one > element and then add it to another. > > Element currCompElem...... > Element refElem = ew.getReferencedElement(); > Attribute nameAttr = currCompElem.getAttribute("name"); > nameAttr.detach(); > refElem.setAttribute(nameAttr); > > I was able to use this code in JDOM Beta 7 without error. > However with JDOM > Beta 8 I get the following error... > > java.lang.ExceptionInInitializerError: > org.jdom.IllegalAddException: The > attribute already has an existing parent "component" > at org.jdom.AttributeList.add(AttributeList.java, > Compiled Code) > at org.jdom.AttributeList.add(AttributeList.java, > Compiled Code) > at org.jdom.AttributeList.set(AttributeList.java:445) > at org.jdom.AttributeList.add(AttributeList.java, > Compiled Code) > at org.jdom.Element.setAttribute(Element.java, Compiled Code) > at > com.lendex.xml.templates.XMLTemplateObjectCreator.buildCompone > nt(XMLTemplate > ObjectCreator.java:195) > > any ideas??? > > thanks, > patrick > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yo uraddr@yourhost.com -------------- next part -------------- A non-text attachment was scrubbed... Name: ContentList.diff Type: application/octet-stream Size: 2184 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020314/7a7ea086/ContentList.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: AttributeList.diff Type: application/octet-stream Size: 1087 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020314/7a7ea086/AttributeList.obj From pj.fanning at XIAM.com Thu Mar 14 08:48:09 2002 From: pj.fanning at XIAM.com (PJ Fanning) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] beta8 and JDK1.1 Message-ID: I've tried building a JDK1.1 version of JDOM beta8 RC1. There are problems with 3 classes. Could someone have a think about the best solution? (1) SAXHandler uses the method StringBuffer.substring(int) in flushCharacters() This method was only introduced in JDK1.2. Could we replace String data = textBuffer.substring(0); with: String data = textBuffer.toString(); (2) ContentList has a child class FilterListIterator and this has static members This is not allowed in JDK1.1. I have temporarily moved this members to the parent class. A tidier solution might be to make FilterListIterator a public class. (3) XMLOutputter has a child class Filter and this has static members Similar problem and similar solution to (2) above. Thanks, PJ From jhunter at acm.org Thu Mar 14 09:16:12 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] JDOM and Xerces-J 2.0.1 References: Message-ID: <3C90DADC.2D964B2F@acm.org> Xerces 2.0.0 worked fairly well for me in the past, with the Xerces bugs I found listed in the TODO file for future reference. Please explain what's going wrong. -jh- Hans Pr?ller wrote: > > hi guys, > > i can't bring xerces-j 2.0.1 to work with jdom but have no problems with > 1.4.4 > are there any jdom-sided differences between 1.4 and 2.0 ??? > > regards, > hans > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From hip at a.cs.okstate.edu Thu Mar 14 09:15:27 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] JDK 1.1 support In-Reply-To: Your message of "Mon, 11 Mar 2002 17:11:56 PST." <3C8D55DC.698C4DDF@acm.org> Message-ID: <200203141716.KAA12391@dorothy.denveronline.net> Just went to java.sun.com/products/jdk/1.1/download-jdk-windows.html to get a older copy of the JDK and try to fix this. I noticed Sun has declared jdk 1.1 to be in a "Sun End of Life process", with a transition period of 1/10/2001 to 10/9/2002. Is it still worth "fixing", eventhough Sun has declared it will no longer support 1.1 in 8 months? Brad Jason Hunter writes: > While building the B8 RC, I noticed that our use of statics inside inner > classes is not supported with JDK 1.1 compilers, as shown below. I'm > wondering, do we want to fix this for B8, or just decide that we've > supported JDK 1.1 long enough? It's been this way in CVS for a couple > months and no one's complained. Who would complain if we didn't support > JDK 1.1 anymore? From pj.fanning at XIAM.com Thu Mar 14 09:36:49 2002 From: pj.fanning at XIAM.com (PJ Fanning) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] RE: beta8 and JDK1.1 Message-ID: Sorry, I missed the fact that this had already been discussed. If the changes necessary to make JDOM build in JDK1.1 do not impact on performance etc., I think that they would be worthwhile to make. I did check the searchable archive for this list on servlets.com but the mails for March and for most of February have not been archived there. From arosen at silverstream.com Thu Mar 14 09:45:18 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] JDK 1.1 support In-Reply-To: <200203141716.KAA12391@dorothy.denveronline.net> Message-ID: <003401c1cb80$02436c30$6a65810a@silverstream.com> A few people have pointed out why 1.1 support still might be important for a while. If it was difficult to fix the 1.1 problems that would be one thing, but they seem pretty simple to fix, so there doesn't seem to be too great of a downside. Especially if someone who's actually using 1.1 will continue testing and submit the fixes. PJ, or anyone else using JDK 1.1, why are you still using it? Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Bradley S. Huffman > Sent: Thursday, March 14, 2002 12:15 PM > To: Jason Hunter > Cc: jdom-interest@jdom.org; hip@a.cs.okstate.edu > Subject: Re: [jdom-interest] JDK 1.1 support > > > Just went to > java.sun.com/products/jdk/1.1/download-jdk-windows.html to > get a older copy of the JDK and try to fix this. I noticed Sun has > declared jdk 1.1 to be in a "Sun End of Life process", with a > transition > period of 1/10/2001 to 10/9/2002. > > Is it still worth "fixing", eventhough Sun has declared it > will no longer > support 1.1 in 8 months? > > Brad > > Jason Hunter writes: > > > While building the B8 RC, I noticed that our use of statics > inside inner > > classes is not supported with JDK 1.1 compilers, as shown > below. I'm > > wondering, do we want to fix this for B8, or just decide that we've > > supported JDK 1.1 long enough? It's been this way in CVS > for a couple > > months and no one's complained. Who would complain if we > didn't support > > JDK 1.1 anymore? > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yo > uraddr@yourhost.com From arosen at silverstream.com Thu Mar 14 09:53:24 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] beta8 and JDK1.1 In-Reply-To: Message-ID: <003501c1cb81$23e64dc0$6a65810a@silverstream.com> All those changes seem fine to me. Are private statics allowed in inner classes in 1.1? If so that might be an even better solution. Brad, any reason that all the member variables in FilterListIterator are package visibility, instead of private? PJ, if you sent in a patch, that might help convince the powers that be that continuing 1.1 support would be easy :) Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of PJ Fanning > Sent: Thursday, March 14, 2002 11:48 AM > To: 'jdom-interest@jdom.org' > Subject: [jdom-interest] beta8 and JDK1.1 > > > I've tried building a JDK1.1 version of JDOM beta8 RC1. There > are problems > with 3 classes. Could someone have a think about the best solution? > > (1) SAXHandler uses the method StringBuffer.substring(int) in > flushCharacters() > This method was only introduced in JDK1.2. > Could we replace > String data = textBuffer.substring(0); > with: > String data = textBuffer.toString(); > > (2) ContentList has a child class FilterListIterator and this > has static > members > This is not allowed in JDK1.1. > I have temporarily moved this members to the parent class. A > tidier solution > might be to make FilterListIterator a public class. > > (3) XMLOutputter has a child class Filter and this has static members > Similar problem and similar solution to (2) above. > > Thanks, > PJ > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yo > uraddr@yourhost.com From j.feng at us.nature.com Thu Mar 14 10:01:25 2002 From: j.feng at us.nature.com (Jun) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] build file on network drive Message-ID: I got this exception message when trying to run SAXBuilder.build(File file): JDOM Exception cause: sun.net.ftp.FtpLoginException: Not logged in Error in building: Not logged in where file is on a different station, file.exists() and file.canWrite() both return true, I am running JDK 1.4, can anyone help? Thanks; Jun -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020314/599fef9b/attachment.htm From Morten.Vinje at adnovum.ch Thu Mar 14 11:14:42 2002 From: Morten.Vinje at adnovum.ch (Morten Vinje) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] xerces and xalan version in beta8rc1 Message-ID: <3C90F6A2.F2952F9A@adnovum.ch> Hi all First, Thank you all for this release candidate. It looks very promising. Short question: Which versions of xalan.jar and xerces.jar do this rc1 ship with? The xalan.readme said something about 1.3p, but isn't 1.3 for C++ ? I think the xerces version is 1.4.4, but I am not sure. Such information could maybe be posted on the jdom web site. The apache projects as crimson, xalan, xerces etc. all give information on which standards and APIs they support on their web pages. Please help. Thanks Morten - +---------------------------------------------------------------------+ Mr. Morten Vinje mailto:Morten.Vinje@adnovum.ch AdNovum Informatik AG http://www.adnovum.ch phone: +41 (1) 272 6111 Roentgenstrasse 22, CH-8005 Zuerich fax: +41 (1) 272 6312 +---------------------------------------------------------------------+ AdNovum Software Inc. San Mateo, CA 94404 phone: +1 (650) 525 9322 1400 Fashion Island Boulevard, Suite 309 fax: +1 (650) 525 9324 +---------------------------------------------------------------------+ From dmkarr at earthlink.net Thu Mar 14 11:52:03 2002 From: dmkarr at earthlink.net (David M. Karr) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Tranforming   into hatted A Message-ID: <86sn73apwc.fsf@earthlink.net> I did go over the XSLT FAQ about special characters, but I didn't see anything obviously covering this. I'm trying to figure out how to generate a " " element in my HTML output. Unfortunately, it only produces a capital "hatted A". I also tried an explicit " ", but that did the same thing. I tried to trick it with "&nbsp;", but the result was uninspiring, being exactly "&nbsp;". What exactly is happening here? -- =================================================================== David M. Karr ; Java/J2EE/XML/Unix/C++ dmkarr@earthlink.net From hip at a.cs.okstate.edu Thu Mar 14 12:14:58 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Patch for JDK1.1 Message-ID: <200203142015.NAA17624@dorothy.denveronline.net> Sigh, had to give up StringBuffer.substring :( This patch compiles under JDK1.1 and 1.2, and runs under 1.2. If someone could test that it also runs under 1.1 that would be great. Brad ==================== Cut Here ==================== Common subdirectories: jdom/src and jdom-new/src Common subdirectories: jdom/src/java and jdom-new/src/java Common subdirectories: jdom/src/java/META-INF and jdom-new/src/java/META-INF Common subdirectories: jdom/src/java/org and jdom-new/src/java/org Common subdirectories: jdom/src/java/org/jdom and jdom-new/src/java/org/jdom diff -c -r jdom/src/java/org/jdom/ContentList.java jdom-new/src/java/org/jdom/ContentList.java *** jdom/src/java/org/jdom/ContentList.java Tue Mar 12 21:57:41 2002 --- jdom-new/src/java/org/jdom/ContentList.java Thu Mar 14 13:33:00 2002 *************** *** 87,92 **** --- 87,106 ---- private static final int INITIAL_ARRAY_SIZE = 5; + /** + * Used inner class FilterListIterator to help hasNext and + * hasPrevious the next index of our cursor (must be here + * for JDK1.1). + */ + private static final int CREATE = 0; + private static final int HASPREV = 1; + private static final int HASNEXT = 2; + private static final int PREV = 3; + private static final int NEXT = 4; + private static final int ADD = 5; + private static final int REMOVE = 6; + private static final int SET = 7; + /** Our backing list */ protected ArrayList list; *************** *** 890,908 **** class FilterListIterator implements ListIterator { - /** - * Used to help hasNext and hasPrevious the next - * index of our cursor - */ - static final int CREATE = 0; - static final int HASPREV = 1; - static final int HASNEXT = 2; - static final int PREV = 3; - static final int NEXT = 4; - static final int ADD = 5; - static final int REMOVE = 6; - static final int SET = 7; - /** The Filter that applies */ Filter filter; --- 904,909 ---- Common subdirectories: jdom/src/java/org/jdom/adapters and jdom-new/src/java/org/jdom/adapters Common subdirectories: jdom/src/java/org/jdom/filter and jdom-new/src/java/org/jdom/filter Common subdirectories: jdom/src/java/org/jdom/input and jdom-new/src/java/org/jdom/input Common subdirectories: jdom/src/java/org/jdom/output and jdom-new/src/java/org/jdom/output Common subdirectories: jdom/src/java/org/jdom/test and jdom-new/src/java/org/jdom/test Common subdirectories: jdom/src/java/org/jdom/transform and jdom-new/src/java/org/jdom/transform diff -c -r jdom/src/java/org/jdom/input/SAXHandler.java jdom-new/src/java/org/jdom/input/SAXHandler.java *** jdom/src/java/org/jdom/input/SAXHandler.java Thu Mar 7 12:48:47 2002 --- jdom-new/src/java/org/jdom/input/SAXHandler.java Thu Mar 14 13:46:34 2002 *************** *** 714,720 **** --- 714,724 ---- return; } + /* + * Note: When we stop supporting JDK1.1, use substring instead String data = textBuffer.substring(0); + */ + String data = textBuffer.toString(); textBuffer.setLength(0); /** diff -c -r jdom/src/java/org/jdom/output/XMLOutputter.java jdom-new/src/java/org/jdom/output/XMLOutputter.java *** jdom/src/java/org/jdom/output/XMLOutputter.java Tue Feb 19 00:46:03 2002 --- jdom-new/src/java/org/jdom/output/XMLOutputter.java Thu Mar 14 13:37:36 2002 *************** *** 214,226 **** * - default is false */ private boolean omitEncoding = false; ! class Format implements Cloneable { ! /** standard value to indent by, if we are indenting */ ! static final String STANDARD_INDENT = " "; ! /** standard string with which to end a line */ ! static final String STANDARD_LINE_SEPARATOR = "\r\n"; /** The default indent is no spaces (as original document) */ String indent = null; --- 214,227 ---- * - default is false */ private boolean omitEncoding = false; ! /** standard value to indent by, if we are indenting */ ! private static final String STANDARD_INDENT = " "; ! /** standard string with which to end a line */ ! private static final String STANDARD_LINE_SEPARATOR = "\r\n"; + class Format implements Cloneable { + /** The default indent is no spaces (as original document) */ String indent = null; *************** *** 527,533 **** */ public void setIndent(boolean doIndent) { if (doIndent) { ! defaultFormat.indent = Format.STANDARD_INDENT; } else { defaultFormat.indent = null; --- 528,534 ---- */ public void setIndent(boolean doIndent) { if (doIndent) { ! defaultFormat.indent = STANDARD_INDENT; } else { defaultFormat.indent = null; From hip at a.cs.okstate.edu Thu Mar 14 12:17:51 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Upgrade JUnit? Message-ID: <200203142017.NAA18080@dorothy.denveronline.net> Should we think about upgading to the lastest version of JUnit in jdom-test? I know they changed assert to assertTrue for SDK1.4. Brad From jhunter at acm.org Thu Mar 14 13:21:43 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] xerces and xalan version in beta8rc1 References: <3C90F6A2.F2952F9A@adnovum.ch> Message-ID: <3C911467.D4B8113A@acm.org> > Short question: > Which versions of xalan.jar and xerces.jar do this rc1 ship with? > > The xalan.readme said something about 1.3p, but isn't 1.3 for C++ ? No, it's the one that came with the JAXP RI. > I think the xerces version is 1.4.4, but I am not sure. Yes, it is, and I added that note to the xerces.readme. -jh- From jhunter at acm.org Thu Mar 14 13:40:15 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Patch for JDK1.1 References: <200203142015.NAA17624@dorothy.denveronline.net> Message-ID: <3C9118BF.B2E0521B@acm.org> Checked it in. It'd be good if someone using JDK 1.1 would give it a spin. -jh- "Bradley S. Huffman" wrote: > > Sigh, had to give up StringBuffer.substring :( This patch compiles under > JDK1.1 and 1.2, and runs under 1.2. If someone could test that it also > runs under 1.1 that would be great. > > Brad > > ==================== Cut Here ==================== > Common subdirectories: jdom/src and jdom-new/src > Common subdirectories: jdom/src/java and jdom-new/src/java > Common subdirectories: jdom/src/java/META-INF and jdom-new/src/java/META-INF > Common subdirectories: jdom/src/java/org and jdom-new/src/java/org > Common subdirectories: jdom/src/java/org/jdom and jdom-new/src/java/org/jdom > diff -c -r jdom/src/java/org/jdom/ContentList.java jdom-new/src/java/org/jdom/ContentList.java > *** jdom/src/java/org/jdom/ContentList.java Tue Mar 12 21:57:41 2002 > --- jdom-new/src/java/org/jdom/ContentList.java Thu Mar 14 13:33:00 2002 > *************** > *** 87,92 **** > --- 87,106 ---- > > private static final int INITIAL_ARRAY_SIZE = 5; > > + /** > + * Used inner class FilterListIterator to help hasNext and > + * hasPrevious the next index of our cursor (must be here > + * for JDK1.1). > + */ > + private static final int CREATE = 0; > + private static final int HASPREV = 1; > + private static final int HASNEXT = 2; > + private static final int PREV = 3; > + private static final int NEXT = 4; > + private static final int ADD = 5; > + private static final int REMOVE = 6; > + private static final int SET = 7; > + > /** Our backing list */ > protected ArrayList list; > > *************** > *** 890,908 **** > > class FilterListIterator implements ListIterator { > > - /** > - * Used to help hasNext and hasPrevious the next > - * index of our cursor > - */ > - static final int CREATE = 0; > - static final int HASPREV = 1; > - static final int HASNEXT = 2; > - static final int PREV = 3; > - static final int NEXT = 4; > - static final int ADD = 5; > - static final int REMOVE = 6; > - static final int SET = 7; > - > /** The Filter that applies */ > Filter filter; > > --- 904,909 ---- > Common subdirectories: jdom/src/java/org/jdom/adapters and jdom-new/src/java/org/jdom/adapters > Common subdirectories: jdom/src/java/org/jdom/filter and jdom-new/src/java/org/jdom/filter > Common subdirectories: jdom/src/java/org/jdom/input and jdom-new/src/java/org/jdom/input > Common subdirectories: jdom/src/java/org/jdom/output and jdom-new/src/java/org/jdom/output > Common subdirectories: jdom/src/java/org/jdom/test and jdom-new/src/java/org/jdom/test > Common subdirectories: jdom/src/java/org/jdom/transform and jdom-new/src/java/org/jdom/transform > diff -c -r jdom/src/java/org/jdom/input/SAXHandler.java jdom-new/src/java/org/jdom/input/SAXHandler.java > *** jdom/src/java/org/jdom/input/SAXHandler.java Thu Mar 7 12:48:47 2002 > --- jdom-new/src/java/org/jdom/input/SAXHandler.java Thu Mar 14 13:46:34 2002 > *************** > *** 714,720 **** > --- 714,724 ---- > return; > } > > + /* > + * Note: When we stop supporting JDK1.1, use substring instead > String data = textBuffer.substring(0); > + */ > + String data = textBuffer.toString(); > textBuffer.setLength(0); > > /** > diff -c -r jdom/src/java/org/jdom/output/XMLOutputter.java jdom-new/src/java/org/jdom/output/XMLOutputter.java > *** jdom/src/java/org/jdom/output/XMLOutputter.java Tue Feb 19 00:46:03 2002 > --- jdom-new/src/java/org/jdom/output/XMLOutputter.java Thu Mar 14 13:37:36 2002 > *************** > *** 214,226 **** > * - default is false */ > private boolean omitEncoding = false; > > ! class Format implements Cloneable { > ! /** standard value to indent by, if we are indenting */ > ! static final String STANDARD_INDENT = " "; > > ! /** standard string with which to end a line */ > ! static final String STANDARD_LINE_SEPARATOR = "\r\n"; > > /** The default indent is no spaces (as original document) */ > String indent = null; > > --- 214,227 ---- > * - default is false */ > private boolean omitEncoding = false; > > ! /** standard value to indent by, if we are indenting */ > ! private static final String STANDARD_INDENT = " "; > > ! /** standard string with which to end a line */ > ! private static final String STANDARD_LINE_SEPARATOR = "\r\n"; > > + class Format implements Cloneable { > + > /** The default indent is no spaces (as original document) */ > String indent = null; > > *************** > *** 527,533 **** > */ > public void setIndent(boolean doIndent) { > if (doIndent) { > ! defaultFormat.indent = Format.STANDARD_INDENT; > } > else { > defaultFormat.indent = null; > --- 528,534 ---- > */ > public void setIndent(boolean doIndent) { > if (doIndent) { > ! defaultFormat.indent = STANDARD_INDENT; > } > else { > defaultFormat.indent = null; > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From noamt at yahoo.com Thu Mar 14 14:15:23 2002 From: noamt at yahoo.com (Noam Tamim) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Re: [jdom-commits] CVS update: jdom/src/java/org/jdom In-Reply-To: <20020315053648.C08911D801D@jools.org> Message-ID: <20020314221523.19767.qmail@web13902.mail.yahoo.com> --- cvs@jools.org wrote: > Patch from Brad Huffman providing JDK 1.1 support again. Had to > make the static vars of the inner classes private, and couldn't > use StringBuffer.substring(0) anymore. > Checking in so it's easier for people using 1.1 to verify. Does anyone actually use 1.1? Why? ===== Noam. __________________________________________________ Do You Yahoo!? Yahoo! Sports - live college hoops coverage http://sports.yahoo.com/ From jhunter at acm.org Thu Mar 14 14:43:08 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Re: [jdom-commits] CVS update: jdom/src/java/org/jdom References: <20020314221523.19767.qmail@web13902.mail.yahoo.com> Message-ID: <3C91277C.F5CDE128@acm.org> Noam Tamim wrote: > > --- cvs@jools.org wrote: > > Patch from Brad Huffman providing JDK 1.1 support again. Had to > > make the static vars of the inner classes private, and couldn't > > use StringBuffer.substring(0) anymore. > > Checking in so it's easier for people using 1.1 to verify. > > Does anyone actually use 1.1? Why? That's the very topic that was discussed on this list today and yesterday! -jh- From jhunter at acm.org Thu Mar 14 17:06:07 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Standalone attribute in Message-ID: <3C9148FE.49C6CCE1@acm.org> The last time we discussed what to do about standalone we punted and decided to let people override printDeclaration(). I think the complicating situation was that the standalone flag is partly an attribute of the document and partly something to do with the outputter, and we didn't like having it tied to either. I'm not saying we can't add it, but it's non-obvious how best to add it. -jh- Alex Rosen wrote: > > The standalone attribute is not currently supported by XMLOutputter, but it > could easily be added, and for completeness it seems like it should be. > You'd have to allow it to be "yes" or "no" or absent altogether, so maybe > setStandaloneValue(String) would be the simplest API. > > It is tempting to make the XML declaration a PI, but I don't think it's the > right thing to do. The spec defines it as not being a PI, and when parsing > it's not passed along as a PI. If you added it to your document as a PI to > control the XML delcaration, then the document that you read back in > afterwards would be different from the one you emitted (because this special > PI would no longer be there). > > Alex > > > -----Original Message----- > > From: jdom-interest-admin@jdom.org > > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Christian Holmqvist, > > IT, Posten > > Sent: Friday, March 08, 2002 3:27 AM > > To: Jdom-Interest (E-mail) > > Subject: [jdom-interest] Standalone attribute in > > > > > Hi! > > > > I'm rather new to XML so bare with me if I don't have all the exactly > > correct terms and expressions going on yet... *smile* > > > > How to I add the standalone attribute to the > ProcessInstruction (or > > more exactly xml file first line) or how do I change it from > > YES to NO and > > the other way around? > > > > I have been looking throgh the archive and seen some discussions about > > putting the control of this (together with encoding) in the > > XMLOutPutter > > thingy. The thing is that I can not see the different between this > > ProcessIntruction and other PIs (oki, parsing and well form > > ness is hard to > > do without it...). Why not let > can be changed, > > removed and added. If it is missed when trying to pass it to > > a parser the > > parser WILL complain with some form of error msg... > > > > Hmm oki, thank you for your time! > > > > /Christian > > _______________________________________________ > > To control your jdom-interest membership: > > http://lists.denveronline.net/mailman/options/jdom-interest/yo > > uraddr@yourhost.com > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From jhunter at acm.org Thu Mar 14 17:13:00 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Re: [Fwd: JDOM ?] References: <016801c1c9eb$e1851f60$0a0a0a0a@REPLICANT> Message-ID: <3C914A9C.2C2A1B6F@acm.org> If parsers aren't 100% reusable (as in after an exception) then SAXBuilder is wise to recreate them. It makes SAXBuilder reusable even if the parser isn't. I suspect the time to build a parser only matters if you're doing many super-small documents. That's probably going to be common with SOAP and such, so this is something to watch. Kim, perhaps you want to run some tests on how long it takes to setup parsers. Just use a no-op content handler. -jh- Joseph Bowbeer wrote: > > "Once this method is invoked, the parser instance is of no further use, and > should NOT be reused." > > Should we say the same about SAXBuilder's build method? > > In my experience with some older parsers, the parsers are not reusable after > they've thrown an exception -- even if they are reusable normally. > > Perhaps we can say one SAXBuilder == one parser and leave it to the re-user > to throw-away the SAXBuilder if an error is encountered. > > (To be safe, and to keep the memory footprint low, I create a new SAXBuilder > for every document.) > > --- original message --- > > From: Alex Rosen arosen@silverstream.com > Date: Tue, 12 Mar 2002 10:39:47 -0500 > > If we're sure that all parser support being reused (or are supposed to > support it), then it does seem like a good idea. Doing a quick search, I > found that the original (i.e. very old) IBM4J parser says this about its > parsing methods: "Once this method is invoked, the parser instance is of no > further use, and should NOT be reused." I don't know about newer parsers. > The JAXP spec doesn't say one way or the other... > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From jhunter at acm.org Thu Mar 14 17:27:42 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] RE: beta8 and JDK1.1 References: Message-ID: <3C914E0E.D35EA830@acm.org> > I did check the searchable archive for this list on servlets.com but the > mails for March and for most of February have not been archived there. Somehow the archive user got unsubscribed (too many bounces?). I resubscribed the user, and it's archiving again. Thanks for the note. -jh- From jhunter at acm.org Thu Mar 14 20:03:30 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Need help (filters) on SAXHandler ... References: <3C87A2B2.8970EE10@digitalanywhere.com> <3C87AE55.548CC804@digitalanywhere.com> Message-ID: <3C917292.27C67D2@acm.org> Well, there's a protected createContentHandler() which you can override. -jh- Jon Baer wrote: > > Just a quick follow up question I forgot in my last email ... > > Why isn't there a setContentHandler method for setting say saxContentHandler in the > SAXBuilder? Under build(InputSource in) it always makes the assumption that you are > using that specific handler no matter what yet every other part can be configured. > Im trying to determine if I can still use SAXBuilder by just creating a > setElementHandler() to it and just use a modified SAXHandler. > > (Am I just not reading into the XMLFilter feature enough?) > > - Jon > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From jhunter at acm.org Thu Mar 14 20:08:33 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] performance on tonights CVS References: <3C78B59D.7090206@lse.com> Message-ID: <3C9173C1.30FCA63F@acm.org> > However, something in the way SAX is being used has impacted my Builder. > build performance which has slipped some 40% in the wrong direction. > I have not profiled it yet, but was wanting to know if anyone has a > quick explaination or suggestion on how to get it back up to beta 7 > build speeds. Seems the most substantial cause for a slowdown is the addition of the Verifier checking every character now to ensure it's legal. That's something I had held off including, but it snuck in along with the Text class. It's correct to do, but there's a substantial performance price. I've been brainstorming with Brad about how to work around this so there's no verification when using a parser. Sadly with the package breakout it's not easy. It wasn't easy a year ago when we first faced this. Ideas are most welcome, but if nothing surfaces I'm tempted to remove that verification check. For the price, I think it provides minimal benefit. There may be other performance changes also. Sometimes it's the funniest little thing that can slow you down. -jh- From philip.nelson at omniresources.com Thu Mar 14 21:03:39 2002 From: philip.nelson at omniresources.com (philip.nelson@omniresources.com) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Upgrade JUnit? Message-ID: > > Should we think about upgading to the lastest version of > JUnit in jdom-test? I know they changed assert to assertTrue > for SDK1.4. I updated the tests to work with Junit 3.7. Should we also include the latest ant, optional ant tasks and Xalan2 (for the nicely formated html test output)? Also, we should remove the stub for testXMLOuputter. I put it in originally because Alex Chaffee was going to do some work but since he disappeared, we should remove it so all the tests pass. From philip.nelson at omniresources.com Thu Mar 14 21:08:49 2002 From: philip.nelson at omniresources.com (philip.nelson@omniresources.com) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] performance on tonights CVS Message-ID: > Seems the most substantial cause for a slowdown is the > addition of the Verifier checking every character now to > ensure it's legal. That's something I had held off > including, but it snuck in along with the Text class. It's > correct to do, but there's a substantial performance price. Get rid of the test. Perhaps leave it commented out and put a comment in the method so somebody could rebuild it with the check in, but I'll bet it doesn't happen too often. Out project goals were lighter, faster with an easier but still with a correct api. These goals are not totally compatible it would seem but I think the lighter, faster and easier is more important for most of us. From philip.nelson at omniresources.com Thu Mar 14 21:13:35 2002 From: philip.nelson at omniresources.com (philip.nelson@omniresources.com) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Re: [Fwd: JDOM ?] Message-ID: > If parsers aren't 100% reusable (as in after an exception) > then SAXBuilder is wise to recreate them. It makes > SAXBuilder reusable even if the parser isn't. > > I suspect the time to build a parser only matters if you're > doing many super-small documents. That's probably going to > be common with SOAP and such, so this is something to watch. Saxbuilder is a pretty general way to build the xml reader and is optimized for reliability and features over performance. I agree that we have targeted cases that really don't resemble soap. I also think that a cut and paste of the create method tailored for your specific parser gives you the most flexibility if you are tweaking cycles like that. And really, there's not much to it. From bob at werken.com Thu Mar 14 21:20:30 2002 From: bob at werken.com (bob mcwhirter) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Re: [Fwd: JDOM ?] In-Reply-To: <3C914A9C.2C2A1B6F@acm.org> Message-ID: On Thu, 14 Mar 2002, Jason Hunter wrote: > I suspect the time to build a parser only matters if you're doing many > super-small documents. That's probably going to be common with SOAP and > such, so this is something to watch. I might argue differently. In my current project[0], I'm using small, medium and fairly large documents. The trick is, at any given point in time, there's probably a many document in-flight between a few dozen computers. I think that there's an argument that in many 'enterprise' grade applications, a significant number of documents, regardless of average size, are being processed. > Kim, perhaps you want to run some tests on how long it takes to setup > parsers. Just use a no-op content handler. I'd be interested in knowing this also. I think something like Aelfred probably sets up a lot quicker than, say, Xerces. -bob [0] large-scale computational clusters (no, *not* grids). From hip at a.cs.okstate.edu Thu Mar 14 22:36:29 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Upgrade JUnit? In-Reply-To: Your message of "Thu, 14 Mar 2002 23:03:39 CST." Message-ID: <200203150636.XAA12451@dorothy.denveronline.net> philip.nelson@omniresources.com writes: > I updated the tests to work with Junit 3.7. Should we change our tests to use assertTrue for JDK1.4? The Junit 3.7 readme says assert is a new java keyword in 1.4. > Also, we should remove the stub for testXMLOuputter. I put it in > originally because Alex Chaffee was going to do some work but since he > disappeared, we should remove it so all the tests pass. I have no plans to touch it. Brad From hans.prueller at igs.at Thu Mar 14 23:45:40 2002 From: hans.prueller at igs.at (Hans =?iso-8859-1?q?Pr=FCller?=) Date: Fri Aug 6 17:07:28 2004 Subject: Antwort: Re: [jdom-interest] JDOM and Xerces-J 2.0.1 Message-ID: I had a problem validating xml docs against schemas, but luckily it was a problem with xerces and NOT jdom itself and I could solve it yesterday browsing the xerces site.... I also upgraded from jdom-b7 to b8 yesterday and it just went FINE !!! thanks, hans Jason Hunter An: Hans Pr?ller Gesendet von: Kopie: jdom-interest@jdom.org jdom-interest-admi Thema: Re: [jdom-interest] JDOM and Xerces-J 2.0.1 n@jdom.org 14.03.2002 18:16 Xerces 2.0.0 worked fairly well for me in the past, with the Xerces bugs I found listed in the TODO file for future reference. Please explain what's going wrong. -jh- Hans Pr?ller wrote: > > hi guys, > > i can't bring xerces-j 2.0.1 to work with jdom but have no problems with > 1.4.4 > are there any jdom-sided differences between 1.4 and 2.0 ??? > > regards, > hans > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com ____________________________________________________ IGS Systemmanagement GmbH & Co KG Dorfplatz 5 A-4531 Piberbach phone: +43 7228 6451 0 home: http://www.igs.at fax: +43 7228 6451 30 eMail: igs@igs.at hotline: fax: +43 7228 6451 20 eMail: hotline@igs.at ____________________________________________________ NEWSFLASH___________________________________________ DKC Dokumentation ab sofort unter www.igs.at im Downloadbereich verf?gbar Anlagenmanagement ab sofort verf?gbar Reservieren Sie sich Ihren pers?nlichen Demotermin unter: igs@igs.at NEWSFLASH___________________________________________ From christian.holmqvist at posten.se Fri Mar 15 00:15:04 2002 From: christian.holmqvist at posten.se (Christian Holmqvist, IT, Posten) Date: Fri Aug 6 17:07:28 2004 Subject: SV: [jdom-interest] Standalone attribute in Hi I have been searching the archive but found very little information about this topic (I think the information stoped with the discussion about adding a set/get standalone method) so if I ask questions that has been asked before, excuse me. I would prefer that the -----Ursprungligt meddelande----- > Fr?n: Jason Hunter [mailto:jhunter@acm.org] > Skickat: den 15 mars 2002 02:06 > Till: Alex Rosen > Kopia: 'Christian Holmqvist, IT, Posten'; 'Jdom-Interest (E-mail)' > ?mne: Re: [jdom-interest] Standalone attribute in > > The last time we discussed what to do about standalone we punted and > decided to let people override printDeclaration(). I think the > complicating situation was that the standalone flag is partly an > attribute of the document and partly something to do with the > outputter, > and we didn't like having it tied to either. I'm not saying we can't > add it, but it's non-obvious how best to add it. > > -jh- > > Alex Rosen wrote: > > > > The standalone attribute is not currently supported by > XMLOutputter, but it > > could easily be added, and for completeness it seems like > it should be. > > You'd have to allow it to be "yes" or "no" or absent > altogether, so maybe > > setStandaloneValue(String) would be the simplest API. > > > > It is tempting to make the XML declaration a PI, but I > don't think it's the > > right thing to do. The spec defines it as not being a PI, > and when parsing > > it's not passed along as a PI. If you added it to your > document as a PI to > > control the XML delcaration, then the document that you read back in > > afterwards would be different from the one you emitted > (because this special > > PI would no longer be there). > > > > Alex > > > > > -----Original Message----- > > > From: jdom-interest-admin@jdom.org > > > [mailto:jdom-interest-admin@jdom.org]On Behalf Of > Christian Holmqvist, > > > IT, Posten > > > Sent: Friday, March 08, 2002 3:27 AM > > > To: Jdom-Interest (E-mail) > > > Subject: [jdom-interest] Standalone attribute in > > > > > > > > Hi! > > > > > > I'm rather new to XML so bare with me if I don't have all > the exactly > > > correct terms and expressions going on yet... *smile* > > > > > > How to I add the standalone attribute to the > > ProcessInstruction (or > > > more exactly xml file first line) or how do I change it from > > > YES to NO and > > > the other way around? > > > > > > I have been looking throgh the archive and seen some > discussions about > > > putting the control of this (together with encoding) in the > > > XMLOutPutter > > > thingy. The thing is that I can not see the different between this > > > ProcessIntruction and other PIs (oki, parsing and well form > > > ness is hard to > > > do without it...). Why not let > > can be changed, > > > removed and added. If it is missed when trying to pass it to > > > a parser the > > > parser WILL complain with some form of error msg... > > > > > > Hmm oki, thank you for your time! > > > > > > /Christian > > > _______________________________________________ > > > To control your jdom-interest membership: > > > http://lists.denveronline.net/mailman/options/jdom-interest/yo > > > uraddr@yourhost.com > > > > _______________________________________________ > > To control your jdom-interest membership: > > > http://lists.denveronline.net/mailman/options/jdom-interest/yo uraddr@yourhost.com From philip.nelson at omniresources.com Fri Mar 15 05:15:16 2002 From: philip.nelson at omniresources.com (philip.nelson@omniresources.com) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Upgrade JUnit? Message-ID: > Should we change our tests to use assertTrue for JDK1.4? The Junit 3.7 > readme > says assert is a new java keyword in 1.4. I changed them all last night. I haven't actually checked anything in since the cvs change but if my password is still good, I can do it tonight. From elharo at metalab.unc.edu Fri Mar 15 05:23:33 2002 From: elharo at metalab.unc.edu (Elliotte Rusty Harold) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] performance on tonights CVS In-Reply-To: <3C9173C1.30FCA63F@acm.org> References: <3C78B59D.7090206@lse.com> <3C9173C1.30FCA63F@acm.org> Message-ID: >I've been brainstorming with Brad about how to work around this so >there's no verification when using a parser. Sadly with the package >breakout it's not easy. It wasn't easy a year ago when we first faced >this. > Would it be possible to make a package protected non-verifying subclass of Text in org.jdom.input that could be used by SAXBuilder, etc? To everything outside the org.jdom.input package this would just be a Text object. Is it possible to subclass a public class with a non-public class? Even if it has to be public, such a class still might make sense. Also, keep in mind that not all parsers make all the checks they're supposed to. For instance, AElfred will not catch some illegal characters in names. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ From hip at a.cs.okstate.edu Fri Mar 15 07:13:10 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] performance on tonights CVS In-Reply-To: Your message of "Fri, 15 Mar 2002 08:23:33 EST." Message-ID: <200203151513.IAA03262@dorothy.denveronline.net> > > >I've been brainstorming with Brad about how to work around this so > >there's no verification when using a parser. Sadly with the package > >breakout it's not easy. It wasn't easy a year ago when we first faced > >this. > > > > Would it be possible to make a package protected non-verifying > subclass of Text in org.jdom.input that could be used by SAXBuilder, > etc? To everything outside the org.jdom.input package this would just > be a Text object. Is it possible to subclass a public class with a > non-public class? Even if it has to be public, such a class still > might make sense. Similar to what dom4j does with Abstract*, Flywieght*, and Default* versions of it's classes. In this situation I think it would be helpful to have the factory implementation in the same package as the classes it creates. I did a little checking last night and I don't think the checks are the culpit. It's one pass over a char array, and as it was pointed out to me, Verifier.checkCharacterData should succeed on the 1st "if" for most characters. Creating Text instances is probably the biggest slowdown between the two versions. One thing that would be good to check is build a document in memory and time it. The idea being to determine if it's org.jdom.* classes that eat up the time or if it's something in SAXBuilder/SAXHandler. It will most likely be a combination of factors. All in all though, we should be have build times on par with dom4j since our implementations are so simialer. Brad From philip.nelson at omniresources.com Fri Mar 15 07:21:50 2002 From: philip.nelson at omniresources.com (philip.nelson@omniresources.com) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] performance on tonights CVS Message-ID: >Would it be possible to make a package protected non-verifying >subclass of Text in org.jdom.input that could be used by SAXBuilder, >etc? To everything outside the org.jdom.input package this would just >be a Text object. Is it possible to subclass a public class with a >non-public class? Even if it has to be public, such a class still >might make sense. Wouldn't the end result be that any document created by saxbuilder would never verify the characters? To me it would make more sense for the Text class to have a publicly available boolean property, verifyCharacters. The JDOM factory could set it to false accomplishing the same thing a subclass would, for better or worse. Almost no code I have been involved with even has the possibility of inserting bad characters, and having no way to turn off verification would be a serious flaw IMHO. From Theo_Harper at systemsunion.com Fri Mar 15 09:29:59 2002 From: Theo_Harper at systemsunion.com (Theo Harper) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Problems with JDOM Beta 8 RC1 Message-ID: Hi, I am having a problem serializing org.jdom.Element with the latest release, if you try the following code the size returned from the deserialised element is incorrect. This problem did not occur with Beta 7. import org.jdom.input.SAXBuilder; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; import java.io.*; import java.util.List; public class Test { public static void main(String[] args) { try { SAXBuilder builder = new SAXBuilder(); Document document = builder.build(new StringReader("")); Element root = document.getRootElement(); File f = File.createTempFile("tmp", "tmp"); List children = root.getChildren("child"); System.out.println("Constructed size=" + children.size()); System.out.println("Constructed element=" + ((Element)children.get(0)).getName()); ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(f)); objectOutputStream.writeObject(root); objectOutputStream.close(); ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream(f)); Element readRoot = (Element)objectInputStream.readObject(); objectInputStream.close(); children = readRoot.getChildren("child"); System.out.println("Serialized size=" + children.size()); System.out.println("Serialized element=" + ((Element)children.get(0)).getName()); } catch (Exception e) { e.printStackTrace(); } } } Thanks, Theo From arosen at silverstream.com Fri Mar 15 10:26:49 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] performance on tonights CVS In-Reply-To: <3C9173C1.30FCA63F@acm.org> Message-ID: <009301c1cc4e$f9caafd0$6a65810a@silverstream.com> > Ideas are most welcome, but if nothing surfaces I'm tempted to remove > that verification check. For the price, I think it provides minimal > benefit. Amen! The requirement that it be impossible to build a non-well-formed document always seemed... overly nice, to me. It's great to help developers out by catching errors for them when it's cheap, but not when it's expensive. It's not fair that you have to pay the price, even if your code does the right thing. What if we didn't call the Verifier anywhere, but we added checkElement() and checkDocument() to it? That way a developer could optionally check their document, after they created it in-memory. If you're parsing a file (using a parser that does the proper checks), or if you're building a document in-memory but can guarantee that you're only adding legal values (e.g. if all the data you added were integers), then you wouldn't have to pay the price. We could move all non-free checks there, such as AttributeList's checks for duplicate attributes. (Maybe that's cheap enough to leave as-is, dunno.) Alex From arosen at silverstream.com Fri Mar 15 10:35:50 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:28 2004 Subject: [jdom-interest] Re: [Fwd: JDOM ?] In-Reply-To: <3C914A9C.2C2A1B6F@acm.org> Message-ID: <009501c1cc50$3bda0b40$6a65810a@silverstream.com> I like Joe's idea, leave it up to the user to decide the policy. I can certainly imagine a parser that takes a long time to set up. I think that if the spec says that they're supposed to be reusable, we should allow people to easily reuse them, if they choose. If current ones are in fact always reusable, then everything's good. If they aren't reusable after an exception, then the user can throw away the SAXBuilder after an exception. Either way, it's not our fault. It would be our fault if a parser were reusable and we didn't let the user (easily) reuse it. Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Jason Hunter > Sent: Thursday, March 14, 2002 8:13 PM > To: Joseph Bowbeer > Cc: jdom-interest@jdom.org > Subject: Re: [jdom-interest] Re: [Fwd: JDOM ?] > > > If parsers aren't 100% reusable (as in after an exception) then > SAXBuilder is wise to recreate them. It makes SAXBuilder > reusable even > if the parser isn't. > > I suspect the time to build a parser only matters if you're doing many > super-small documents. That's probably going to be common > with SOAP and > such, so this is something to watch. > > Kim, perhaps you want to run some tests on how long it takes to setup > parsers. Just use a no-op content handler. > > -jh- > > Joseph Bowbeer wrote: > > > > "Once this method is invoked, the parser instance is of no > further use, and > > should NOT be reused." > > > > Should we say the same about SAXBuilder's build method? > > > > In my experience with some older parsers, the parsers are > not reusable after > > they've thrown an exception -- even if they are reusable normally. > > > > Perhaps we can say one SAXBuilder == one parser and leave > it to the re-user > > to throw-away the SAXBuilder if an error is encountered. > > > > (To be safe, and to keep the memory footprint low, I create > a new SAXBuilder > > for every document.) > > > > --- original message --- > > > > From: Alex Rosen arosen@silverstream.com > > Date: Tue, 12 Mar 2002 10:39:47 -0500 > > > > If we're sure that all parser support being reused (or are > supposed to > > support it), then it does seem like a good idea. Doing a > quick search, I > > found that the original (i.e. very old) IBM4J parser says > this about its > > parsing methods: "Once this method is invoked, the parser > instance is of no > > further use, and should NOT be reused." I don't know about > newer parsers. > > The JAXP spec doesn't say one way or the other... > > > > _______________________________________________ > > To control your jdom-interest membership: > > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com From hip at a.cs.okstate.edu Fri Mar 15 10:40:07 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Problems with JDOM Beta 8 RC1 In-Reply-To: Your message of "Fri, 15 Mar 2002 17:29:59 GMT." Message-ID: <200203151841.LAA12793@dorothy.denveronline.net> Found it. Interesting did not know inner classes must also implement java.io.Serializable for things to work right. Makes sense though. Brad Theo Harper writes: > Hi, > > I am having a problem serializing org.jdom.Element with the latest release, > if you try the following code the size returned from the deserialised > element is incorrect. This problem did not occur with Beta 7. From Andy_Lord at tertio.com Fri Mar 15 04:12:36 2002 From: Andy_Lord at tertio.com (Andy Lord) Date: Fri Aug 6 17:07:29 2004 Subject: R[jdom-interest] XPath class Message-ID: <80256B7D.00430DF6.00@tertio_ln1.tertio.com> > public static XPath makeXPath(String s) throws JDOMException { > try { > XPath xp = null; > if (xpaths.containsKey(s)) > xp = (XPath)(xpaths.get(s)); > else { > xp = new RhinoXPath(s); > xpaths.put(s, xp); > } > return xp; > } Good idea, but wouldn't if ((xp=(XPath)xpaths.get(s)) == null) { xp=new RhinoXPath(s); xpaths.put(s,xp); } save one lookup? Whats a RhinoXPath BTW ?? Does it embed Javascript in Xpath expressions??? Lordy From jhunter at acm.org Fri Mar 15 12:46:56 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Re: [Fwd: JDOM ?] References: Message-ID: <3C925DC0.6A3DEAB1@acm.org> bob mcwhirter wrote: > > On Thu, 14 Mar 2002, Jason Hunter wrote: > > > I suspect the time to build a parser only matters if you're doing many > > super-small documents. That's probably going to be common with SOAP and > > such, so this is something to watch. > > I might argue differently. In my current project[0], I'm using small, medium > and fairly large documents. The trick is, at any given point in time, there's > probably a many document in-flight between a few dozen computers. I think > that there's an argument that in many 'enterprise' grade applications, a > significant number of documents, regardless of average size, are being > processed. My point is that construction time as a percentage of overall time probably only matters for small documents. If you're parsing a 2 Meg file, you probably don't notice it takes 20ms to get the parser constructed. But if you're parsing 500 byte files, you do notice. > > Kim, perhaps you want to run some tests on how long it takes to setup > > parsers. Just use a no-op content handler. > > I'd be interested in knowing this also. I think something like Aelfred > probably sets up a lot quicker than, say, Xerces. Yep, right now we're just armchair performance tuning. :-) -jh- From jhunter at acm.org Fri Mar 15 12:49:04 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: SV: [jdom-interest] Standalone attribute in Message-ID: <3C925E40.D0D713FD@acm.org> The XML Spec makes it very clear is not a PI. So therefore we don't treat it as a PI. Pretty cut and dry. -jh- "Christian Holmqvist, IT, Posten" wrote: > > Hi > > I have been searching the archive but found very little information about > this topic (I think the information stoped with the discussion about adding > a set/get standalone method) so if I ask questions that has been asked > before, excuse me. > > I would prefer that the ProcessInstruction, isn't that the logical way to handle it? > Just look at the information in it the tag: version refers to the XML > version the document is created in, encoding also refers to how to handle > the characters in the document and standalone refers to if validation of the > document should be performed. So all the information is about how the > document is processed i.e. process instruction *smile* > > The way to handle it would be very simular to the root element... > > /Christian Holmqvist > > > -----Ursprungligt meddelande----- > > Fr?n: Jason Hunter [mailto:jhunter@acm.org] > > Skickat: den 15 mars 2002 02:06 > > Till: Alex Rosen > > Kopia: 'Christian Holmqvist, IT, Posten'; 'Jdom-Interest (E-mail)' > > ?mne: Re: [jdom-interest] Standalone attribute in > > > > > The last time we discussed what to do about standalone we punted and > > decided to let people override printDeclaration(). I think the > > complicating situation was that the standalone flag is partly an > > attribute of the document and partly something to do with the > > outputter, > > and we didn't like having it tied to either. I'm not saying we can't > > add it, but it's non-obvious how best to add it. > > > > -jh- > > > > Alex Rosen wrote: > > > > > > The standalone attribute is not currently supported by > > XMLOutputter, but it > > > could easily be added, and for completeness it seems like > > it should be. > > > You'd have to allow it to be "yes" or "no" or absent > > altogether, so maybe > > > setStandaloneValue(String) would be the simplest API. > > > > > > It is tempting to make the XML declaration a PI, but I > > don't think it's the > > > right thing to do. The spec defines it as not being a PI, > > and when parsing > > > it's not passed along as a PI. If you added it to your > > document as a PI to > > > control the XML delcaration, then the document that you read back in > > > afterwards would be different from the one you emitted > > (because this special > > > PI would no longer be there). > > > > > > Alex > > > > > > > -----Original Message----- > > > > From: jdom-interest-admin@jdom.org > > > > [mailto:jdom-interest-admin@jdom.org]On Behalf Of > > Christian Holmqvist, > > > > IT, Posten > > > > Sent: Friday, March 08, 2002 3:27 AM > > > > To: Jdom-Interest (E-mail) > > > > Subject: [jdom-interest] Standalone attribute in > > > > > > > > > > > Hi! > > > > > > > > I'm rather new to XML so bare with me if I don't have all > > the exactly > > > > correct terms and expressions going on yet... *smile* > > > > > > > > How to I add the standalone attribute to the > > > ProcessInstruction (or > > > > more exactly xml file first line) or how do I change it from > > > > YES to NO and > > > > the other way around? > > > > > > > > I have been looking throgh the archive and seen some > > discussions about > > > > putting the control of this (together with encoding) in the > > > > XMLOutPutter > > > > thingy. The thing is that I can not see the different between this > > > > ProcessIntruction and other PIs (oki, parsing and well form > > > > ness is hard to > > > > do without it...). Why not let > > > can be changed, > > > > removed and added. If it is missed when trying to pass it to > > > > a parser the > > > > parser WILL complain with some form of error msg... > > > > > > > > Hmm oki, thank you for your time! > > > > > > > > /Christian > > > > _______________________________________________ > > > > To control your jdom-interest membership: > > > > http://lists.denveronline.net/mailman/options/jdom-interest/yo > > > > uraddr@yourhost.com > > > > > > _______________________________________________ > > > To control your jdom-interest membership: > > > > > http://lists.denveronline.net/mailman/options/jdom-interest/yo > uraddr@yourhost.com From dms at sosnoski.com Fri Mar 15 15:01:28 2002 From: dms at sosnoski.com (Dennis Sosnoski) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] [Fwd: Re: SAX/SAX2 parser reusability] Message-ID: <3C927D48.4060506@sosnoski.com> Here's the official word on SAX/SAX2 parser reusability, confirming my earlier email. If a parser's not reusable it's not compliant with the specification. I'd suggest it's better to base JDOM's behavior on the specification and reuse the parser. - Dennis -------------- next part -------------- An embedded message was scrubbed... From: David Brownell Subject: Re: SAX/SAX2 parser reusability Date: Fri, 15 Mar 2002 12:03:31 -0800 Size: 3187 Url: http://jdom.org/pipermail/jdom-interest/attachments/20020315/95bff6a4/SAX2parserreusability.eml From jhunter at acm.org Fri Mar 15 17:44:11 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] [Fwd: Re: SAX/SAX2 parser reusability] References: <3C927D48.4060506@sosnoski.com> Message-ID: <3C92A36B.1B85B33F@acm.org> I'm fine with having SAXBuilder reuse the parser instance, at least until we get too many complaints of non-compliant parsers making this a bad idea. If someone wants to send a patch, I'll check it in. -jh- Dennis Sosnoski wrote: > > Here's the official word on SAX/SAX2 parser reusability, confirming my > earlier email. If a parser's not reusable it's not compliant with the > specification. I'd suggest it's better to base JDOM's behavior on the > specification and reuse the parser. > > - Dennis > > ------------------------------------------------------------------------ > > Subject: Re: SAX/SAX2 parser reusability > Date: Fri, 15 Mar 2002 12:03:31 -0800 > From: David Brownell > To: Dennis Sosnoski > CC: David Megginson > References: > <15505.59043.661672.183245@megginson.com> <3C924B61.1060803@sosnoski.com> > > Dennis -- > > SAX parsers that can't be re-used after they (or some > handler they call) throw an exception are nonconformant. > Throwing an exception should only abort the current parse. > As it says in the javadoc for XMLReader.parse(): > > Once a parse is complete, an application may reuse > the same XMLReader object, possibly with a different > input source. ... If a client application wants to terminate > parsing early, it should throw an exception. > > Throwing an exception just causes "early" completion. > > I'm not sure what javadoc seems to suggest otherwise; > could you point it out to me? > > FWIW, that's the policy I'd expect from instances of any > class whatsoever, unless its interface spec said quite > explicitly that it self-corrupted when throwing exceptions. > > - Dave > > ----- Original Message ----- > From: "Dennis Sosnoski" > To: "David Brownell" > Cc: "David Megginson" > Sent: Friday, March 15, 2002 11:28 AM > Subject: Re: SAX/SAX2 parser reusability > > > Hi DavidB, > > > > This is in regard to a current discussion on the JDOM email list, so I'd > > like permission to forward your response there. The issue is whether > > parser reusability is something that can be depended on. > > > > Thanks, > > > > - Dennis > > > > David Megginson wrote: > > > > >Dennis Sosnoski writes: > > > > > > > I can see where the documentation might be subject to > > > > different interpretations - the error handling code says the > > > > parser can basically die after throwing a fatal exception. > > > > My own interpretation is that the parser can die *for that > > > > document only*, and must still be usable with other > > > > documents on later calls to parse. > > > > > >That was my intention as well -- that the parser should be reusable > > >for a new parse. I've copied the current SAX maintainer, David > > >Brownell, so that he can decide whether any documentation > > >clarifications are in order. > > > > > > > > >All the best, > > > > > > > > >David > > > > > > > From jhunter at acm.org Fri Mar 15 17:44:40 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] performance on tonights CVS References: <3C78B59D.7090206@lse.com> <3C9173C1.30FCA63F@acm.org> Message-ID: <3C92A388.4BF7A434@acm.org> > >I've been brainstorming with Brad about how to work around this so > >there's no verification when using a parser. Sadly with the package > >breakout it's not easy. It wasn't easy a year ago when we first faced > >this. > > > > Would it be possible to make a package protected non-verifying > subclass of Text in org.jdom.input that could be used by SAXBuilder, > etc? To everything outside the org.jdom.input package this would just > be a Text object. Is it possible to subclass a public class with a > non-public class? Even if it has to be public, such a class still > might make sense. > > Also, keep in mind that not all parsers make all the checks they're > supposed to. For instance, AElfred will not catch some illegal > characters in names. My best brainstorm is to move JDOMFactory and DefaultJDOMFactory into org.jdom. It's arguably appropriate, since they can build document components anytime, not only during the input phase. We add a NonVerifyingJDOMFactory which uses package-protected constructors to build objects without verification. Parsers use that factory by default. It builds the same classes as always, but skips the Verifier calls. Other people who know what they're doing can use the factory also, but they'll be the experts knowing what they're doing. -jh- From jhunter at acm.org Fri Mar 15 17:47:43 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] performance on tonights CVS References: <009301c1cc4e$f9caafd0$6a65810a@silverstream.com> Message-ID: <3C92A43F.DAE6CCC2@acm.org> Alex Rosen wrote: > > > Ideas are most welcome, but if nothing surfaces I'm tempted to remove > > that verification check. For the price, I think it provides minimal > > benefit. > > Amen! The requirement that it be impossible to build a non-well-formed > document always seemed... overly nice, to me. It's great to help developers > out by catching errors for them when it's cheap, but not when it's > expensive. It's not fair that you have to pay the price, even if your code > does the right thing. > > What if we didn't call the Verifier anywhere, but we added checkElement() > and checkDocument() to it? That way a developer could optionally check their > document, after they created it in-memory. If you're parsing a file (using a > parser that does the proper checks), or if you're building a document > in-memory but can guarantee that you're only adding legal values (e.g. if > all the data you added were integers), then you wouldn't have to pay the > price. We could move all non-free checks there, such as AttributeList's > checks for duplicate attributes. (Maybe that's cheap enough to leave as-is, > dunno.) > > Alex That's another alternative, and one I've considered. But it's like malloc returning null; few bother to check. -jh- From jhunter at acm.org Fri Mar 15 21:19:21 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] jdom archives Message-ID: <3C92D5D9.31416B1D@acm.org> FYI, I just repopulated the jdom-interest searchable archives for the time in February and March that archives weren't being kept. I think there's about 8 duplicates in Feb. They were just too much trouble to remove. Here's the link, it's also on jdom.org's mailing list page. http://www.servlets.com/archive/servlet/SummarizeList?listName=jdom-interest -jh- From philip.nelson at omniresources.com Sat Mar 16 08:52:59 2002 From: philip.nelson at omniresources.com (philip.nelson@omniresources.com) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] performance on tonights CVS Message-ID: > My best brainstorm is to move JDOMFactory and > DefaultJDOMFactory into org.jdom. It's arguably appropriate, > since they can build document components anytime, not only > during the input phase. We add a NonVerifyingJDOMFactory > which uses package-protected constructors to build objects > without verification. Parsers use that factory by default. > It builds the same classes as always, but skips the Verifier > calls. Other people who know what they're doing can use the > factory also, but they'll be the experts knowing what they're doing. I sort of like this idea. The object will still verify when the contents are changed so it acts like we say it is supposed to act. If my performance is suffering when I am doing a lot of editing of content, I can subclass to skip it, though that is unfortunate because it my most common case rather than the other way around. So, it seems like a partial solution. In our earlier testing character validation was good for 10-20% of the time. From adams at multispex.com Sat Mar 16 10:04:09 2002 From: adams at multispex.com (ShantAdam) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] exception all over the place !! Message-ID: <000801c1cd15$113cf760$7301fea9@shantadam> What about my code here. It's giving me all sorts of errors on class and method; symbols not beign resolved and so on. Can anyone tell where i'm wrong in this? [code] import java.io.File; import java.io.IOException; import java.io.OutputStream; import org.jdom.Attribute; import org.jdom.Comments; import org.jdom.DocType; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.Namespace; import org.jdom.ProcessingInstruction; import org.jdom.input.DOMBuilder; import org.jdom.input.SAXBuilder; import org.jdom.output.XMLOutputter; public class JDOMTest{ public JDOMTest(){ } public void newDocument(OutputStream out) throws IOException, JDOMExcption { Namespace ns = Namespace.getNamespace("linux","http://www.linux.org"); Document doc = new Document (new Element("config", ns)) .setDocType(new DocType("linux:config", "DTD/linux.dtd")) .addProcessingInstruction("cocoon-process", "type=\"xsp\""); .addProcessingInstruction(new ProcessingInstruction("cocoon-process", "type=\"xslt\"")); doc.getRootElement() .addAttribute("Kernel", "2.2.14") .addAttribute(new Attribute("dist", "RedHat 6.1")) .addAttribute(new Element("gui", ns) .setContent("No Window Manager Installed")) .addChild(new Comment("Sound Card Configuration")) .addChild(new Element("sound") .addChild(new Comment("Sound Blaster Card")) .addChild(new Element("card") .addChild(new Element("name") .setContent("Sound Blaster Platinum")))); XMLOutputter fmt = new XMLOutputter(); fmt.output(doc, out); } public void domDocument(File file, OutputStream out) throws IOException, JDOMException{ DOMBuilder builder = new DOMBuilder(true); Document doc = builder.build(file); XMLOutputter fmt = new XMLOutputter(); fmt.output(doc, out); } public void saxDocument(File file, OutputStream out) throws IOException, JDOMException{ SAXBuilder builder = new SAXBuilder(true); Document doc = builder.build(file); XMLOutputter fmt = new XMLOutputter(); fmt.output(doc, out); } public static void main(String[] args){ if(args.length != 1){ System.out.println("Usage: JDOMTest (filename to parse)"); System.exit(-1); } try{ JDOMTest test = new JDOMTest(); System.out.println("\n\n----------------------------------------------"); System.out.println("Testing creating Document from scratch ..."); System.out.println("----------------------------------------------\n\n"); test.newDocument(System.out); System.out.println("\n\n----------------------------------------------"); System.out.println("Testing reading Document using DOM ..."); System.out.println("----------------------------------------------\n\n"); test.domDocument(new File(args[0]), System.out); System.out.println("\n\n----------------------------------------------"); System.out.println("Testing reading Document using SAX ..."); System.out.println("----------------------------------------------\n\n"); test.saxDocument(new File(args[0]), System.out); System.out.println("\n\n----------------------------------------------"); System.out.println("Tests complete. Successful build in place."); } catch (Exception e){ e.printStackTrace(); if(e instanceof JDOMException){ System.out.println(((JDOMException)e) .getRootCause() .getMessage()); } else { System.out.println(e.getMessage()); } } } } [/code] Multispex Designs Rep.: Shant Adam Tel.: (514) 827-4840 adams@multispex.com http://www.multispex.com --- Visual technology service provider. Fournisseur de service de technologie visuel. --- Copyright 1998-2002? Multispex Designs? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020316/a89763bf/attachment.htm From bob at werken.com Sat Mar 16 12:29:18 2002 From: bob at werken.com (bob mcwhirter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] exception all over the place !! In-Reply-To: <000801c1cd15$113cf760$7301fea9@shantadam> Message-ID: On Sat, 16 Mar 2002, ShantAdam wrote: > What about my code here. > It's giving me all sorts of errors on class and method; symbols not beign resolved and so on. > > Can anyone tell where i'm wrong in this? > > [ snip; a lot of code, no error messages ] You forgot to pay Jason $10 to use JDOM... Truthfully though... 1) When having errors, let us know what they are. Copy/paste is your friend. 2) HTML email is evil. Don't send it to mailing lists. 3) Tell us what you've already tried to do to solve your own problem. -bob From jhunter at acm.org Sat Mar 16 15:13:47 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] performance on tonights CVS References: Message-ID: <3C93D1AB.EA2CD94A@acm.org> philip.nelson@omniresources.com wrote: > > > My best brainstorm is to move JDOMFactory and > > DefaultJDOMFactory into org.jdom. It's arguably appropriate, > > since they can build document components anytime, not only > > during the input phase. We add a NonVerifyingJDOMFactory > > which uses package-protected constructors to build objects > > without verification. Parsers use that factory by default. > > It builds the same classes as always, but skips the Verifier > > calls. Other people who know what they're doing can use the > > factory also, but they'll be the experts knowing what they're doing. > > I sort of like this idea. The object will still verify when the contents > are changed so it acts like we say it is supposed to act. If my performance > is suffering when I am doing a lot of editing of content, I can subclass to > skip it, though that is unfortunate because it my most common case rather > than the other way around. So, it seems like a partial solution. In our > earlier testing character validation was good for 10-20% of the time. You don't need to subclass really, just build elts using the factory instead of "new". This factory plan requires we always do tree-structure checking but when I timed that earlier it was really quite fast. -jh- From adams at multispex.com Sun Mar 17 16:20:00 2002 From: adams at multispex.com (ShantAdam) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] exception all over the place !! References: Message-ID: <001601c1ce12$a5b4b060$3343a2d8@shantadam> Alright; Here's the deal I just updated my JDOM 8b and JDK1.4. it seems like I may be a bit slow on updating programs. So, I get these errors: C:\WINDOWS\Desktop\jdomTest>javac -deprecation JDOMTest.java JDOMTest.java:24: cannot resolve symbol symbol : method addProcessingInstruction (java.lang.String,java.lang.String) location: class org.jdom.Document Document doc = new Document (new Element("config", ns)) ^ JDOMTest.java:41: setContent(java.util.List) in org.jdom.Element cannot be applied to (java.lang.String) .addChild(new Element("name") ^ JDOMTest.java:38: cannot resolve symbol symbol : method addChild (org.jdom.Comment) location: class org.jdom.Element .addChild(new Element("sound") ^ JDOMTest.java:35: setContent(java.util.List) in org.jdom.Element cannot be applied to (java.lang.String) .addAttribute(new Element("gui", ns) ^ JDOMTest.java:31: cannot resolve symbol symbol : method addAttribute (java.lang.String,java.lang.String) location: class org.jdom.Element doc.getRootElement() ^ JDOMTest.java:53: warning: build(java.io.File) in org.jdom.input.DOMBuilder has been deprecated Document doc = builder.build(file); ^ JDOMTest.java:101: cannot resolve symbol symbol : method getRootCause () location: class org.jdom.JDOMException System.out.println(((JDOMException)e).getRootCause() ^ 6 errors 1 warning And Here's the corrected version of my code: [code] import java.io.File; import java.io.IOException; import java.io.OutputStream; import org.jdom.Attribute; import org.jdom.Comment; import org.jdom.DocType; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; import org.jdom.Namespace; import org.jdom.ProcessingInstruction; import org.jdom.input.DOMBuilder; import org.jdom.input.SAXBuilder; import org.jdom.output.XMLOutputter; public class JDOMTest{ public JDOMTest(){ } public void newDocument(OutputStream out) throws IOException, JDOMException { Namespace ns = Namespace.getNamespace("linux","http://www.linux.org"); Document doc = new Document (new Element("config", ns)) .setDocType(new DocType("linux:config", "DTD/linux.dtd")) .addProcessingInstruction("cocoon-process", "type=\"xsp\"") .addProcessingInstruction( new ProcessingInstruction("cocoon-process", "type=\"xslt\"")); doc.getRootElement() .addAttribute("Kernel", "2.2.14") //easy way .addAttribute( new Attribute("dist", "RedHat 6.1")) //hard way .addAttribute(new Element("gui", ns) .setContent("No Window Manager Installed")) .addChild(new Comment("Sound Card Configuration")) .addChild(new Element("sound") .addChild(new Comment("Sound Blaster Card")) .addChild(new Element("card") .addChild(new Element("name") .setContent("Sound Blaster Platinum"))) ); XMLOutputter fmt = new XMLOutputter(); fmt.output(doc, out); } public void domDocument(File file, OutputStream out) throws IOException, JDOMException{ DOMBuilder builder = new DOMBuilder(true); Document doc = builder.build(file); XMLOutputter fmt = new XMLOutputter(); fmt.output(doc, out); } public void saxDocument(File file, OutputStream out) throws IOException, JDOMException{ SAXBuilder builder = new SAXBuilder(true); Document doc = builder.build(file); XMLOutputter fmt = new XMLOutputter(); fmt.output(doc, out); } public static void main(String[] args){ if(args.length != 1){ System.out.println("Usage: JDOMTest (filename to parse)"); System.exit(-1); } try{ JDOMTest test = new JDOMTest(); System.out.println("\n\n----------------------------------------------"); System.out.println("Testing creating Document from scratch ..."); System.out.println("----------------------------------------------\n\n"); test.newDocument(System.out); System.out.println("\n\n----------------------------------------------"); System.out.println("Testing reading Document using DOM ..."); System.out.println("----------------------------------------------\n\n"); test.domDocument(new File(args[0]), System.out); System.out.println("\n\n----------------------------------------------"); System.out.println("Testing reading Document using SAX ..."); System.out.println("----------------------------------------------\n\n"); test.saxDocument(new File(args[0]), System.out); System.out.println("\n\n----------------------------------------------"); System.out.println("Tests complete. Successful build in place."); } catch (Exception e){ e.printStackTrace(); if(e instanceof JDOMException){ System.out.println(((JDOMException)e).getRootCause() .getMessage()); } else { System.out.println(e.getMessage()); } } } } [/code] Multispex Designs Rep.: Shant Adam Tel.: (514) 827-4840 adams@multispex.com http://www.multispex.com --- Visual technology service provider. Fournisseur de service de technologie visuel. --- Copyright 1998-2002? Multispex Designs? ----- Original Message ----- From: "bob mcwhirter" To: "ShantAdam" Cc: "jdom - interest" Sent: Saturday, March 16, 2002 3:29 PM Subject: Re: [jdom-interest] exception all over the place !! > > On Sat, 16 Mar 2002, ShantAdam wrote: > > > What about my code here. > > It's giving me all sorts of errors on class and method; symbols not beign resolved and so on. > > > > Can anyone tell where i'm wrong in this? > > > > [ snip; a lot of code, no error messages ] > > > You forgot to pay Jason $10 to use JDOM... > > > Truthfully though... > > 1) When having errors, let us know what they are. Copy/paste is your > friend. > > 2) HTML email is evil. Don't send it to mailing lists. > > 3) Tell us what you've already tried to do to solve your own problem. > > > -bob > > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com > > From jhunter at acm.org Sun Mar 17 17:15:30 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] exception all over the place !! References: <001601c1ce12$a5b4b060$3343a2d8@shantadam> Message-ID: <3C953FB2.5F2C5F78@acm.org> > C:\WINDOWS\Desktop\jdomTest>javac -deprecation JDOMTest.java > JDOMTest.java:24: cannot resolve symbol > symbol : method addProcessingInstruction > (java.lang.String,java.lang.String) > location: class org.jdom.Document > Document doc = new Document (new Element("config", ns)) > ^ That method doesn't exist anymore. It was deprecated in b7, gone in b8. > JDOMTest.java:41: setContent(java.util.List) in org.jdom.Element cannot be > applied to (java.lang.String) > .addChild(new Element("name") > ^ That method hasn't been around since maybe b5. > JDOMTest.java:38: cannot resolve symbol > symbol : method addChild (org.jdom.Comment) > location: class org.jdom.Element > .addChild(new Element("sound") > ^ Also a very old method. Without going point-by-point, I see nearly all these methods existed once upon a time, but even in b7 some of them didn't exist or were at least deprecated. Looks like you're trying to use b5 code against b8. You're going to need to redo some code. -jh- From easirois at ca.ibm.com Sun Mar 17 16:26:52 2002 From: easirois at ca.ibm.com (Eric Sirois) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Tranforming   into hatted A References: <86sn73apwc.fsf@earthlink.net> Message-ID: <3C95344C.2060906@ca.ibm.com> Hello David, This happens when your transformed document is in UTF-8 encoding and the browser is usally set to ISO-8859-1/Windows 1252. There are three things you can do. 1) Change your browser's default encoding to UTF-8 2) use in your stylesheet 3) use iso-8859-1 encoding in your XML document HTH. Kind regards, Eric David M. Karr wrote: >I did go over the XSLT FAQ about special characters, but I didn't see anything >obviously covering this. > >I'm trying to figure out how to generate a " " element in my HTML output. >Unfortunately, it only produces a capital "hatted A". I also tried an explicit >" ", but that did the same thing. I tried to trick it with "&nbsp;", >but the result was uninspiring, being exactly "&nbsp;". > >What exactly is happening here? > From bdsherlock at juno.com Sun Mar 17 20:37:32 2002 From: bdsherlock at juno.com (Bill Sherlock) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Problem running samples Message-ID: <20020317.223732.-16467839.1.bdsherlock@juno.com> Hi all, New to XML, JDOM and having a bit of difficulty running the sample code. I am running from the command line using win98,jdom-b8, and jdk1.4.0. I drill down to the directory holding the Count.class file. I tried running the program using the three methods below and, needless to say as I am posting here, I got nowhere. I know that Count requires that I supply 2 parameters, which I didn't, but it should tell me the usage, which it didn't. Any help would be appreciated. Thanks, Bill Sherlock Try #1: C:\jdom\jdom-b8\build\classes\samples>java -classpath C:\jdom\jdom-b8\build\jdom.jar;C:\jdom\jdom-b8\lib\xerces.jar Count Exception in thread "main" java.lang.NoClassDefFoundError: Count Try #2: C:\jdom\jdom-b8\build\classes\samples>java Count Exception in thread "main" java.lang.NoClassDefFoundError: Count (wrong name: sa mples/Count) at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:509) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12 3) at java.net.URLClassLoader.defineClass(URLClassLoader.java:246) at java.net.URLClassLoader.access$100(URLClassLoader.java:54) at java.net.URLClassLoader$1.run(URLClassLoader.java:193) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:186) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) at java.lang.ClassLoader.loadClass(ClassLoader.java:262) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322) Try #3: C:\jdom\jdom-b8\build\classes\samples>java -classpath C:\jdom\jdom-b8\build\jdom .jar;C:\jdom\jdom-b8\lib\xerces.jar samples.Count Exception in thread "main" java.lang.NoClassDefFoundError: samples/Count From dmkarr at earthlink.net Sun Mar 17 20:42:55 2002 From: dmkarr at earthlink.net (David M. Karr) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Tranforming   into hatted A In-Reply-To: <3C95344C.2060906@ca.ibm.com> References: <86sn73apwc.fsf@earthlink.net> <3C95344C.2060906@ca.ibm.com> Message-ID: <867koatrjk.fsf@earthlink.net> >>>>> "Eric" == Eric Sirois writes: Eric> David M. Karr wrote: >> I did go over the XSLT FAQ about special characters, but I didn't see anything >> obviously covering this. >> >> I'm trying to figure out how to generate a " " element in my HTML output. >> Unfortunately, it only produces a capital "hatted A". I also tried an explicit >> " ", but that did the same thing. I tried to trick it with "&nbsp;", >> but the result was uninspiring, being exactly "&nbsp;". >> >> What exactly is happening here? Eric> Hello David, Eric> This happens when your transformed document is in UTF-8 encoding and the Eric> browser is usally set to ISO-8859-1/Windows 1252. There are three things you Eric> can do. Eric> 1) Change your browser's default encoding to UTF-8 Eric> 2) use in your stylesheet Eric> 3) use iso-8859-1 encoding in your XML document In my environment, using JDOM/JAXP, I'm finding that nothing I do to try to set the output encoding to "iso-8859-1" has any effect on the character encoding of my output document. I have a feeling this is just a JAXP issue, and not with JDOM, however. I was able to get these characters to view correctly in the browser by changing the browser to UTF-8 (your thing 1), but things 2 and 3 had no effect on the output document or how it views in the browser (when the browser is using "auto-detect" or "iso-8859-1"). I'm going to proceed with building a JAXP-only test case for this. -- =================================================================== David M. Karr ; Java/J2EE/XML/Unix/C++ dmkarr@earthlink.net From rc at crunk.net Sun Mar 17 21:08:02 2002 From: rc at crunk.net (Rolland Crunk) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Tranforming   into hatted A In-Reply-To: <867koatrjk.fsf@earthlink.net> References: <3C95344C.2060906@ca.ibm.com> <86sn73apwc.fsf@earthlink.net> <3C95344C.2060906@ca.ibm.com> Message-ID: <4.3.2.7.2.20020317204742.02bffd20@mail.crunk.net> No I don't think it is a JAXP issue. I am not currently using JAXP in the same application I am using JDOM. I am still on JDOM b6 as I discovered the same problem when I moved to b7 (from the JDOM CVS source a few days before b8 was announced, so it may be somewhere in between). Being bandwidth limited, I simply backed down to b6 and didn't dig into the code to find out what was wrong. The hatted As appeared when rendering a MSWord produced html source document translated through JTIDY and contained a series of nbsp. rc At 08:42 PM 3/17/02 -0800, David M. Karr wrote: >In my environment, using JDOM/JAXP, I'm finding that nothing I do to try >to set >the output encoding to "iso-8859-1" has any effect on the character >encoding of >my output document. I have a feeling this is just a JAXP issue, and not with >JDOM, however. I was able to get these characters to view correctly in the >browser by changing the browser to UTF-8 (your thing 1), but things 2 and >3 had >no effect on the output document or how it views in the browser (when the >browser is using "auto-detect" or "iso-8859-1"). > >I'm going to proceed with building a JAXP-only test case for this. > >-- >=================================================================== >David M. Karr ; Java/J2EE/XML/Unix/C++ >dmkarr@earthlink.net > >_______________________________________________ >To control your jdom-interest membership: >http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com > From jhunter at acm.org Mon Mar 18 03:08:04 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Problem running samples References: <20020317.223732.-16467839.1.bdsherlock@juno.com> Message-ID: <3C95CA94.DBFE9467@acm.org> The samples are in the "samples" package so you need to include the "classes" directory in your classpath and run samples.Count. -jh- Bill Sherlock wrote: > > Hi all, > > New to XML, JDOM and having a bit of difficulty running the sample code. > I am running from the command line using win98,jdom-b8, and jdk1.4.0. I > drill down to the directory holding the Count.class file. I tried running > the program using the three methods below and, needless to say as I am > posting here, I got nowhere. I know that Count requires that I supply 2 > parameters, which I didn't, but it should tell me the usage, which it > didn't. Any help would be appreciated. > > Thanks, > Bill Sherlock > > Try #1: > > C:\jdom\jdom-b8\build\classes\samples>java -classpath > C:\jdom\jdom-b8\build\jdom.jar;C:\jdom\jdom-b8\lib\xerces.jar Count > Exception in thread "main" java.lang.NoClassDefFoundError: Count > > Try #2: > C:\jdom\jdom-b8\build\classes\samples>java Count > Exception in thread "main" java.lang.NoClassDefFoundError: Count (wrong > name: sa > mples/Count) > at java.lang.ClassLoader.defineClass0(Native Method) > at java.lang.ClassLoader.defineClass(ClassLoader.java:509) > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12 > 3) > at java.net.URLClassLoader.defineClass(URLClassLoader.java:246) > at java.net.URLClassLoader.access$100(URLClassLoader.java:54) > at java.net.URLClassLoader$1.run(URLClassLoader.java:193) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:186) > at java.lang.ClassLoader.loadClass(ClassLoader.java:306) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) > at java.lang.ClassLoader.loadClass(ClassLoader.java:262) > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322) > > Try #3: > C:\jdom\jdom-b8\build\classes\samples>java -classpath > C:\jdom\jdom-b8\build\jdom > .jar;C:\jdom\jdom-b8\lib\xerces.jar samples.Count > Exception in thread "main" java.lang.NoClassDefFoundError: samples/Count > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From jhunter at acm.org Mon Mar 18 03:09:44 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Tranforming   into hatted A References: <86sn73apwc.fsf@earthlink.net> <3C95344C.2060906@ca.ibm.com> <867koatrjk.fsf@earthlink.net> Message-ID: <3C95CAF8.98DDC4A6@acm.org> Perhaps you're passing a Writer to the output method. Look at the Javadocs for a long lecture about how if you pass a Writer you need to make sure it's a proper writer for the charset you're intending. Writers don't expose their set charsets, so JDOM can't double check you're doing the right thing. -jh- "David M. Karr" wrote: > > >>>>> "Eric" == Eric Sirois writes: > > Eric> David M. Karr wrote: > > >> I did go over the XSLT FAQ about special characters, but I didn't see anything > >> obviously covering this. > >> > >> I'm trying to figure out how to generate a " " element in my HTML output. > >> Unfortunately, it only produces a capital "hatted A". I also tried an explicit > >> " ", but that did the same thing. I tried to trick it with "&nbsp;", > >> but the result was uninspiring, being exactly "&nbsp;". > >> > >> What exactly is happening here? > > Eric> Hello David, > Eric> This happens when your transformed document is in UTF-8 encoding and the > Eric> browser is usally set to ISO-8859-1/Windows 1252. There are three things you > Eric> can do. > > Eric> 1) Change your browser's default encoding to UTF-8 > Eric> 2) use in your stylesheet > Eric> 3) use iso-8859-1 encoding in your XML document > > In my environment, using JDOM/JAXP, I'm finding that nothing I do to try to set > the output encoding to "iso-8859-1" has any effect on the character encoding of > my output document. I have a feeling this is just a JAXP issue, and not with > JDOM, however. I was able to get these characters to view correctly in the > browser by changing the browser to UTF-8 (your thing 1), but things 2 and 3 had > no effect on the output document or how it views in the browser (when the > browser is using "auto-detect" or "iso-8859-1"). > > I'm going to proceed with building a JAXP-only test case for this. > > -- > =================================================================== > David M. Karr ; Java/J2EE/XML/Unix/C++ > dmkarr@earthlink.net > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From jeff.singer at vine.co.za Mon Mar 18 06:47:13 2002 From: jeff.singer at vine.co.za (Jeff Singer) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] raw bytes turned into string and inserted into xml Message-ID: Hi all, I have a situation in which my applications input is a raw stream of bytes, these bytes are actually ascii strings which occassionaly will contain characters which are illegal to xml like 0x4, 0x0, 0x1 - quite a few in this range. I use the string constructor which takes an encoding to form them into java.lang.String objects. This works fine, I then insert them as content onto a JDOM Element object and eventually after building up my document I use an XMLOutputter to convert the DOM to an XML string. This also works fine, where the problem lies is when the app that accepts the xml string I have generated tries to parse the xml. It throws JDOMException because the xml contains an invalid xml character in xml's that were created from byte streams which contained characters in the range already mentioned. Sample App attached Any help/ideas would be appreciated. Thanks in advance Jeff Singer -------------- next part -------------- A non-text attachment was scrubbed... Name: Test.java Type: application/x-javascript Size: 863 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020318/98f01159/Test.js From bart at wdi.co.uk Mon Mar 18 07:21:25 2002 From: bart at wdi.co.uk (Bart Read) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] raw bytes turned into string and inserted into xml References: Message-ID: <010d01c1ce90$926ddad0$dc00a8c0@JOHNNYBRAVO> Jeff, Try using base 64 encoding on your input. Base 64 encoding uses only printable ASCII characters, all of which are legal in XML. When you want to get back to the raw output simply base 64 decode your element content / attribute value (whichever contains the base 64 encoded binary data). Check the following URL: http://www.freesoft.org/CIE/RFC/2065/56.htm This describes base 64 encoding and should enable you to develop a simple encoding / decoding class. I'd give you the source code for ours, but it's copyrighted so I can't -- it's not difficult to do anyway. Sun do actually provide one with the JDK but the thing is that it's in the com.sun package so it's not guaranteed to be in future releases so you're better off writing your own. Cheers, Bart ================================= Bart Read Senior Developer Abbotsbury Software Ltd Abbotsbury, DORSET DT3 4JT Tel: +44 (0) 1305 871543 E-mail: bart@wdi.co.uk ================================= ----- Original Message ----- From: "Jeff Singer" To: Sent: Monday, March 18, 2002 2:47 PM Subject: [jdom-interest] raw bytes turned into string and inserted into xml > Hi all, > > I have a situation in which my applications input is a raw stream of > bytes, these bytes are actually ascii strings which occassionaly will > contain characters which are illegal to xml like 0x4, 0x0, 0x1 - quite a > few in this range. I use the string constructor which takes an encoding > to form them into java.lang.String objects. This works fine, I then > insert them as content onto a JDOM Element object and eventually after > building up my document I use an XMLOutputter to convert the DOM to an > XML string. This also works fine, where the problem lies is when the app > that accepts the xml string I have generated tries to parse the xml. It > throws JDOMException because the xml contains an invalid xml character > in xml's that were created from byte streams which contained characters > in the range already mentioned. > > > Sample App attached > > Any help/ideas would be appreciated. > > Thanks in advance > Jeff Singer ---------- Automatically inserted by WDI Mailserver ---------------- This message has been scanned for virus, trojans, illegal relays and spam. If you have any comments, problems or questions please do not hesitate to contact: Abbotsbury Software Ltd Tel: +44 1305 871543 Fax: +44 1305 871688 Email: postmaster@wdi.co.uk Web: http://www.wdi.co.uk/virus.phtml From bart at wdi.co.uk Mon Mar 18 07:29:51 2002 From: bart at wdi.co.uk (Bart Read) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] raw bytes turned into string and inserted into xml References: Message-ID: <012f01c1ce91$c713ade0$dc00a8c0@JOHNNYBRAVO> Hi again Jeff, Just had a little scout around and found a base 64 encoder / decoder on Sourceforge, check out the following URL: http://iharder.sourceforge.net/base64/ Cheers, Bart ================================= Bart Read Senior Developer Abbotsbury Software Ltd Abbotsbury, DORSET DT3 4JT Tel: +44 (0) 1305 871543 E-mail: bart@wdi.co.uk ================================= ----- Original Message ----- From: "Jeff Singer" To: Sent: Monday, March 18, 2002 2:47 PM Subject: [jdom-interest] raw bytes turned into string and inserted into xml > Hi all, > > I have a situation in which my applications input is a raw stream of > bytes, these bytes are actually ascii strings which occassionaly will > contain characters which are illegal to xml like 0x4, 0x0, 0x1 - quite a > few in this range. I use the string constructor which takes an encoding > to form them into java.lang.String objects. This works fine, I then > insert them as content onto a JDOM Element object and eventually after > building up my document I use an XMLOutputter to convert the DOM to an > XML string. This also works fine, where the problem lies is when the app > that accepts the xml string I have generated tries to parse the xml. It > throws JDOMException because the xml contains an invalid xml character > in xml's that were created from byte streams which contained characters > in the range already mentioned. > > > Sample App attached > > Any help/ideas would be appreciated. > > Thanks in advance > Jeff Singer ---------- Automatically inserted by WDI Mailserver ---------------- This message has been scanned for virus, trojans, illegal relays and spam. If you have any comments, problems or questions please do not hesitate to contact: Abbotsbury Software Ltd Tel: +44 1305 871543 Fax: +44 1305 871688 Email: postmaster@wdi.co.uk Web: http://www.wdi.co.uk/virus.phtml From Sasha.Bilton at bskyb.com Mon Mar 18 06:50:40 2002 From: Sasha.Bilton at bskyb.com (Bilton, Sasha) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] From B7 to B8 - ConcurrentModificationException Message-ID: Hi, I've just converted from Beta 7 to Beta 8 RC1 and I've got the following exception coming up now... Exception in thread "main" java.util.ConcurrentModificationException at org.jdom.ContentList$FilterListIterator.checkConcurrentModification(C ontentList.java:1206) at org.jdom.ContentList$FilterListIterator.hasNext(ContentList.java:928) from this code public void removeUnit(Unit unit) { String unitName = unit.getName(); Iterator i = getUnits().iterator(); while (i.hasNext()) { Element e = (Element)i.next(); if(e.getTextTrim().equals(unitName)) { values.removeContent(e); } } } Where getUnits() returns a List of Elements, from the variable values that have a single text value. I guess that the error is occuring because I'm removing elements from 'values' at the same time as going through 'values' iterator. What's weird is that the error is occuring under B8 and not B7. Any hints on the best way to fix it and why it happening now would be a great help, thanks Sasha ********************************************************************** Information in this email is confidential and may be privileged. It is intended for the addressee only. If you have received it in error, please notify the sender immediately and delete it from your system. You should not otherwise copy it, retransmit it or use or disclose its contents to anyone. Thank you for your co-operation. ********************************************************************** From arosen at silverstream.com Mon Mar 18 07:59:00 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] From B7 to B8 - ConcurrentModificationException In-Reply-To: Message-ID: <002101c1ce95$d2816970$6a65810a@silverstream.com> The List code has been completely rewritten and is much better now. Part of the improvement is that the Lists (and therefore the Iterators) now see changes to the backing Element when they happen. Your old code worked because this was not true at the time (which was against the JDOM spec). This means that the Iterators now throw ConcurrentModificationException, just like ArrayList does: "The iterators returned by this class's iterator and listIterator methods are fail-fast: if list is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove or add methods, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future." The solution is to simply call i.remove() instead of values.removeContent(e). Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Bilton, Sasha > Sent: Monday, March 18, 2002 9:51 AM > To: jdom-interest@jdom.org > Subject: [jdom-interest] From B7 to B8 - > ConcurrentModificationException > > > Hi, > > I've just converted from Beta 7 to Beta 8 RC1 and I've got > the following > exception coming up now... > > Exception in thread "main" java.util.ConcurrentModificationException > at > org.jdom.ContentList$FilterListIterator.checkConcurrentModification(C > ontentList.java:1206) > at > org.jdom.ContentList$FilterListIterator.hasNext(ContentList.java:928) > > > from this code > > public void removeUnit(Unit unit) > { > String unitName = unit.getName(); > > Iterator i = getUnits().iterator(); > while (i.hasNext()) > { > Element e = (Element)i.next(); > if(e.getTextTrim().equals(unitName)) > { > values.removeContent(e); > } > } > } > > Where getUnits() returns a List of Elements, from the > variable values that > have a single text value. > > I guess that the error is occuring because I'm removing elements from > 'values' at the same time as going through 'values' iterator. > What's weird > is that the error is occuring under B8 and not B7. > > Any hints on the best way to fix it and why it happening now > would be a > great help, > thanks > > Sasha > > > ********************************************************************** > Information in this email is confidential and may be privileged. > It is intended for the addressee only. If you have received > it in error, > please notify the sender immediately and delete it from your system. > You should not otherwise copy it, retransmit it or use or disclose its > contents to anyone. > Thank you for your co-operation. > ********************************************************************** > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yo uraddr@yourhost.com From adams at multispex.com Mon Mar 18 09:30:39 2002 From: adams at multispex.com (ShantAdam) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] JavaDocs Message-ID: <000b01c1cea2$a2cc3400$1443a2d8@shantadam> Hi; How do I get the JavaDocs for JDOM. I just can't find the way. thanks; Multispex Designs Rep.: Shant Adam Tel.: (514) 827-4840 adams@multispex.com http://www.multispex.com --- Visual technology service provider. Fournisseur de service de technologie visuel. --- Copyright 1998-2002? Multispex Designs? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020318/503e97d5/attachment.htm From Sasha.Bilton at bskyb.com Mon Mar 18 09:35:34 2002 From: Sasha.Bilton at bskyb.com (Bilton, Sasha) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] From B7 to B8 - ConcurrentModificationExcepti on Message-ID: > -----Original Message----- > From: Alex Rosen [mailto:arosen@silverstream.com] > Sent: 18 March 2002 15:59 > To: 'Bilton, Sasha'; jdom-interest@jdom.org > Subject: RE: [jdom-interest] From B7 to B8 - > ConcurrentModificationException > The solution is to simply call i.remove() instead of > values.removeContent(e). > That worked perfectly - many thanks. My code is faster by about 10% under beta 8. Sasha ********************************************************************** Information in this email is confidential and may be privileged. It is intended for the addressee only. If you have received it in error, please notify the sender immediately and delete it from your system. You should not otherwise copy it, retransmit it or use or disclose its contents to anyone. Thank you for your co-operation. ********************************************************************** From LLin at OfficeDepot.com Mon Mar 18 12:05:30 2002 From: LLin at OfficeDepot.com (Linus-Lin) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] typo in javadoc for jdom 0.7 Comment should be Attribute. Message-ID: <95F6BEDE2686D31182E3002048402A3E0266D399@ODMSX02> typo in javadoc for jdom 0.7 Comment should be Attribute. org.jdom.Attribute.setParent setParent protected Attribute setParent(Element parent) This will set the parent of this Comment. Parameters: parent - Element to be new parent. Returns: this Comment modified. ------------------------ Linus Lin llin@officedepot.com x87243 From jhunter at acm.org Mon Mar 18 12:22:28 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] typo in javadoc for jdom 0.7 Comment should be Attribute. References: <95F6BEDE2686D31182E3002048402A3E0266D399@ODMSX02> Message-ID: <3C964C84.A61A5219@acm.org> Fixed. -jh- Linus-Lin wrote: > > typo in javadoc for jdom 0.7 Comment should be Attribute. > > org.jdom.Attribute.setParent > setParent > protected Attribute setParent(Element parent) > This will set the parent of this Comment. > Parameters: > parent - Element to be new parent. > Returns: > this Comment modified. > > ------------------------ > Linus Lin > llin@officedepot.com > x87243 > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From elharo at metalab.unc.edu Mon Mar 18 12:20:57 2002 From: elharo at metalab.unc.edu (Elliotte Rusty Harold) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] raw bytes turned into string and inserted into xml In-Reply-To: References: Message-ID: At 4:47 PM +0200 3/18/02, Jeff Singer wrote: >Hi all, > >I have a situation in which my applications input is a raw stream of >bytes, these bytes are actually ascii strings which occassionaly will >contain characters which are illegal to xml like 0x4, 0x0, 0x1 - quite a >few in this range. I use the string constructor which takes an encoding >to form them into java.lang.String objects. This works fine, I then >insert them as content onto a JDOM Element object and eventually after Aha! You've just demonstrated one case in which JDOM does need to be verifying the character data content. From the moment you inserted the first 0x4, 0x0, etc. your document was no longer well-formed XML, and JDOM should have immediately thrown an exception to let you know this. I apologize that it didn't. As to how to fix your code, that depends on what the strings are for and what you're ultimately doing with them. Some have suggested that you Base-64 encode your data. This is one possibility. Another is that you replace each illegal character by an an element like this: There are other solutions. However, the simple fact is you can't include these characters directly in an XML 1.0 document. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ From ben at kopic.org Mon Mar 18 15:01:56 2002 From: ben at kopic.org (Benjamin Kopic) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] JavaDocs In-Reply-To: <000b01c1cea2$a2cc3400$1443a2d8@shantadam> Message-ID: If you use Ant (assuming you downloaded the source code version): ant javadoc If you use a web browser http://www.jdom.org/docs/apidocs/index.html -----Original Message----- From: jdom-interest-admin@jdom.org [mailto:jdom-interest-admin@jdom.org]On Behalf Of ShantAdam Sent: 18 March 2002 17:31 To: jdom - interest Subject: [jdom-interest] JavaDocs Hi; How do I get the JavaDocs for JDOM. I just can't find the way. thanks; Multispex Designs Rep.: Shant Adam Tel.: (514) 827-4840 adams@multispex.com http://www.multispex.com --- Visual technology service provider. Fournisseur de service de technologie visuel. --- Copyright 1998-2002? Multispex Designs? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020318/a88c8ac2/attachment.htm From arosen at silverstream.com Mon Mar 18 15:18:48 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] JavaDocs In-Reply-To: Message-ID: <000c01c1ced3$431b79e0$6a65810a@silverstream.com> I agree, it would be nice if they were part of the JDOM download zip, like in most other packages. Alex From jhunter at servlets.com Mon Mar 18 15:54:38 2002 From: jhunter at servlets.com (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] JavaDocs References: <000c01c1ced3$431b79e0$6a65810a@silverstream.com> Message-ID: <3C967E3E.878528ED@servlets.com> Javadocs *are* part of the betas. It's up to Jools how the daily builds operate. Right now I'd just be happy to have them operating again! -jh- Alex Rosen wrote: > > I agree, it would be nice if they were part of the JDOM download zip, like > in most other packages. > > Alex > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From patrick.dowler at nrc.ca Mon Mar 18 17:16:59 2002 From: patrick.dowler at nrc.ca (Patrick Dowler) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] strange compile error/classpath issue Message-ID: <200203190116.SAA06385@dorothy.denveronline.net> JDOM: beta8 rc1 JDK: 1.3.1 (blackdown) on linux When I compile a simple application, I get the compile error Class org.xml.sax.InputSource not found on the second line of SAXBuilder buildler = new SAXBuilder(); Document doc = builder.build( file ); unless I have an XML parser (xerces.jar, for example) in the classpath. It compiles fine with ant, presumably because it includes crimson.jar in the classpath. Why should I need to have this in my classpath to compile? According to the javadocs for jdom-b8-rc1, the build() method is overloaded to to take an org.xml.sax.InputSource, which is where I'm thinking the problem lies... despite the fact that I'm using the build(File) method. Is this a compiler bug? feature? curious, -- Patrick Dowler Canadian Astronomy Data Centre National Research Council Victoria, BC From adams at multispex.com Mon Mar 18 20:16:14 2002 From: adams at multispex.com (ShantAdam) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] JavaDocs References: Message-ID: <002d01c1cefc$d0212c80$7301fea9@shantadam> Thank you Benjamin; The one with the ant command work pretty easily. Multispex.com Shant Adam ----- Original Message ----- From: Benjamin Kopic To: ShantAdam ; jdom - interest Sent: Monday, March 18, 2002 6:01 PM Subject: RE: [jdom-interest] JavaDocs If you use Ant (assuming you downloaded the source code version): ant javadoc If you use a web browser http://www.jdom.org/docs/apidocs/index.html -----Original Message----- From: jdom-interest-admin@jdom.org [mailto:jdom-interest-admin@jdom.org]On Behalf Of ShantAdam Sent: 18 March 2002 17:31 To: jdom - interest Subject: [jdom-interest] JavaDocs Hi; How do I get the JavaDocs for JDOM. I just can't find the way. thanks; Multispex Designs Rep.: Shant Adam Tel.: (514) 827-4840 adams@multispex.com http://www.multispex.com --- Visual technology service provider. Fournisseur de service de technologie visuel. --- Copyright 1998-2002? Multispex Designs? -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020318/11299c4b/attachment.htm From collin at telus.net Mon Mar 18 21:48:45 2002 From: collin at telus.net (Collin Peters) Date: Fri Aug 6 17:07:29 2004 Subject: OT: Re: [jdom-interest] JavaDocs In-Reply-To: <000b01c1cea2$a2cc3400$1443a2d8@shantadam> References: <000b01c1cea2$a2cc3400$1443a2d8@shantadam> Message-ID: <20020319054845.GA13186@proximity> I have another question regarding the docs. In the documentation section there are some UML diagrams. I know there are some programs out there that automatically generate these diagrams (I think Rational Rose is one) but I was wondering what was used for the jdom ones. Since jdom is open source I would imagine they wouldn't use a program like RR because it costs a lot of $$$$. Anybody know what was used or if there are any free versions of UML diagram generators? Collin From alex_den at pchome.com.tw Mon Mar 18 23:26:16 2002 From: alex_den at pchome.com.tw (alex_pchome) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Out of memory Error! Message-ID: <011101c1cf17$5d9b97c0$9436728c@mars> Hi All I am writing a jsp for dealing with an xml schema to show its xml structure. But I got "out of memory error". I think it is because of using a loop to deal with the xml schema which may a little big. However I noticed that my system memory didn't run dry. I am sure it's not a dead loop. How can I allocate more memory for my jsp. Or have a suggestion of salving this problem? Window 2000 server Tom cat 4.0 jdom 0.7 Thanks! Alex -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020319/0a4ce518/attachment.htm From jhunter at apache.org Mon Mar 18 23:39:39 2002 From: jhunter at apache.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: OT: Re: [jdom-interest] JavaDocs References: <000b01c1cea2$a2cc3400$1443a2d8@shantadam> <20020319054845.GA13186@proximity> Message-ID: <3C96EB3B.ED661D5B@apache.org> Try View Source on the web page, and it tells you IIRC. -jh- Collin Peters wrote: > > I have another question regarding the docs. > > In the documentation section there are some UML diagrams. I know there are > some programs out there that automatically generate these diagrams (I think > Rational Rose is one) but I was wondering what was used for the jdom ones. > Since jdom is open source I would imagine they wouldn't use a program like > RR because it costs a lot of $$$$. > > Anybody know what was used or if there are any free versions of UML diagram > generators? > > Collin > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From ian.lea at blackwell.co.uk Tue Mar 19 00:57:34 2002 From: ian.lea at blackwell.co.uk (Ian Lea) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Out of memory Error! References: <011101c1cf17$5d9b97c0$9436728c@mars> Message-ID: <3C96FD7E.E1EA90CE@blackwell.co.uk> You can give java more memory by using the -Xmx command line option e.g. java -Xmx64m. Type java -X for details. To get this to work with tomcat 3 on unix add this: TOMCAT_OPTS="-Xmx64m"; export TOMCAT_OPTS to the tomcat startup script. I imagine there is a similar solution for tomcat 4 on win 2000. -- Ian. > alex_pchome wrote: > > Hi All > I am writing a jsp for dealing with an xml schema to show its xml > structure. > But I got "out of memory error". > I think it is because of using a loop to deal with the xml schema which may a > little big. > However I noticed that my system memory didn't run dry. > I am sure it's not a dead loop. > How can I allocate more memory for my jsp. > Or have a suggestion of salving this problem? > > Window 2000 server > Tom cat 4.0 > jdom 0.7 > > Thanks! > Alex From jhunter at acm.org Tue Mar 19 12:53:01 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Re: German Umlaute References: Message-ID: <3C97A52D.6C09BBD4@acm.org> Forwarding to the right list. -jh- Uli Waibel wrote: > > Hi, > > what encoding do I have to define if I have german Umlaute like ?,?,?, ... > With encoding style UTF-8 I get the error invalid unicode character in line > xxx of document yyy. > > One more problem. I am receiving xml documents created by an VB.net > application. By default, vb.net use encoding UTF-16, which results in an > invalid encoding type in document xxx. > Does JDOM (I am using the default XERCES XML parser) not support UTF-16 ? > > Any help is apreciated > > Regards Uli Waibel > JAVA Developer > Germany From elaliotis at yahoo.com Tue Mar 19 13:33:58 2002 From: elaliotis at yahoo.com (manos laliotis) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Re: German Umlaute References: <3C97A52D.6C09BBD4@acm.org> Message-ID: <3C97AEC6.5020809@yahoo.com> You need ISO-8859-1 (ISO-Latin-1) -Manos Jason Hunter wrote: > Forwarding to the right list. > > -jh- > > Uli Waibel wrote: > >>Hi, >> >>what encoding do I have to define if I have german Umlaute like ?,?,?, ... >>With encoding style UTF-8 I get the error invalid unicode character in line >>xxx of document yyy. >> >>One more problem. I am receiving xml documents created by an VB.net >>application. By default, vb.net use encoding UTF-16, which results in an >>invalid encoding type in document xxx. >>Does JDOM (I am using the default XERCES XML parser) not support UTF-16 ? >> >>Any help is apreciated >> >>Regards Uli Waibel >>JAVA Developer >>Germany > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From SOEREN.ARLETH at oracle.com Tue Mar 19 13:35:32 2002 From: SOEREN.ARLETH at oracle.com (soeren.arleth) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Re: German Umlaute Message-ID: <7972157.1016573732007.JavaMail.nobody@web155> Hi, I would expect it to be sufficient with "ISO-8859-1" cheers S?ren Forwarding to the right list. -jh- Uli Waibel wrote: > > Hi, > > what encoding do I have to define if I have german Umlaute like ?,?,?, ... > With encoding style UTF-8 I get the error invalid unicode character in line > xxx of document yyy. > > One more problem. I am receiving xml documents created by an VB.net > application. By default, vb.net use encoding UTF-16, which results in an > invalid encoding type in document xxx. > Does JDOM (I am using the default XERCES XML parser) not support UTF-16 ? > > Any help is apreciated > > Regards Uli Waibel > JAVA Developer > Germany _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com ___________________________________ Soeren Arleth - Oracle Denmark SME Java Development EMEA Java/XML Professional Community -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020319/ca2c630f/attachment.htm From khong.hai.wang at gridnode.com Tue Mar 19 17:33:42 2002 From: khong.hai.wang at gridnode.com (Wang Khong Hai) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] RosettaNet Message-ID: Hi all, Just wondering. Is there any one out there that has implemented an application that can process a very big PIP message in the range of a few MB? If yes, can you share your experience. Thank you. Regards, Khong Hai From alex_den at pchome.com.tw Tue Mar 19 23:40:48 2002 From: alex_den at pchome.com.tw (alex_pchome) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Out of memory Error! References: <011101c1cf17$5d9b97c0$9436728c@mars> <3C96FD7E.E1EA90CE@blackwell.co.uk> Message-ID: <00bd01c1cfe2$8ea54980$9436728c@mars> Hi All&Ian I try to type," java -Xmx64m" In my cmd command line, but it doesn't work. the message is====> --------------------------------------------- Usage: java [-options] class [args...] (to execute a class) or java -jar [-options] jarfile [args...] (to execute a jar file) ------------------------------------------- Or I try " java -Xmx 64m" the message is====> ------------------------------------------- Invalid maximum heap size: -Xmx Could not create the Java virtual machine. ---------------------------------------------- I don't know UNIX, so I guess "TOMCAT_OPTS" is environment variable. So I put it into my W2000 environment variable setting, but still dones't work. Can anyone give more help. Regard Alex Ian wrote: > You can give java more memory by using the -Xmx command > line option e.g. java -Xmx64m. Type java -X for details. > To get this to work with tomcat 3 on unix add this: > > TOMCAT_OPTS="-Xmx64m"; export TOMCAT_OPTS > > to the tomcat startup script. I imagine there is a > similar solution for tomcat 4 on win 2000. > > > > -- > Ian. > > > > alex_pchome wrote: > > > > Hi All > > I am writing a jsp for dealing with an xml schema to show its xml > > structure. > > But I got "out of memory error". > > I think it is because of using a loop to deal with the xml schema which may a > > little big. > > However I noticed that my system memory didn't run dry. > > I am sure it's not a dead loop. > > How can I allocate more memory for my jsp. > > Or have a suggestion of salving this problem? > > > > Window 2000 server > > Tom cat 4.0 > > jdom 0.7 > > > > Thanks! > > Alex > ========================================================== PC home ?q?l?H?c?A????????: http://www.pchome.com.tw PC home Online ?????a?x?G?|?????@?A?x?W???j???J?f???? ========================================================== From violin at thesaguaros.com Wed Mar 20 01:16:38 2002 From: violin at thesaguaros.com (Angelo) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Out of memory Error! References: <011101c1cf17$5d9b97c0$9436728c@mars> <3C96FD7E.E1EA90CE@blackwell.co.uk> <00bd01c1cfe2$8ea54980$9436728c@mars> Message-ID: <3C985376.8090303@thesaguaros.com> alex_pchome wrote: > Hi All&Ian > I try to type," java -Xmx64m" > In my cmd command line, but it doesn't work. > the message is====> > --------------------------------------------- > Usage: java [-options] class [args...] > (to execute a class) > or java -jar [-options] jarfile [args...] > (to execute a jar file) > ------------------------------------------- > > Or I try " java -Xmx 64m" > the message is====> > ------------------------------------------- > Invalid maximum heap size: -Xmx > Could not create the Java virtual machine. > ---------------------------------------------- > I don't know UNIX, so I guess "TOMCAT_OPTS" is environment variable. > So I put it into my W2000 environment variable setting, but still dones't > work. > Can anyone give more help. > Regard > Alex > > Ian wrote: > > > >>You can give java more memory by using the -Xmx command >>line option e.g. java -Xmx64m. Type java -X for details. >>To get this to work with tomcat 3 on unix add this: >> >>TOMCAT_OPTS="-Xmx64m"; export TOMCAT_OPTS >> >>to the tomcat startup script. I imagine there is a >>similar solution for tomcat 4 on win 2000. >> >> >> >>-- >>Ian. >> >> >> >>>alex_pchome wrote: >>> >>>Hi All >>> I am writing a jsp for dealing with an xml schema to show its xml >>>structure. >>>But I got "out of memory error". >>>I think it is because of using a loop to deal with the xml schema which >>> > may a > >>>little big. >>>However I noticed that my system memory didn't run dry. >>>I am sure it's not a dead loop. >>>How can I allocate more memory for my jsp. >>>Or have a suggestion of salving this problem? >>> >>>Window 2000 server >>>Tom cat 4.0 >>>jdom 0.7 >>> >>>Thanks! >>> Alex >>> > > > ========================================================== > PC home ?q?l?H?c?A????????: http://www.pchome.com.tw > PC home Online ?????a?x?G?|?????@?A?x?W???j???J?f???? > ========================================================== > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com > > > You must type "java -Xmx64m" , not "java -Xmx 64m" Bye Angelo From John.Webber at jentro.com Wed Mar 20 03:41:14 2002 From: John.Webber at jentro.com (John L. Webber - Jentro AG) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] JDOM Beta 8 -- works well Message-ID: <3C98755A.7804095E@jentro.com> Finally got around to testing the Beta 8 RC - I only had one slight problem with a ConcurrentModificationException which was easily fixed; otherwise it seems to work fine. We're using it to generate and parse configuration files as well as for message parsing. The config files are typically around 20k or so, occasionally larger. The messages are highly variable in length, with an upper limit of around the size of the config files. Haven't had any time to do any serious performance checking, but at the moment it's not a serious issue for us. OT - is the search function in the archives fully implemented? I tried searching for ConcurrentModificationException both in body and subject, but didn't register any hits. I ended up finding it by hand, since I knew it came up sometime in March. John -- --------------------------------------------------------- Jentro AG John L. Webber, Software Development --------------------------------------------------------- Peter-Henlein-Strasse 28, 85540 Haar/Munich, Germany Tel. +49 89 462 385 0 mailto:John.Webber@jentro.com Fax +49 89 462 385 29 http://www.jentro.com --------------------------------------------------------- From rob at digitalskyscrapers.com Wed Mar 20 18:05:21 2002 From: rob at digitalskyscrapers.com (Rob Finneran) Date: Fri Aug 6 17:07:29 2004 Subject: [jdom-interest] Best practices when using JDOM with XSLT and Servlets 2.2 Message-ID: Hello, I'm using xerces-j 2.0.1, xalan-j 2.3.1, with jdom b8-rc1. I'm also using Jetty 3.1.3 which is a servlets 2.2 engine very simuliar to tomcat 3.2. I dynamically build a JDOM tree from a database and I want to know the best pattern for apply a javax.xml.transform.Templates to the JDOM tree and then to send the result as html back to the browser. Is the best method to use a SAX events outputter to a StringWriter() stream and then to send the String back to the browser via the servlet's Printwriter obtained via response.getWriter()? Doesn't the servlet buffer the response anyway, so the StringWriter output stream would be redundant. I've seen something mentioned about sockets in the FAQ and I saw Brett M's example article, but I'm a little new to some of the java IO classes and coding patterns. Any steering would be appreciated!!! TIA Rob From alex_den at pchome.com.tw Wed Mar 20 18:57:51 2002 From: alex_den at pchome.com.tw (alex_pchome) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Out of memory Error! Message-ID: <014d01c1d084$33c12140$9436728c@mars> I had tried a while. Put this line to Tomcat.bat "set CATALINA_OPTS=-Xmx128m" And it work! Thanks! ----- Original Message ----- From: "alex_pchome" To: "Ian Lea" Cc: Sent: Wednesday, March 20, 2002 3:40 PM Subject: Re: [jdom-interest] Out of memory Error! > Hi All&Ian > I try to type," java -Xmx64m" > In my cmd command line, but it doesn't work. > the message is====> > --------------------------------------------- > Usage: java [-options] class [args...] > (to execute a class) > or java -jar [-options] jarfile [args...] > (to execute a jar file) > ------------------------------------------- > > Or I try " java -Xmx 64m" > the message is====> > ------------------------------------------- > Invalid maximum heap size: -Xmx > Could not create the Java virtual machine. > ---------------------------------------------- > I don't know UNIX, so I guess "TOMCAT_OPTS" is environment variable. > So I put it into my W2000 environment variable setting, but still dones't > work. > Can anyone give more help. > Regard > Alex > > Ian wrote: > > > > You can give java more memory by using the -Xmx command > > line option e.g. java -Xmx64m. Type java -X for details. > > To get this to work with tomcat 3 on unix add this: > > > > TOMCAT_OPTS="-Xmx64m"; export TOMCAT_OPTS > > > > to the tomcat startup script. I imagine there is a > > similar solution for tomcat 4 on win 2000. > > > > > > > > -- > > Ian. > > > > > > > alex_pchome wrote: > > > > > > Hi All > > > I am writing a jsp for dealing with an xml schema to show its xml > > > structure. > > > But I got "out of memory error". > > > I think it is because of using a loop to deal with the xml schema which > may a > > > little big. > > > However I noticed that my system memory didn't run dry. > > > I am sure it's not a dead loop. > > > How can I allocate more memory for my jsp. > > > Or have a suggestion of salving this problem? > > > > > > Window 2000 server > > > Tom cat 4.0 > > > jdom 0.7 > > > > > > Thanks! > > > Alex > > > ========================================================== PC home ?q?l?H?c?A????????: http://www.pchome.com.tw PC home Online ?????a?x?G?|?????@?A?x?W???j???J?f???? ========================================================== From alex_den at pchome.com.tw Wed Mar 20 19:04:20 2002 From: alex_den at pchome.com.tw (alex_pchome) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Out of memory Error! Message-ID: <019701c1d085$2a036d60$9436728c@mars> Sorry! Have a mistake! Tomcat 1.4 put "set CATALINA_OPTS=-Xmx128m" into CATALINA.bat Tomcat 1.3 put "set TOMCAT_OPTS=-Xmx128m" into TOMCAT.bat > I had tried a while. > Put this line to Tomcat.bat > "set CATALINA_OPTS=-Xmx128m" > And it work! > Thanks! > > > ----- Original Message ----- > From: "alex_pchome" > To: "Ian Lea" > Cc: > Sent: Wednesday, March 20, 2002 3:40 PM > Subject: Re: [jdom-interest] Out of memory Error! > > > > Hi All&Ian > > I try to type," java -Xmx64m" > > In my cmd command line, but it doesn't work. > > the message is====> > > --------------------------------------------- > > Usage: java [-options] class [args...] > > (to execute a class) > > or java -jar [-options] jarfile [args...] > > (to execute a jar file) > > ------------------------------------------- > > > > Or I try " java -Xmx 64m" > > the message is====> > > ------------------------------------------- > > Invalid maximum heap size: -Xmx > > Could not create the Java virtual machine. > > ---------------------------------------------- > > I don't know UNIX, so I guess "TOMCAT_OPTS" is environment variable. > > So I put it into my W2000 environment variable setting, but still dones't > > work. > > Can anyone give more help. > > Regard > > Alex > > > > Ian wrote: > > > > > > > You can give java more memory by using the -Xmx command > > > line option e.g. java -Xmx64m. Type java -X for details. > > > To get this to work with tomcat 3 on unix add this: > > > > > > TOMCAT_OPTS="-Xmx64m"; export TOMCAT_OPTS > > > > > > to the tomcat startup script. I imagine there is a > > > similar solution for tomcat 4 on win 2000. > > > > > > > > > > > > -- > > > Ian. > > > > > > > > > > alex_pchome wrote: > > > > > > > > Hi All > > > > I am writing a jsp for dealing with an xml schema to show its xml > > > > structure. > > > > But I got "out of memory error". > > > > I think it is because of using a loop to deal with the xml schema > which > > may a > > > > little big. > > > > However I noticed that my system memory didn't run dry. > > > > I am sure it's not a dead loop. > > > > How can I allocate more memory for my jsp. > > > > Or have a suggestion of salving this problem? > > > > > > > > Window 2000 server > > > > Tom cat 4.0 > > > > jdom 0.7 > > > > > > > > Thanks! > > > > Alex > > > > > > ========================================================== PC home ?q?l?H?c?A????????: http://www.pchome.com.tw PC home Online ?????a?x?G?|?????@?A?x?W???j???J?f???? ========================================================== From leh at pobox.com Wed Mar 20 13:34:02 2002 From: leh at pobox.com (Les Hill) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension Message-ID: <003501c1d056$f455e7c0$6401a8c0@Mozart> Jason, Brett, Recently I downloaded and used JDOM 1b8 for what I imagine to be a common use, persisting some data in XML form. The change from using the W3 DOM API was remarkable, thanks guys! Constructs like: element.addContent(new Element("foo").setAttribute("bar", "true")); made what had been a tedious and error prone process, fairly painless. However, I found myself continually having to convert Java primitive types when using setAttribute(String, String, Namespace). Eventually I wrote a simple subclass which introduced 18 new setAttribute() signatures (9 each for namespace specific and non). This was much better. One big problem remained. I could no longer use the above construct, I had to go to the more long winded: UtilityElement ue = new UtilityElement("foo"); ue.setAttribute("bar", true); element.addContent(ue); This problem could be solved by simply taking the 18 new setAttribute() methods from the utility subclass and adding them directly to Element. This change is very much in line with the JDOM mission statement, and would certainly make life easier for Java developers who are using JDOM to add XML features and functionality to applications which are not directly targeted at manipulating XML -- for example, using XML as a configuration language for a new mail processor or using XML as an intermediate save form in a long-running analyzer program. The utility subclass is directly included below. Thanks again, Les Hill leh@galaxynine.com ----cut here // $Id$ package com.galaxynine.util; import java.text.SimpleDateFormat; import java.util.Date; import org.jdom.Element; import org.jdom.Namespace; public class UtilityElement extends Element { // Use the ISO-8601 extended format used by XML Schema for dateTime private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); public UtilityElement(String name) { super(name); } public Element setAttribute(String name, boolean value) { return setAttribute(name, Boolean.toString(value)); } public Element setAttribute(String name, byte value) { return setAttribute(name, Byte.toString(value)); } public Element setAttribute(String name, char value) { return setAttribute(name, Character.toString(value)); } public Element setAttribute(String name, Date value) { return setAttribute(name, dateFormat.format(value)); } public Element setAttribute(String name, double value) { return setAttribute(name, Double.toString(value)); } public Element setAttribute(String name, float value) { return setAttribute(name, Float.toString(value)); } public Element setAttribute(String name, int value) { return setAttribute(name, Integer.toString(value)); } public Element setAttribute(String name, long value) { return setAttribute(name, Long.toString(value)); } public Element setAttribute(String name, short value) { return setAttribute(name, Short.toString(value)); } public Element setAttribute(String name, boolean value, Namespace ns) { return setAttribute(name, Boolean.toString(value), ns); } public Element setAttribute(String name, byte value, Namespace ns) { return setAttribute(name, Byte.toString(value), ns); } public Element setAttribute(String name, char value, Namespace ns) { return setAttribute(name, Character.toString(value), ns); } public Element setAttribute(String name, Date value, Namespace ns) { return setAttribute(name, dateFormat.format(value), ns); } public Element setAttribute(String name, double value, Namespace ns) { return setAttribute(name, Double.toString(value), ns); } public Element setAttribute(String name, float value, Namespace ns) { return setAttribute(name, Float.toString(value), ns); } public Element setAttribute(String name, int value, Namespace ns) { return setAttribute(name, Integer.toString(value), ns); } public Element setAttribute(String name, long value, Namespace ns) { return setAttribute(name, Long.toString(value), ns); } public Element setAttribute(String name, short value, Namespace ns) { return setAttribute(name, Short.toString(value), ns); } } ----cut here From Mike at Viens.com Wed Mar 20 21:06:14 2002 From: Mike at Viens.com (Mike Viens) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] BETA8 bug Message-ID: <001201c1d096$1ffd72a0$0301a8c0@groksoftware.com> // masterChildren is populated with elements from a different Document // BETA8 bug? // example: when masterChildren has 4 elements, only two are ever processed // the list (masterChildren) is somehow being modified within the for loop // when the resource.detach() method is called - this works in BETA7 for (int j = 0; j < masterChildren.size(); j++) { Element resource = (Element)masterChildren.get(j); // this line causes items in the list to be removed! entity.addContent(resource.detach()); } // solution 1 - to fix it in beta 8 Element entity = ........ Vector newChildren = new Vector(); for (int j = 0; j < masterChildren.size(); j++) { Element resource = (Element)masterChildren.get(j); newChildren.add(resource); } for (int j = 0; j < newChildren.size(); j++) { Element resource = (Element)newChildren.get(j); entity.addContent(resource.detach()); System.out.println("finished child: " + j + " - total: " + newChildren.size()); } // solution 2 - this also works // change this line: // for (int j = 0; j < masterChildren.size(); j++) // to this: // for (int j = 0; j < masterChildren.size(); ) From jhunter at servlets.com Wed Mar 20 23:54:16 2002 From: jhunter at servlets.com (Jason Hunter) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension References: <003501c1d056$f455e7c0$6401a8c0@Mozart> Message-ID: <3C9991A8.6570D3CD@servlets.com> > Recently I downloaded and used JDOM 1b8 for what I imagine to be a common > use, persisting some data in XML form. The change from using the W3 DOM API > was remarkable, thanks guys! Constructs like: > > element.addContent(new Element("foo").setAttribute("bar", "true")); > > made what had been a tedious and error prone process, fairly painless. Glad to hear it. > However, I found myself continually having to convert Java primitive types > when using setAttribute(String, String, Namespace). Have you thought about just using the ""+ trick? setAttribute("somefloat", "" + yourfloat); setAttribute("somebool", "" + true); It's not too bad, and probably nicer than making Element larger. One goal of JDOM is simplicity. -jh- From laurent.bihanic at atosorigin.com Thu Mar 21 00:44:00 2002 From: laurent.bihanic at atosorigin.com (Laurent Bihanic) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Best practices when using JDOM with XSLT and Servlets 2.2 References: Message-ID: <3C999D50.6070508@atosorigin.com> Hi Rob, The best way to interface JDOM to XSLT processors is to use the org.jdom.transform.JDOMSource and org.jdom.transform.JDOMResult. These classes extends the javax.xml.transform.sax.SAXSource/SAXResult and should be recognized by all XSLT processors using SAX. Xalan and Saxon do. Using JDOMSource is as simple as: templates.newTransformer().transform(new JDOMSource(myDoc), result); result being a StreamResult wrapping response.getWriter(). Laurent Rob Finneran wrote: > Hello, > > I'm using xerces-j 2.0.1, xalan-j 2.3.1, with jdom b8-rc1. I'm also using > Jetty 3.1.3 which is a servlets 2.2 engine very simuliar to tomcat 3.2. > > I dynamically build a JDOM tree from a database and I want to know the best > pattern for apply a javax.xml.transform.Templates to the JDOM tree > and then to send the result as html back to the browser. > > Is the best method to use a SAX events outputter to a StringWriter() stream > and then to send the String back to the browser via the servlet's > Printwriter obtained via response.getWriter()? Doesn't the servlet buffer > the response anyway, so the StringWriter output stream would be redundant. > > I've seen something mentioned about sockets in the FAQ and I saw Brett M's > example article, but I'm a little new to some of the java IO classes and > coding patterns. > > Any steering would be appreciated!!! > > TIA > > Rob From Robert.Gulyas at compactive.com Thu Mar 21 04:20:17 2002 From: Robert.Gulyas at compactive.com (Robert Gulyas) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Document validating in memory (JDOM beginner) Message-ID: <3C99D001.6040804@compactive.com> Hi All, I need to validate my Document againts a DTD before it's sent back to the client in a Tomcat webserver. Can it be done in the memory in a simple, not memory exhausting way? Please help me with any suggestion! Thank you in advance, Robert PS: I used the mail archives but I didn't find any solution... From jhunter at servlets.com Thu Mar 21 10:50:10 2002 From: jhunter at servlets.com (Jason Hunter) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Document validating in memory (JDOM beginner) References: <3C99D001.6040804@compactive.com> Message-ID: <3C9A2B62.39FF7188@servlets.com> Not currently. It's a feature we'd like to see added. The best way to validate after manipulation is to output and re-parse the file letting the parser validate. It's not great, but it's no worse than DOM. -jh- Robert Gulyas wrote: > > Hi All, > > I need to validate my Document againts a DTD before it's sent back to > the client in a Tomcat webserver. Can it be done in the memory in a > simple, not memory exhausting way? Please help me with any suggestion! > > Thank you in advance, > Robert > > PS: I used the mail archives but I didn't find any solution... > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From leh at galaxynine.com Thu Mar 21 10:51:28 2002 From: leh at galaxynine.com (Les Hill) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension References: <003501c1d056$f455e7c0$6401a8c0@Mozart> <3C9991A8.6570D3CD@servlets.com> Message-ID: <007c01c1d109$695259c0$6401a8c0@Mozart> jhunter@servlets.com writes: > Have you thought about just using the ""+ trick? Actually, yes. Using "" + is better than: setAttribute("myFloat", Float.toString(someFloat)); But suffers from the same problem in the long run. Doing it once or twice or ten times is OK, scattering it everywhere begs for a cleaner solution. > It's not too bad, and probably nicer than making Element larger. One > goal of JDOM is simplicity. Not to beat a dead horse, but simplicity does not imply minimalism. I would argue that extending the API to include utility methods providing *exactly* the same intention+ with similar but not the same signatures, does not introduce complexity and promotes use. As an example of how this kind of utility method is useful, I recently switched over to 1.4 and started using the 1.4 logging instead of log4j. Both have the generic log method (signatures not exactly correct for clarity): log.log(Level level, String msg) which writes the message to the log at the specified level. Both also have utility methods of the form: log.warning(String msg) which writes the msg to the log at a warning level. However, when it comes to exceptions, the log system in 1.4 only provides the generic method: log.log(Level level, String msg, Throwable thrown) while log4j provides the generic and the various utility methods: log.warning(String msg, Throwable thrown) No difference in functionality: in either case the message is written with a stack trace at the given level. Amazing difference in daily ease of use. I offer this as a suggestion as a user of JDOM who is not trying to manipulate XML documents per se, but rather as a user who is using XML as an adjunct to everyday applications where attributes are regularly a native Java type instead of String. + In this case setting the value of an attribute -- this would be opposed to overridden signatures that change intended behaviors. Regards, Les Hill leh@galaxynine.com From jhunter at acm.org Thu Mar 21 11:38:43 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension References: <003501c1d056$f455e7c0$6401a8c0@Mozart> <3C9991A8.6570D3CD@servlets.com> <007c01c1d109$695259c0$6401a8c0@Mozart> Message-ID: <3C9A36C3.4AFCBC2B@acm.org> Comments from the list? The good part about an open source project is we can see what people think? I'm easy either way. My one concern is do these methods go on Element (setAttribute), Attribute (setValue), or both? -jh- Les Hill wrote: > > jhunter@servlets.com writes: > > Have you thought about just using the ""+ trick? > > Actually, yes. Using "" + is better than: > > setAttribute("myFloat", Float.toString(someFloat)); > > But suffers from the same problem in the long run. Doing it once or twice > or ten times is OK, scattering it everywhere begs for a cleaner solution. > > > It's not too bad, and probably nicer than making Element larger. One > > goal of JDOM is simplicity. > > Not to beat a dead horse, but simplicity does not imply minimalism. > > I would argue that extending the API to include utility methods providing > *exactly* the same intention+ with similar but not the same signatures, does > not introduce complexity and promotes use. > > As an example of how this kind of utility method is useful, I recently > switched over to 1.4 and started using the 1.4 logging instead of log4j. > Both have the generic log method (signatures not exactly correct for > clarity): > > log.log(Level level, String msg) > > which writes the message to the log at the specified level. Both also have > utility methods of the form: > > log.warning(String msg) > > which writes the msg to the log at a warning level. However, when it comes > to exceptions, the log system in 1.4 only provides the generic method: > > log.log(Level level, String msg, Throwable thrown) > > while log4j provides the generic and the various utility methods: > > log.warning(String msg, Throwable thrown) > > No difference in functionality: in either case the message is written with a > stack trace at the given level. Amazing difference in daily ease of use. > > I offer this as a suggestion as a user of JDOM who is not trying to > manipulate XML documents per se, but rather as a user who is using XML as an > adjunct to everyday applications where attributes are regularly a native > Java type instead of String. > > + In this case setting the value of an attribute -- this would be opposed to > overridden signatures that change intended behaviors. > > Regards, > > Les Hill > leh@galaxynine.com From kenh at csc.no Thu Mar 21 11:47:10 2002 From: kenh at csc.no (Ken Rune Helland) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Document validating in memory (JDOM beginner) In-Reply-To: <3C9A2B62.39FF7188@servlets.com> References: <3C9A2B62.39FF7188@servlets.com> Message-ID: <1490.195.139.2.171.1016740030.squirrel@classic.csc.no> > Not currently. It's a feature we'd like to see added. The best way to > validate after manipulation is to output and re-parse the file letting > the parser validate. It's not great, but it's no worse than DOM. > > -jh- > > Robert Gulyas wrote: >> >> Hi All, >> >> I need to validate my Document againts a DTD before it's sent back to >> the client in a Tomcat webserver. Can it be done in the memory in a >> simple, not memory exhausting way? Please help me with any suggestion! Hello. I'm only guessing here but woudnt it make sense if you implement a sax-parser to have one layer that reads the xml and if validation is turned on feed the sax events to a second layer doing the validation. If so and the sax-parsers often being open source it shoud be possible to use the second layer and feed it events from the saxoutputter. My exsperiense with XSLT is that feeding transformers sax-events via JDOMSource is about 30% faster than feeding it a xml stream via outputter and streamsource. I woud expect a sax-consuming validation to have at least the same speedup for validation. I'm sorry I'dont have time too look onto this in any near future, but I thought I woud throw the idea into the forum for any sax-gurus with som free time on their hands to ponder on. Greetings KenR From hip at a.cs.okstate.edu Thu Mar 21 12:03:23 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension In-Reply-To: Your message of "Thu, 21 Mar 2002 11:38:43 PST." <3C9A36C3.4AFCBC2B@acm.org> Message-ID: <200203212004.NAA24352@dorothy.denveronline.net> Jason Hunter writes: > Comments from the list? The good part about an open source project is > we can see what people think? I'm easy either way. > > My one concern is do these methods go on Element (setAttribute), > Attribute (setValue), or both? Attribute, as constructors and setValue/getValue methods. And would you need/want all the incarnations or just String (most used), Object (generic), and the primitives long, double, and boolean? Brad From elharo at metalab.unc.edu Thu Mar 21 14:44:23 2002 From: elharo at metalab.unc.edu (Elliotte Rusty Harold) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension In-Reply-To: <3C9A36C3.4AFCBC2B@acm.org> References: <003501c1d056$f455e7c0$6401a8c0@Mozart> <3C9991A8.6570D3CD@servlets.com> <007c01c1d109$695259c0$6401a8c0@Mozart> <3C9A36C3.4AFCBC2B@acm.org> Message-ID: At 11:38 AM -0800 3/21/02, Jason Hunter wrote: >Comments from the list? The good part about an open source project is >we can see what people think? I'm easy either way. > >My one concern is do these methods go on Element (setAttribute), >Attribute (setValue), or both? > I just find this really unnecessary. It's just another symptom of API bloat. Everyone has their own convenience methods that they want, most of which aren't useful to more than 10% of users. Java has perfectly good ways to convert primitive data types to strings. There's no need for JDOM to reinvent them. Minimalism is part of simplicity. It makes it easier to look at the Javadoc and grok everything you need to understand. The bigger it gets the harder it becomes to learn this in the first place. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ From arosen at silverstream.com Thu Mar 21 15:07:14 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension In-Reply-To: <007c01c1d109$695259c0$6401a8c0@Mozart> Message-ID: <004b01c1d12d$24e0cb90$6a65810a@silverstream.com> I am certainly sympathetic to this desire. For some uses of JDOM it makes the API a lot more pleasant to use. But it's not obvious to me if it's worth the tradeoff. I looked at this a while ago in a slightly different context - getters instead of setters, and on a helper class to reduce core API size. http://www.servlets.com/archive/servlet/ReadMsg?msgId=7909&listName=jdom-int erest It just gets unwieldy pretty quickly. You'd want to limit yourself to 3-5 datatypes; if you added setters you'd also want getters; and you'd want to do it for both attributes and text content. That's 12-20 new methods on Element. (Plus would you want them in constructors for Attribute and Text? Maybe that's overkill.) The getters introduce even more complexity - what do you do if the attribute/text doesn't exist, throw an exception or have some sort of default? What if it's not formatted properly? For that matter, for the setter, does the double value 12.34 become "12.34" or "12,34"? Does it depend on the locale? Ugh. I could stomach it if we limited ourselves to int and boolean, which I think are the 80% case or more. We'd have to explain that for anything else, you have to do it yourself (which isn't that hard). Alex From arosen at silverstream.com Thu Mar 21 15:16:17 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] BETA8 bug In-Reply-To: <001201c1d096$1ffd72a0$0301a8c0@groksoftware.com> Message-ID: <004c01c1d12e$67a175a0$6a65810a@silverstream.com> This new behavior is exactly how it's supposed to work. The List returned from getChildren() is defined in the API to be a "live" list, but before now it wasn't as live, so changes to the Element weren't reflected in the previously-returned list. Now they are. Your workarounds are fine, though in your second example it would be a little clearer to use: while(masterChildren.size() > 0) and just used get(0) instead of get(j). Another simple (but perhaps not so obvious) fix is to add something like: masterList = new ArrayList(masterList); Since the ArrayList won't change when the parent Element changes, this will work fine. Another solution is: Iterator iter = masterList.iterator(); while(iter.hasNext()) { Element resource = (Element)iter.next(); iter.remove(); entity.addContent(resource); } The remove() call will both detach the child from the parent Element, and also will make sure that the Iterator doesn't get messed up by the removal. Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Mike Viens > Sent: Thursday, March 21, 2002 12:06 AM > To: jdom-interest@jdom.org > Subject: [jdom-interest] BETA8 bug > > > // masterChildren is populated with elements from a different Document > > > // BETA8 bug? > // example: when masterChildren has 4 elements, only two are ever > processed > // the list (masterChildren) is somehow being modified within the for > loop > // when the resource.detach() method is called - this works in BETA7 > for (int j = 0; j < masterChildren.size(); j++) > { > Element resource = (Element)masterChildren.get(j); > // this line causes items in the list to be removed! > entity.addContent(resource.detach()); > } > > > // solution 1 - to fix it in beta 8 > Element entity = ........ > Vector newChildren = new Vector(); > for (int j = 0; j < masterChildren.size(); j++) > { > Element resource = (Element)masterChildren.get(j); > newChildren.add(resource); > } > > for (int j = 0; j < newChildren.size(); j++) > { > Element resource = (Element)newChildren.get(j); > entity.addContent(resource.detach()); > System.out.println("finished child: " + j + " - total: " + > newChildren.size()); > } > > > // solution 2 - this also works > // change this line: > // for (int j = 0; j < masterChildren.size(); j++) > // to this: > // for (int j = 0; j < masterChildren.size(); ) > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yo uraddr@yourhost.com From james.todd at Sun.COM Thu Mar 21 15:21:28 2002 From: james.todd at Sun.COM (james todd) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request forAPI extension References: <003501c1d056$f455e7c0$6401a8c0@Mozart> <3C9991A8.6570D3CD@servlets.com> <007c01c1d109$695259c0$6401a8c0@Mozart> <3C9A36C3.4AFCBC2B@acm.org> Message-ID: <3C9A6AF8.D143C42C@Sun.COM> i concur. perhaps ideas such as these should be tried out initially as "white board" utils ... and if they prove viable and such then applied knowingly to jdom proper. kind of a survival of the fittest model. - james Elliotte Rusty Harold wrote: > > At 11:38 AM -0800 3/21/02, Jason Hunter wrote: > >Comments from the list? The good part about an open source project is > >we can see what people think? I'm easy either way. > > > >My one concern is do these methods go on Element (setAttribute), > >Attribute (setValue), or both? > > > > I just find this really unnecessary. It's just another symptom of API > bloat. Everyone has their own convenience methods that they want, > most of which aren't useful to more than 10% of users. Java has > perfectly good ways to convert primitive data types to strings. > There's no need for JDOM to reinvent them. Minimalism is part of > simplicity. It makes it easier to look at the Javadoc and grok > everything you need to understand. The bigger it gets the harder it > becomes to learn this in the first place. > -- > > +-----------------------+------------------------+-------------------+ > | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | > +-----------------------+------------------------+-------------------+ > | The XML Bible, 2nd Edition (Hungry Minds, 2001) | > | http://www.cafeconleche.org/books/bible2/ | > | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | > +----------------------------------+---------------------------------+ > | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | > | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | > +----------------------------------+---------------------------------+ > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From christian.holmqvist at posten.se Fri Mar 22 00:47:44 2002 From: christian.holmqvist at posten.se (Christian Holmqvist, IT, Posten) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Document validating in memory (JDOM beginner) Message-ID: <47A7A345A47842479AC7889B9BEB951A0418BB29@001exmbs004.ad.posten.se> Hi! I had a thread here about realtime validation when building XML (from the code i.e. not with a stream!!) documents with JDom for about 1,5 years ago. The idea was kind of simple, * a wrapper for the Document that instantiated with a DTD/Schema. (To keep realtime validation seperated from "Normal" Document handling. * X (elements, attributes what ever) is created in normal fashion (without attachment to a document). * as the X is added to the wrapper controlles if it is a valid object to add at the point of the document the curser is positioned. * if incorrect, exception is thrown or some other form of indication. So what is the hard part of this? Well first a step by step validator kind of a debugger running step by step operations... The drawback is ofcourse that the performance of the document handling with the wrapper would be impacted, but when the document is done it IS done!! If I don't recall incorrectly I think it was you Jason that discarded this idea as not inside the JDom scope... *smile* /Christian "Acroo" Holmqvist Software Engineer, Posten IT Sweden. > Not currently. It's a feature we'd like to see added. The > best way to > validate after manipulation is to output and re-parse the file letting > the parser validate. It's not great, but it's no worse than DOM. > > -jh- > > Robert Gulyas wrote: > > > > Hi All, > > > > I need to validate my Document againts a DTD before it's > sent back to > > the client in a Tomcat webserver. Can it be done in the memory in a > > simple, not memory exhausting way? Please help me with any > suggestion! > > > > Thank you in advance, > > Robert > > > > PS: I used the mail archives but I didn't find any solution... > > > > _______________________________________________ > > To control your jdom-interest membership: > > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com From patrick.dowler at nrc.ca Fri Mar 22 10:21:58 2002 From: patrick.dowler at nrc.ca (Patrick Dowler) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension In-Reply-To: <004b01c1d12d$24e0cb90$6a65810a@silverstream.com> References: <004b01c1d12d$24e0cb90$6a65810a@silverstream.com> Message-ID: <200203221821.LAA27266@dorothy.denveronline.net> As some one who is using JDOM to read/write files with many primitive types and who is converting them to/from the appropriate type, I'd have to say that these methods are extraneous. Generally, one can confine these conversions to a few classes and then a suitable overloaded method of the form private String str( double d ) { ... } makes the code look ok. It also means if you decide to switch from an implementation like return ++"d; to return Double.toString( d ); to return NumberFormat.getInstance( locale ).format( d ); you can do it in one place AND you get to decide/ which you need and change it if required. It also makes sure users remian aware that XML is a text representation. Many people I encounter forget that floating point values are not always represented properly as strings... the term "blissfully unaware" comes to mind :-) I don't think adding a lot of methods (and it is a lot!!) methods to the API is warranted. On 21 March 2002 15:07, Alex Rosen wrote: > I am certainly sympathetic to this desire. For some uses of JDOM it makes > the API a lot more pleasant to use. But it's not obvious to me if it's > worth the tradeoff. I looked at this a while ago in a slightly different > context - getters instead of setters, and on a helper class to reduce core > API size. > > http://www.servlets.com/archive/servlet/ReadMsg?msgId=7909&listName=jdom-in >t erest > > It just gets unwieldy pretty quickly. You'd want to limit yourself to 3-5 > datatypes; if you added setters you'd also want getters; and you'd want to > do it for both attributes and text content. That's 12-20 new methods on > Element. (Plus would you want them in constructors for Attribute and Text? > Maybe that's overkill.) The getters introduce even more complexity - what > do you do if the attribute/text doesn't exist, throw an exception or have > some sort of default? What if it's not formatted properly? For that matter, > for the setter, does the double value 12.34 become "12.34" or "12,34"? Does > it depend on the locale? Ugh. > > I could stomach it if we limited ourselves to int and boolean, which I > think are the 80% case or more. We'd have to explain that for anything > else, you have to do it yourself (which isn't that hard). > > Alex > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourho >st.com -- Patrick Dowler Canadian Astronomy Data Centre National Research Council Victoria, BC From jason at supernovasoftware.com Fri Mar 22 11:52:43 2002 From: jason at supernovasoftware.com (Jason Long) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] JDOM performance Linux vs. Window 2000 Message-ID: Has anyone benchmarked JDOM running on an identical machine using Linux vs. Windows? I have been using JDOM a lot in my applications which run primarily as servlets in Tomcat 4.0.3. I want to switch some of my servers from Windows 2000 to Redhat 7.2. I would appreciate any comment on performance of JDOM or Tomcat in general on Linux/Windows 2000. Best Regards, Jason Long - President Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering From jhunter at apache.org Fri Mar 22 12:44:15 2002 From: jhunter at apache.org (Jason Hunter) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] JDOM performance Linux vs. Window 2000 References: Message-ID: <3C9B979F.64BF6C0C@apache.org> The most important determinent of JDOM performance is likely to be your JVM. For example, I'm seeing JDK 1.4.0 with HotSpot to be about 3x faster than JDK 1.2.2 with a JIT, on one application. This is on Win2K. -jh- Jason Long wrote: > > Has anyone benchmarked JDOM running on an identical machine using Linux vs. > Windows? I have been using JDOM a lot in my applications which run > primarily as servlets in Tomcat 4.0.3. I want to switch some of my servers > from Windows 2000 to Redhat 7.2. I would appreciate any comment on > performance of JDOM or Tomcat in general on Linux/Windows 2000. > > Best Regards, > > Jason Long - President > Supernova Software - supernovasoftware.com > BS Physics, MS Chemical Engineering > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From leh at galaxynine.com Fri Mar 22 13:11:23 2002 From: leh at galaxynine.com (Les Hill) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension Message-ID: <003b01c1d1e6$1f416ff0$6401a8c0@Mozart> patrick.dowler@nrc.ca wrote: Patrick, you are 95% of the way there! You just need a nudge... >Generally, one can confine these conversions to a few classes and then a >suitable overloaded method of the form > > private String str( double d ) { ... } > >makes the code look ok. This works for a while, then you add one or two or ten classes and decide that cutting and pasting the same set of static methods to every new class is a wee-bit tedious and error-producing. Of course, you could try to factor all these methods up to a base class (or classes) and that might work for while as well. Eventually, you will simply write one class that handles all the conversions for you. At that point you will end up asking yourself: why do I have to create this utility class to handle native types? You bring up another point: >return NumberFormat.getInstance( locale ).format( d ); > >you can do it in one place AND you get to decide/ which you need and change it if required. You always had (and would continue to have) this capability, the proposed changes are not taking anything away. Les Hill leh@galaxynine.com From jhunter at apache.org Fri Mar 22 14:23:59 2002 From: jhunter at apache.org (Jason Hunter) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Document validating in memory (JDOM beginner) References: <47A7A345A47842479AC7889B9BEB951A0418BB29@001exmbs004.ad.posten.se> Message-ID: <3C9BAEFF.289096B@apache.org> The problem I said back then was if your DTD requires two child elts, you'll have a very hard time adding them. Add one and you're told it's illegal. You'd need to transactionally add the two, and that's quite a burden. It appeared easier and faster to just check after manipulations that the document was still valid. Brad seems to have ideas along the lines of what you proposed, and I'd be interested to see what he comes up with given his great track record, but that's the reason for my concern. -jh- "Christian Holmqvist, IT, Posten" wrote: > > Hi! > > I had a thread here about realtime validation when building XML (from the > code i.e. not with a stream!!) documents with JDom for about 1,5 years ago. > > The idea was kind of simple, > * a wrapper for the Document that instantiated with a DTD/Schema. (To keep > realtime validation seperated from "Normal" Document handling. > * X (elements, attributes what ever) is created in normal fashion (without > attachment to a document). > * as the X is added to the wrapper controlles if it is a valid object to add > at the point of the document the curser is positioned. > * if incorrect, exception is thrown or some other form of indication. > > So what is the hard part of this? Well first a step by step validator kind > of a debugger running step by step operations... > > The drawback is ofcourse that the performance of the document handling with > the wrapper would be impacted, but when the document is done it IS done!! > > If I don't recall incorrectly I think it was you Jason that discarded this > idea as not inside the JDom scope... *smile* > > /Christian "Acroo" Holmqvist > Software Engineer, Posten IT Sweden. > > > Not currently. It's a feature we'd like to see added. The > > best way to > > validate after manipulation is to output and re-parse the file letting > > the parser validate. It's not great, but it's no worse than DOM. > > > > -jh- > > > > Robert Gulyas wrote: > > > > > > Hi All, > > > > > > I need to validate my Document againts a DTD before it's > > sent back to > > > the client in a Tomcat webserver. Can it be done in the memory in a > > > simple, not memory exhausting way? Please help me with any > > suggestion! > > > > > > Thank you in advance, > > > Robert > > > > > > PS: I used the mail archives but I didn't find any solution... > > > > > > _______________________________________________ > > > To control your jdom-interest membership: > > > > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos > t.com > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos > t.com From ddlucas at lse.com Sat Mar 23 05:56:10 2002 From: ddlucas at lse.com (David D. Lucas) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] JDOM performance Linux vs. Window 2000 References: <3C9B979F.64BF6C0C@apache.org> Message-ID: <3C9C897A.60807@lse.com> For the best performance on server side with Linux, we use IBM JVM 1.3.0. But do not use it for GUI it has problems displaying in KDE 2.x. JDOM 1.0 beta8 rc1 with Xerces 2.01 works great, is faster and fixed some memory overhead we were seeing. I would expect from a purely JVM standpoint they will be about the same performance on win2k and linux. The issues you will see is Linux behaves somewhat better over a longer period of time. Things like memory management and multitasking seem to run smoother on Linux than W2K. There are also a few Linux Kernel patches coming down the road to improve context switching between threads that will make the platform standout more. Hope that helps some. Dave Jason Hunter wrote: > The most important determinent of JDOM performance is likely to be your > JVM. For example, I'm seeing JDK 1.4.0 with HotSpot to be about 3x > faster than JDK 1.2.2 with a JIT, on one application. This is on Win2K. > > -jh- > > Jason Long wrote: > >>Has anyone benchmarked JDOM running on an identical machine using Linux vs. >>Windows? I have been using JDOM a lot in my applications which run >>primarily as servlets in Tomcat 4.0.3. I want to switch some of my servers >>from Windows 2000 to Redhat 7.2. I would appreciate any comment on >>performance of JDOM or Tomcat in general on Linux/Windows 2000. >> >>Best Regards, >> >>Jason Long - President >>Supernova Software - supernovasoftware.com >>BS Physics, MS Chemical Engineering >> >>_______________________________________________ >>To control your jdom-interest membership: >>http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com >> > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com > > -- +------------------------------------------------------------+ | David Lucas mailto:ddlucas@lse.com | | Lucas Software Engineering, Inc. (740) 964-6248 Voice | | Unix,Java,C++,CORBA,XML,EJB (614) 668-4020 Mobile | | Middleware,Frameworks (888) 866-4728 Fax/Msg | +------------------------------------------------------------+ | GPS Location: 40.0150 deg Lat, -82.6378 deg Long | | IMHC: "Jesus Christ is the way, the truth, and the life." | | IMHC: "I know where I am; I know where I'm going." <>< | +------------------------------------------------------------+ Notes: PGP Key Block=http://www.lse.com/~ddlucas/pgpblock.txt IMHO="in my humble opinion" IMHC="in my humble conviction" All trademarks above are those of their respective owners. From galuc at ebruit.com Sat Mar 23 09:19:43 2002 From: galuc at ebruit.com (Galuc) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Problems with the format of the XML file(JDOM beginner) References: <3C9A2B62.39FF7188@servlets.com> <1490.195.139.2.171.1016740030.squirrel@classic.csc.no> Message-ID: <001801c1d28e$eceeda70$f0adb8c3@szg> Hi! I use: XMLOutputter outputter = new XMLOutputter(" ",true); to write the XML file. When I save a new Element, in my XML file plus new lines are added to the already existing Elements and their children. So becomes my XML file very large and is full with emty lines. Galuc From jhunter at acm.org Sat Mar 23 09:41:10 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Problems with the format of the XML file(JDOM beginner) References: <3C9A2B62.39FF7188@servlets.com> <1490.195.139.2.171.1016740030.squirrel@classic.csc.no> <001801c1d28e$eceeda70$f0adb8c3@szg> Message-ID: <3C9CBE36.53146879@acm.org> So use the default XMLOutputter constructor, the one where you aren't telling it to add whitespace and new lines. The Javadocs on XMLOutputter are actually quite good, so go check them out. -jh- Galuc wrote: > > Hi! > > I use: > XMLOutputter outputter = new XMLOutputter(" ",true); > to write the XML file. > > When I save a new Element, in my XML file plus new lines are added to the > already existing Elements and their children. So becomes my XML file very > large and is full with emty lines. > > Galuc > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com From philip.nelson at omniresources.com Sat Mar 23 13:21:54 2002 From: philip.nelson at omniresources.com (philip.nelson@omniresources.com) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension Message-ID: > Eventually, you will simply write one class that handles all > the conversions for you. At that point you will end up > asking yourself: why do I have to create this utility class > to handle native types? Why doesn't someone who feels strongly about this do what Alex Rosen started(and abandoned because of how many methods were required). Put together a utility class with static methods and add it to JDOM contrib. If it turns out people are constantly using it, it may make more sense to me to add it to the core. If not, it would still be useful to those who like the idea. From noamt at yahoo.com Sat Mar 23 14:32:06 2002 From: noamt at yahoo.com (Noam Tamim) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Problems with the format of the XML file(JDOM beginner) In-Reply-To: <3C9CBE36.53146879@acm.org> Message-ID: <20020323223206.23608.qmail@web13903.mail.yahoo.com> --- Jason Hunter wrote: > So use the default XMLOutputter constructor, the one where you aren't > telling it to add whitespace and new lines. The Javadocs on > XMLOutputter are actually quite good, so go check them out. I think he refers to the bug that was fixed a few weeks ago, with adding extra lines. ===== Noam. __________________________________________________ Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® http://movies.yahoo.com/ From ana_bhatta at yahoo.com Sat Mar 23 17:21:20 2002 From: ana_bhatta at yahoo.com (Anamitra Bhattacharyya) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] JDOM future?? Message-ID: <20020324012120.80239.qmail@web20304.mail.yahoo.com> Hi All I am planning to use JDOM in our product for reading XML messages. But I am a bit hesitant as JDOM is still in beta stage - which is going on for couple of years. I want to know whats the future of JDOM? will it ever come out of beta - I have heard that JDOM may be a part of JDK 1.5 - is there any truth to it? In all before jumping into JDOM I would really like to know the direction of this project. If anyone give me any info on that front - it would be of great help. TIA Anamitra --------------------------------- Do You Yahoo!? Yahoo! Movies - coverage of the 74th Academy Awards® -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020323/69419e6f/attachment.htm From elharo at metalab.unc.edu Mon Mar 25 07:28:27 2002 From: elharo at metalab.unc.edu (Elliotte Rusty Harold) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] A utility Element subclass and a request for API extension In-Reply-To: References: Message-ID: One thing that hasn't been addressed in this thread, at least not this time around: Converting primitive data types to strings is not a trivial operation. It requires careful consideration of the needs of the local environment, particularly with regard to internationalization. Java is perhaps the first major programming language to recognize this. It has rather sophisticated facilities for localized conversions and formatting. For example, what string should a boolean true be converted to? "true"? "TRUE"? "1"? "vrai"? "verdad"? "allineare"? "zutreffend"? something else? How about the floating point number for pi? "3.1415292", "3 1415292" or "3,1415292"? Integers are the only types that can perhaps be reliably converted, but even that's shaky. The number 72 would look very different in Egypt where they use real Arabic digits. Negative seventy-two could be -72 or (72) depending on context. This is all very tricky. I don't think the JDOM project wants to be in the business of figuring out how to make these conversions and addressing all the important issues of localization and internationalization, especially when the Java class library already provides excellent support for these operations in a fully localizable way. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ From dms at sosnoski.com Mon Mar 25 15:14:06 2002 From: dms at sosnoski.com (Dennis Sosnoski) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Updated benchmark results Message-ID: <3C9FAF3E.3090308@sosnoski.com> Hi all, I've updated my Java XML document model benchmark results at http://www.sosnoski.com/opensrc/xmlbench/index.html. These are still using the Beta 7 version of JDOM (the tests were actually run in early February), but now that all the text has been brought up to date it should be easier for me to rerun the tests and update the results when Beta 8 is released. - Dennis From shaik at pps.sdl.melco.co.jp Tue Mar 26 00:43:39 2002 From: shaik at pps.sdl.melco.co.jp (Shaik Zulfakhar Ali) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] (no subject) Message-ID: <003901c1d4a2$53d6a190$3dcc8c0a@Sys61> signoff JDOM-INTEREST From rzuidema at hotmail.com Tue Mar 26 05:57:54 2002 From: rzuidema at hotmail.com (Robert Zuidema) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Read a XML file inside a Jar Message-ID: I am trying to read a XML file that is inside a JAR. Is this possible? Can someone provide a sniplet of code for this? Thanks, Bob Zuidema _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. From stephan.segschneider at snellwilcox.com Tue Mar 26 06:13:33 2002 From: stephan.segschneider at snellwilcox.com (stephan.segschneider@snellwilcox.com) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Read a XML file inside a Jar Message-ID: <2096769025@snellwilcox.com> If your.xml is located in the same dir as YourClass you just use: InputStream is = YourClass.class.getResourceAsStream("your.xml"); and then you can do with the stream whatever you need to do. This works fine if you put your.xml inside a jar file. Cheers, Stephan ____________________Reply Separator____________________ Subject: [jdom-interest] Read a XML file inside a Jar Author: "Robert Zuidema" Date: 26/03/02 13:57 I am trying to read a XML file that is inside a JAR. Is this possible? Can someone provide a sniplet of code for this? Thanks, Bob Zuidema _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp. _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.co m ---------------------------------------------------------------------- The contents of this communication are confidential to the normal user of the email address to which it was sent. If you have received this email in error, any use, dissemination, forwarding, printing or copying of this email is strictly prohibited. If this is the case, please notify the sender and delete this message. ---------------------------------------------------------------------- From leh at galaxynine.com Tue Mar 26 11:35:42 2002 From: leh at galaxynine.com (Les Hill) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] JDOM and Localization: was A utility Element subclass and a request for API extension Message-ID: <003201c1d4fd$6ba38ee0$6401a8c0@Mozart> elharo@metalab.unc.edu wrote: >One thing that hasn't been addressed in this thread, ...good comments about localization deleted for brevity... I am not sure how this applies as the proposal is only to make the API more user-friendly by allowing automatic conversions (think of the "" + construct) to occur natively in the API solely as a utility, not as a functionality extension. The changes are very basic and easily understood. The proposal excluded the getAttribute() etc... methods, since they would require more substantial changes. Any other conversions are up to the user, and as already mentioned in a reply to Patrick Dowler, handling formatting issues like localization would be handled in the way they are now: application specific code. Les Hill leh@galaxynine.com From bob at werken.com Tue Mar 26 11:45:22 2002 From: bob at werken.com (bob mcwhirter) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] JDOM and Localization: was A utility Element subclass and a request for API extension In-Reply-To: <003201c1d4fd$6ba38ee0$6401a8c0@Mozart> Message-ID: > Any other conversions are up to the user, and as already mentioned in a > reply to Patrick Dowler, handling formatting issues like localization would > be handled in the way they are now: application specific code. One thing, probably not overly useful, since JDOM is a library... I think folks might enjoy having getLocalizedMessage() on the JDOM exceptions return a possibly localized message. -bob From sbellina at earthlink.net Tue Mar 26 12:44:35 2002 From: sbellina at earthlink.net (Shawn Bellina) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Help with org.jdom.Element.removeNamespaceDeclaration Message-ID: <001701c1d507$0abb02c0$0a06a8c0@yellow> I need some help understanding removeNamespaceDeclaration - the snippet below shows an attempt to remove the namesapce from the root. I also tried moving to another element with out any luck. Can someone please point me in the rite direction? _thanks shawn ---------------------------------------------------------------------------- ------------ /* * RemoveNamespaceDeclarationTest.java * * trying to figure out how to remove a namespace from adocument? */ import java.io.FileInputStream; import org.jdom.input.SAXBuilder; import org.jdom.Document; import org.jdom.Element; import org.jdom.Namespace; public class RemoveNamespaceDeclarationTest { public static void main (String args[]) { RemoveNamespaceDeclarationTest test = new RemoveNamespaceDeclarationTest(); test.removeNamespace( test.buildDocument("C:\\jdom_help\\test.xml") ); } public Document buildDocument(String path){ // parse the in file Document doc = null; try{ SAXBuilder builder = new SAXBuilder(); doc = builder.build(new FileInputStream(path)); }catch(Exception e){ System.err.println(e); } return doc; } public Document removeNamespace(Document doc){ // remove the namespace on the root of the document Element e = doc.getRootElement(); String s = e.getNamespaceURI(); System.out.println("before: " + e.getNamespace()); e.removeNamespaceDeclaration(Namespace.getNamespace(s)); System.out.println("after: " + e.getNamespace()); return doc; } } ---------------------------------------------------------------------------- ------------ T h e S a l i e n t G r o u p --------------------------------------------------------- shawn bellina, CTO --------------------------------------------------------- [e-mail].. shawnbellina@earthlink.net - [IM]....... shawnbellina@jabber.com ............. shawnbellina@yahoo.com ............. shawnbellina@alo.com ............. shawnbellina@hotmail.com - [cell]..... 404.434.5516 - -------------- next part -------------- A non-text attachment was scrubbed... Name: RemoveNamespaceDeclarationTest.java Type: application/octet-stream Size: 1462 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020326/64ae66e2/RemoveNamespaceDeclarationTest.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: test.xml Type: text/xml Size: 1948 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020326/64ae66e2/test.xml From schlegel at software.b.uunet.de Tue Mar 26 15:01:28 2002 From: schlegel at software.b.uunet.de (Andreas Schlegel) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Set encoding type in document? Message-ID: <3CA0FDC8.43854D1E@software.b.uunet.de> Hi, is it possible to set the encoding type in the build document? I know there is the XMLOutputter with the method setEncoding but for my purpose (transform XML + XSL -> HTML) I use DOMOutputter. Of course, it would be also ok if there is a way to set the new encoding format in the output or to change the default encoding format ... Greetings, Andreas From jhunter at apache.org Wed Mar 27 00:22:58 2002 From: jhunter at apache.org (Jason Hunter) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Set encoding type in document? References: <3CA0FDC8.43854D1E@software.b.uunet.de> Message-ID: <3CA18162.8F8C4130@apache.org> > is it possible to set the encoding type in the build document? Only on XMLOutputter because that's the only time the encoding matters. > I know there is the XMLOutputter with the method setEncoding but for my > purpose (transform XML + XSL -> HTML) I use DOMOutputter. The chars are given as chars to DOM, so you don't need an encoding which would handle char to byte translations. After it's in DOM, if you want to output you have to use DOM mechanisms. -jh- From vbalu at mva.co.uk Wed Mar 27 03:49:18 2002 From: vbalu at mva.co.uk (Venkatesh Balu) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Adding Attribue Message-ID: Hi, can any tell me how we add a attribute in JDOM.i am using JDOM beta-7 it says addAttribute() is depricated. my structre is like this... thanks cheers venk Vekatesh Balu MVA House 3rd floor,Woking +44-1483-728051 Exn:255(off) +44-7769692753(mobile) www.mva-group.com The information transmitted in this e-mail and any attached files is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any opinions expressed in the e-mail are those of the individual and not necessarily the Company. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error you should not copy it, disclose its contents to anyone else or take any action based on it, please contact the sender and delete the material from any computer. ____________________________________________________________________ This message has been checked for all known viruses by Star Internet delivered through the MessageLabs Virus Control Centre. For further information visit http://www.star.net.uk/stats.asp $$ -------------- next part -------------- A non-text attachment was scrubbed... Name: Venkatesh Balu.vcf Type: text/x-vcard Size: 137 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020327/13a88535/VenkateshBalu.vcf From markw at wilsoncom.de Wed Mar 27 05:11:19 2002 From: markw at wilsoncom.de (MarkW) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Adding Attribue In-Reply-To: Message-ID: <000001c1d590$e2f860e0$5b00a8c0@ws20001> Hi, just use setAttribute(....); it automatically creates the attribute. Cheers, Mark > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org] On Behalf Of Venkatesh Balu > Sent: Wednesday, March 27, 2002 12:49 PM > To: jdom-interest@jdom.org > Subject: [jdom-interest] Adding Attribue > > > Hi, > > can any tell me how we add a attribute in JDOM.i am using JDOM beta-7 > it says addAttribute() is depricated. > > my structre is like this... > > > > thanks > > cheers > venk From rgowka1 at hotmail.com Wed Mar 27 06:45:51 2002 From: rgowka1 at hotmail.com (Raghavendra Reddy Gowkanapalli) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] IndexOutOfBoundsException Content List : With JDOM Beta 8 RC1 Message-ID: java.lang.IndexOutOfBoundsException: Index: 2, Size: 1 at java.util.ArrayList.RangeCheck(ArrayList.java:508) at java.util.ArrayList.get(ArrayList.java:320) at org.jdom.ContentList.get(ContentList.java:527) at org.jdom.ContentList$FilterList.get(ContentList.java:746) Hello, I get the above error with JDOM Beta 8 RC1 and not with JDOM Beta 7. Could you guys look into this error before releasing JDOM Beta 8? thanks, Raghu -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020327/ecba8cee/attachment.htm From travis at thinkvirtual.com Wed Mar 27 09:11:29 2002 From: travis at thinkvirtual.com (travis@thinkvirtual.com) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Building a small portion of a document Message-ID: <2803573.1017249089578.JavaMail.SYSTEM@bodisafa> I am wondering if you can build a document from a certain element in an xml stream and have it stop building at the end of that element... ex: // start build here at element b text // end build here So this would totally skip the A, but at the sametime wouldn't throw the improper format exception. Now I realize this is a SAXException, so is there anyway to do that with SAX? Travis Reeder Chief Software Architect www.ThinkVirtual.com From jhunter at acm.org Wed Mar 27 09:26:48 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] IndexOutOfBoundsException Content List : With JDOM Beta 8 RC1 References: Message-ID: <3CA200D8.7EB3FDE2@acm.org> It would help if you provided code that reproduced the error. -jh- > Raghavendra Reddy Gowkanapalli wrote: > > java.lang.IndexOutOfBoundsException: Index: 2, Size: 1 > > at java.util.ArrayList.RangeCheck(ArrayList.java:508) > > at java.util.ArrayList.get(ArrayList.java:320) > > at org.jdom.ContentList.get(ContentList.java:527) > > at org.jdom.ContentList$FilterList.get(ContentList.java:746) > > Hello, > > I get the above error with JDOM Beta 8 RC1 and not with JDOM Beta 7. > > Could you guys look into this error before releasing JDOM Beta 8? > > thanks, > > Raghu > > From jason at supernovasoftware.com Wed Mar 27 09:28:42 2002 From: jason at supernovasoftware.com (Jason Long) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] JDOM for static or Cocoon 2 for dynamic? Message-ID: I had been using JDOM to create a site with around 2k static pages, but this takes some time to run and currently the whole thing needs to be rebuilt if changes are make. All pages are a different view of one XML file which is around 2.8 MB. I am running this application on a P4 1.6MHz, 512 MB RAM, and Win2k. I switched to using cocoon 2 so that all that was need was to change the main file and the site reflects the changes. But, unless the page has been requested before the processor is pegged for a few seconds trying to do the XSL transform. I would apprecite any suggestions on speeding this up. I know going with the static pages will give me much better performance, but I do like using Cocoon to create dynamic content. Best Regards, Jason Long - President Supernova Software - supernovasoftware.com BS Physics, MS Chemical Engineering From laurent.bihanic at atosorigin.com Wed Mar 27 09:52:53 2002 From: laurent.bihanic at atosorigin.com (Laurent Bihanic) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Building a small portion of a document References: <2803573.1017249089578.JavaMail.SYSTEM@bodisafa> Message-ID: <3CA206F5.5040801@atosorigin.com> Hi, You might be interested with org.jdom.contrib.input.scanner.ElementScanner (in JDOM's contrib module) which is a SAX filter that let you register XPath expressions to match elements and notifies listeners when an element has been build. In your case: ElementScanner f = new ElementScanner(); f.addElementListener(myListener, "b"); // Listens for all elements f.parse(source); ElementListener defines a single method elementMatched(String path, Element e). Although it was not intended for this purpose, you listener could throw a JDOMException to abort the parse. In the above example, it would result in f.parse() throwing a SAXException wrapping the JDOMException thrown by the listener. If you don't want to process JDOM elements or if your element structure is simple, you can achieve the same result by implementing your own SAX ContentHandler and throw a specific subclass of SAXException. Hope this helps, Laurent travis@thinkvirtual.com wrote: > I am wondering if you can build a document from a certain element in an xml stream and have it stop building at the end of that element... > > ex: > > // start build here at element b > text > // end build here > > > So this would totally skip the A, but at the sametime wouldn't throw the improper format exception. Now I realize this is a SAXException, so is there anyway to do that with SAX? > > Travis Reeder > Chief Software Architect > www.ThinkVirtual.com > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com > -- wWw Zzzzz (- -) -------------ooO-(_)-Ooo----------------------------------------------- Laurent Bihanic | Tel: +33 (0)1 55.91.21.93 (Direct line) Atos Origin | +33 (0)1 55.91.20.00 Int?gration - e-Business | Fax: +33 (0)1 55.91.22.31 Les Miroirs - Bat. C | 18, avenue d'Alsace | F-92926 La Defense Cedex | e-Mail: laurent.bihanic@atosorigin.com ----------------------------------------------------------------------- "Microsoft isn't the answer. Microsoft is the question and the answer is no." DISCLAIMER: The opinions expressed are entirely my own and may not necessarily be those of my employer. Also, I am not now nor have I ever been a lawyer. My opinions are provided as-is with absolutely no warrantee of merchantability or fitness for any particular use. Besides, you can't prove I typed this. No body saw me type this. Who says I typed this? From galuc at ebruit.com Wed Mar 27 14:05:27 2002 From: galuc at ebruit.com (Galuc) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Problems by sorting the list (JDOM beginner) References: <3C99D001.6040804@compactive.com> Message-ID: <002301c1d5db$80f887d0$f0adb8c3@szg> Hi! My problem is, I can't sort the List! I use: List ch = root.getChildren; Collections.sort( ch , mycomp ); I wrote a comparator, what works. But I got an exception: org.jdom.IllegalAddException: The element already has an existing parent "root" I tried to search in the archive, but I couldn't find any solutions! Thanks, Galuc From sabela_julien_grouteau at yahoo.fr Wed Mar 27 14:37:15 2002 From: sabela_julien_grouteau at yahoo.fr (Julien GROUTEAU) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Problems by sorting the list (JDOM beginner) Message-ID: One thing I found useful, while sorting list of childrens, is to detach them prior to any 'processing' on them. So I would say : List ch = root.getChildren; Iterator it = ch.iterator (); while (it.hasNext ()) { Element element = (Element) it.next (); element.detach (); } Collections.sort (ch , mycomp); Hope this helps. Julien -----Message d'origine----- De : jdom-interest-admin@jdom.org [mailto:jdom-interest-admin@jdom.org]De la part de Galuc Envoy? : mercredi 27 mars 2002 23:05 ? : jdom-interest@jdom.org Objet : [jdom-interest] Problems by sorting the list (JDOM beginner) Hi! My problem is, I can't sort the List! I use: List ch = root.getChildren; Collections.sort( ch , mycomp ); I wrote a comparator, what works. But I got an exception: org.jdom.IllegalAddException: The element already has an existing parent "root" I tried to search in the archive, but I couldn't find any solutions! Thanks, Galuc _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com From galuc at ebruit.com Wed Mar 27 14:48:25 2002 From: galuc at ebruit.com (Galuc) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Problems by sorting the list (JDOM beginner) References: Message-ID: <003101c1d5e1$812bbe10$f0adb8c3@szg> Hi! Thanks for trying helping me. I tried it, but it didn't work. It makes an exception: java.util.ConcurrentModificationException Galuc ----- Original Message ----- From: "Julien GROUTEAU" To: "Galuc" Sent: Wednesday, March 27, 2002 11:29 PM Subject: RE: [jdom-interest] Problems by sorting the list (JDOM beginner) > One thing I found useful, while sorting list of childrens, is to detach them > prior to any 'processing' on them. > > So I would say : > > List ch = root.getChildren; > Iterator it = ch.iterator (); > while (it.hasNext ()) { > Element element = (Element) it.next (); > element.detach (); > } > Collections.sort (ch , mycomp); > > Hope this helps. > > Julien > > > -----Message d'origine----- > De : jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]De la part de Galuc > Envoy? : mercredi 27 mars 2002 23:05 > ? : jdom-interest@jdom.org > Objet : [jdom-interest] Problems by sorting the list (JDOM beginner) > > > > Hi! > > My problem is, I can't sort the List! > I use: > List ch = root.getChildren; > Collections.sort( ch , mycomp ); > > I wrote a comparator, what works. > But I got an exception: > org.jdom.IllegalAddException: The element already has an existing parent > "root" > > I tried to search in the archive, but I couldn't find any solutions! > > > Thanks, Galuc > > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos > t.com > > > _________________________________________________________ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > > From zork263 at lycos.com Wed Mar 27 22:40:38 2002 From: zork263 at lycos.com (Garrett Zork) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] ConcurrentModificationException Message-ID: I've gotten a ConcurrentModificationException in my code. Can someone share the main reasons for getting this Exception? I eliminated the error by grabbing my List from Jaxen rather than JDOM, though, this is obviously not my preferred solution. I'm running JDOM b8 (and Jaxen- beta 8) I'm not using threads, and didn't "remove" anything from the List - either through the iterator or outside of the iterator. I would certainly like to know the JDOM programming constructs to avoid. --------------------------------- Snippet of offending code: (sorry for the linewrap) //List templateList=sectionElement.getChildren("template"); //This JDOM List fails List templateList=UtilXML.getXpathResults(sectionElement,"template"); //This (convenience method) Jaxen List succeeds Iterator templateIter=templateList.iterator(); int pageCount=0; while (templateIter.hasNext()) { //This is line 78: where the exception occurs pageCount++; PageMap myPageMap= new PageMap(section); for (int i=0;(i(CatalogBuilder.java:65) at ig.TestCatalogBuilder.main(TestCatalogBuilder.java:24) Exception in thread "main" See Dave Matthews Band live or win a signed guitar http://r.lycos.com/r/bmgfly_mail_dmb/http://win.ipromotions.com/lycos_020201/splash.asp From pj.fanning at XIAM.com Thu Mar 28 01:38:31 2002 From: pj.fanning at XIAM.com (PJ Fanning) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Problems by sorting the list (JDOM beginner) Message-ID: I would suggest the following. List ch = root.getChildren; Iterator it = ch.iterator (); while (it.hasNext ()) { Object obj = it.next(); it.remove(); } Collections.sort (ch , mycomp); The it.remove() will automatically update the root's list of children and detach the children. ---Original Message--- One thing I found useful, while sorting list of childrens, is to detach them prior to any 'processing' on them. So I would say : List ch = root.getChildren; Iterator it = ch.iterator (); while (it.hasNext ()) { Element element = (Element) it.next (); element.detach (); } Collections.sort (ch , mycomp); Hope this helps. Julien From pj.fanning at XIAM.com Thu Mar 28 01:46:46 2002 From: pj.fanning at XIAM.com (PJ Fanning) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] Problems by sorting the list (JDOM beginner) Message-ID: Oops. That won't work at all. The list will be emptied. Try this: List live = root.getChildren; ArrayList notLive = new ArrayList(live); Collections.sort(notLive , mycomp); Any modifications (eg sorting) of the 'live' list will result in changes to the underlying document structure. The 'notLive' list can be sorted without affecting the underlying document structure (and therefore there should be no risk of a ConcurrentModificationException). -----Original Message----- From: PJ Fanning Sent: 28 March 2002 09:39 To: 'jdom-interest@jdom.org' Cc: 'sabela_julien_grouteau@yahoo.fr'; 'galuc@ebruit.com' Subject: RE: [jdom-interest] Problems by sorting the list (JDOM beginner) I would suggest the following. List ch = root.getChildren; Iterator it = ch.iterator (); while (it.hasNext ()) { Object obj = it.next(); it.remove(); } Collections.sort (ch , mycomp); The it.remove() will automatically update the root's list of children and detach the children. ---Original Message--- One thing I found useful, while sorting list of childrens, is to detach them prior to any 'processing' on them. So I would say : List ch = root.getChildren; Iterator it = ch.iterator (); while (it.hasNext ()) { Element element = (Element) it.next (); element.detach (); } Collections.sort (ch , mycomp); Hope this helps. Julien From wleteurtre at tokto.com Thu Mar 28 02:41:09 2002 From: wleteurtre at tokto.com (wleteurtre@tokto.com) Date: Fri Aug 6 17:07:30 2004 Subject: [jdom-interest] NodeType problem? Message-ID: <004501c1d645$12f04bf0$c801010a@TOKTO> How can i specify a node type with JDOM? thk -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020328/b761fc78/attachment.htm From tpreston at amadeusboston.com Thu Mar 28 06:14:52 2002 From: tpreston at amadeusboston.com (Tom Preston) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Problem with Jdom8 - getChildren() on root doesn't work... Message-ID: <498B0C8F9141D511927B009027B1138754FA7C@email-temp.amadeusboston.com> Problem with Jdom8 - getChildren() on root doesn't work on a document that has been transformed in memory using documented jdom transform methodology: Transformer transformer = TransformerFactory.newInstance() .newTransformer(new StreamSource(stylesheet)); JDOMResult out = new JDOMResult(); transformer.transform(new JDOMSource(in), out); return out.getDocument(); Interesting resulti is that Element root = doc.getRootElement(); boolean hasChildren = root.hasChildren(); returns "true" while List theChildren = root.getChildren(); returns a List of size 0 (zero). This was NOT a problem with JDOM 7 but is a problem with JDOM 8. Note that the doc prior to transformation doesn't have this problem. Has anyone else seen this with 8? Is it true that I should never get a zero size list from getChildren() method if hasChildren() method returned true? Tom -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020328/28ff8cab/attachment.htm From hip at a.cs.okstate.edu Thu Mar 28 06:54:56 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Problem with Jdom8 - getChildren() on root doesn't work... In-Reply-To: Your message of "Thu, 28 Mar 2002 09:14:52 EST." <498B0C8F9141D511927B009027B1138754FA7C@email-temp.amadeusboston.com> Message-ID: <200203281455.HAA11528@dorothy.denveronline.net> What does the document and stylesheet look like? Cann't give a answer if we cann't reproduce the results :) Brad Tom Preston writes: > Problem with Jdom8 - getChildren() on root doesn't work on a document that > has been transformed in memory using documented jdom transform methodology: > > > Transformer transformer = TransformerFactory.newInstance() > .newTransformer(new StreamSource(stylesheet)); > > JDOMResult out = new JDOMResult(); > transformer.transform(new JDOMSource(in), out); > return out.getDocument(); > > > Interesting resulti is that > Element root = doc.getRootElement(); > boolean hasChildren = root.hasChildren(); > > returns "true" while > List theChildren = root.getChildren(); > > returns a List of size 0 (zero). > > This was NOT a problem with JDOM 7 but is a problem with JDOM 8. > > Note that the doc prior to transformation doesn't have this problem. Has > anyone else seen this with 8? Is it true that I should never get a zero > size list from getChildren() method if hasChildren() method returned true? From dabhyankar at amadeusboston.com Thu Mar 28 07:05:39 2002 From: dabhyankar at amadeusboston.com (Deepali Abhyankar) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Problem with Jdom8 - getChildren() on root do esn't work... Message-ID: <498B0C8F9141D511927B009027B1138754FAAC@email-temp.amadeusboston.com> Hi, I work with Tom and here are the files we are working with. I am attaching the files. The original file is etid.xml. It gets transformed using the following stylesheet - etid.xsl. For logging purposes I saved the transformed xml to a log file. Its called etidxml.log. Thanks, Deepali. -----Original Message----- From: Bradley S. Huffman [mailto:hip@a.cs.okstate.edu] Sent: Thursday, March 28, 2002 9:55 AM To: Tom Preston Cc: jdom-interest@jdom.org; hip@a.cs.okstate.edu Subject: Re: [jdom-interest] Problem with Jdom8 - getChildren() on root doesn't work... What does the document and stylesheet look like? Cann't give a answer if we cann't reproduce the results :) Brad Tom Preston writes: > Problem with Jdom8 - getChildren() on root doesn't work on a document that > has been transformed in memory using documented jdom transform methodology: > > > Transformer transformer = TransformerFactory.newInstance() > .newTransformer(new StreamSource(stylesheet)); > > JDOMResult out = new JDOMResult(); > transformer.transform(new JDOMSource(in), out); > return out.getDocument(); > > > Interesting resulti is that > Element root = doc.getRootElement(); > boolean hasChildren = root.hasChildren(); > > returns "true" while > List theChildren = root.getChildren(); > > returns a List of size 0 (zero). > > This was NOT a problem with JDOM 7 but is a problem with JDOM 8. > > Note that the doc prior to transformation doesn't have this problem. Has > anyone else seen this with 8? Is it true that I should never get a zero > size list from getChildren() method if hasChildren() method returned true? _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com -------------- next part -------------- A non-text attachment was scrubbed... Name: etid.xml Type: application/octet-stream Size: 1469 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020328/cd4a6fbb/etid.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: etid.xsl Type: application/octet-stream Size: 1430 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020328/cd4a6fbb/etid-0001.obj -------------- next part -------------- A non-text attachment was scrubbed... Name: etidxml.log Type: application/octet-stream Size: 7979 bytes Desc: not available Url : http://jdom.org/pipermail/jdom-interest/attachments/20020328/cd4a6fbb/etidxml.obj From arosen at silverstream.com Thu Mar 28 08:24:24 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] NodeType problem? In-Reply-To: <004501c1d645$12f04bf0$c801010a@TOKTO> Message-ID: <006a01c1d675$076ac500$6a65810a@silverstream.com> What exactly are you trying to do? How about "new Element()" or "new Comment()" etc? JDOM doesn't have the concept of "node types". Alex -----Original Message----- From: jdom-interest-admin@jdom.org [mailto:jdom-interest-admin@jdom.org]On Behalf Of wleteurtre@tokto.com Sent: Thursday, March 28, 2002 5:41 AM To: jdom-interest@jdom.org Subject: [jdom-interest] NodeType problem? How can i specify a node type with JDOM? thk From hip at a.cs.okstate.edu Thu Mar 28 09:04:16 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Problem with Jdom8 - getChildren() on root do esn't work... In-Reply-To: Your message of "Thu, 28 Mar 2002 10:05:39 EST." <498B0C8F9141D511927B009027B1138754FAAC@email-temp.amadeusboston.com> Message-ID: <200203281709.KAA09472@dorothy.denveronline.net> Hmmm, there has to be more to this story. I cann't reproduce a size()==0. Here's the code I used and the output for a run with "etid.xml etid.xsl" as input. Did I miss something? Brad import java.util.*; import org.jdom.*; import org.jdom.input.*; import org.jdom.output.*; import org.jdom.transform.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class XSLTransform { public static void main(String[] args) throws Exception { SAXBuilder builder = new SAXBuilder(); Document doc1 = builder.build(args[0]); Document doc2 = transform(doc1, args[1]); Element root1 = doc1.getRootElement(); Element root2 = doc2.getRootElement(); System.out.println("root1.hasChildren()=" + root1.hasChildren()); System.out.println("root2.hasChildren()=" + root2.hasChildren()); List theChildren1 = root1.getChildren(); List theChildren2 = root2.getChildren(); System.out.println("root1 size()=" + theChildren1.size()); System.out.println("root2 size()=" + theChildren2.size()); XMLOutputter out = new XMLOutputter(" ", true); out.setTextNormalize(true); System.out.println("\n===== Document 1 ===================================="); out.output(doc1, System.out); System.out.println("\n\n===== Document 2 ===================================="); out.output(doc2, System.out); } public static Document transform(Document in, String stylesheet) throws JDOMException { try { Transformer transformer = TransformerFactory.newInstance() .newTransformer(new StreamSource(stylesheet)); JDOMResult out = new JDOMResult(); transformer.transform(new JDOMSource(in), out); return out.getDocument(); } catch (TransformerException e) { throw new JDOMException("XSLT Transformation failed", e); } } } root1.hasChildren()=true root2.hasChildren()=true root1 size()=8 root2 size()=1 ===== Document 1 ==================================== <![CDATA[Spanish islands attract 8m out of 14m UK visits]]> http://www.e-tid.com/viewarticle.asp?ID=17117 <![CDATA[Small airlines court small agents in US commission fall-out]]> http://www.e-tid.com/viewarticle.asp?ID=17116 <![CDATA[Thomas Cook UK turns over 184m in Nov/Dec/Jan quarter]]> http://www.e-tid.com/viewarticle.asp?ID=17120 <![CDATA[Another bidder circles QMH]]> http://www.e-tid.com/viewarticle.asp?ID=17119 <![CDATA[Hertz expands into China]]> http://www.e-tid.com/viewarticle.asp?ID=17118 <![CDATA[NTL offers ?no asssurance? of successful bailout]]> http://www.e-tid.com/viewarticle.asp?ID=17121 <![CDATA[<A HREF=http://www.e-tid.com/travelweekly.asp>What the trade papers say</A>]]> http://www.e-tid.com/viewarticle.asp?ID=1642 ===== Document 2 ==================================== From dabhyankar at amadeusboston.com Thu Mar 28 10:17:25 2002 From: dabhyankar at amadeusboston.com (Deepali Abhyankar) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Problem with Jdom8 - getChildren() on root do esn't work... Message-ID: <498B0C8F9141D511927B009027B1138754FB4D@email-temp.amadeusboston.com> Hmm. Quick question - what jar files are you pointing to when you ran the application below? Besides the jdom.jar for JDOM8. Thanks, - Deepali. -----Original Message----- From: Bradley S. Huffman [mailto:hip@a.cs.okstate.edu] Sent: Thursday, March 28, 2002 12:04 PM To: Deepali Abhyankar Cc: jdom-interest@jdom.org; hip@a.cs.okstate.edu Subject: Re: [jdom-interest] Problem with Jdom8 - getChildren() on root do esn't work... Hmmm, there has to be more to this story. I cann't reproduce a size()==0. Here's the code I used and the output for a run with "etid.xml etid.xsl" as input. Did I miss something? Brad import java.util.*; import org.jdom.*; import org.jdom.input.*; import org.jdom.output.*; import org.jdom.transform.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; public class XSLTransform { public static void main(String[] args) throws Exception { SAXBuilder builder = new SAXBuilder(); Document doc1 = builder.build(args[0]); Document doc2 = transform(doc1, args[1]); Element root1 = doc1.getRootElement(); Element root2 = doc2.getRootElement(); System.out.println("root1.hasChildren()=" + root1.hasChildren()); System.out.println("root2.hasChildren()=" + root2.hasChildren()); List theChildren1 = root1.getChildren(); List theChildren2 = root2.getChildren(); System.out.println("root1 size()=" + theChildren1.size()); System.out.println("root2 size()=" + theChildren2.size()); XMLOutputter out = new XMLOutputter(" ", true); out.setTextNormalize(true); System.out.println("\n===== Document 1 ===================================="); out.output(doc1, System.out); System.out.println("\n\n===== Document 2 ===================================="); out.output(doc2, System.out); } public static Document transform(Document in, String stylesheet) throws JDOMException { try { Transformer transformer = TransformerFactory.newInstance() .newTransformer(new StreamSource(stylesheet)); JDOMResult out = new JDOMResult(); transformer.transform(new JDOMSource(in), out); return out.getDocument(); } catch (TransformerException e) { throw new JDOMException("XSLT Transformation failed", e); } } } root1.hasChildren()=true root2.hasChildren()=true root1 size()=8 root2 size()=1 ===== Document 1 ==================================== <![CDATA[Spanish islands attract 8m out of 14m UK visits]]> http://www.e-tid.com/viewarticle.asp?ID=17117 <![CDATA[Small airlines court small agents in US commission fall-out]]> http://www.e-tid.com/viewarticle.asp?ID=17116 <![CDATA[Thomas Cook UK turns over 184m in Nov/Dec/Jan quarter]]> http://www.e-tid.com/viewarticle.asp?ID=17120 <![CDATA[Another bidder circles QMH]]> http://www.e-tid.com/viewarticle.asp?ID=17119 <![CDATA[Hertz expands into China]]> http://www.e-tid.com/viewarticle.asp?ID=17118 <![CDATA[NTL offers ?no asssurance? of successful bailout]]> http://www.e-tid.com/viewarticle.asp?ID=17121 <![CDATA[<A HREF=http://www.e-tid.com/travelweekly.asp>What the trade papers say</A>]]> http://www.e-tid.com/viewarticle.asp?ID=1642 ===== Document 2 ==================================== _______________________________________________ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com From arosen at silverstream.com Thu Mar 28 10:43:21 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] ConcurrentModificationException In-Reply-To: Message-ID: <008e01c1d688$702f02f0$6a65810a@silverstream.com> I've attached a quick writeup of the relevent change in beta 8. Hopefully this should explain things. I don't know what your PageMap or Template classes are, but I assume that the PageMap.addTemplate() method is adding a child to the parent Element, so you're running into this problem. Jason, do you want to add something along these lines to the FAQ, and/or some kind of upgrade document? (I haven't actually tried the code I wrote here, but it looks OK.) --Alex In JDOM beta 7, methods such as getContent() aka getMixedContent(), getChildren(), and getAttributes() all returned instances of PartialList. This list did not fulfill the JDOM contract of these methods, because it was only partially "live". Changes made to the PartialList were reflected in the underlying Element or Document, but not vice versa. In JDOM beta 8, PartialList is replaced by the more correct and more efficient FilterList. Now, the returned list is fully live, so it will see change made to the underlying Element or Document as soon as they happen. As Jason says in the changelog: "Added the long-awaited 'FilterList' functionality! This improves the reliability and performance of the lists returned by getContent() and getChildren() calls. These lists are now fully live, they fully enforce well-formedness constraints, and they don't require in-memory copying before returning. A huge improvement!" An important change in the behavior of these lists involves Iterators. FilterList has the same iterator contract as the standard Java ArrayList and LinkedList classes: "The iterators returned by the this class's iterator and listIterator methods are 'fail-fast': if the list is structurally modified at any time after the iterator is created, in any way except through the Iterator's own remove or add methods, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future." Note that this can happen even for single-threaded applications. For example, this code worked in beta 7 will no longer work in beta 8. // Remove children whose name starts with the given prefix. public void removePrefix(Element parent, String prefix) { Iterator iter = parent.getChildren().iterator(); while (iter.hasNext()) { Element child = (Element)iter.next(); if(child.getName().startsWith(prefix)) { parent.removeContent(child); } } } This code will throw a ConcurrentModificationException, because the list of children is being changed from outside of the Iterator, while the Iterator is still being used. The simple fix is to use the methods on Iterator or ListIterator to do the modification - use add(), remove(), or set(). In this example, just change "parent.removeContent(child)" to "iter.remove()". Another technique would be to create a non-live list from the live list. For example, use this line: List staticList = new ArrayList(parent.getChildren()); This creates a new ArrayList containing the children of the Element, but this list is static; it will not change when the parent Element changes (and, changes to this list will not affect the parent). > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Garrett Zork > Sent: Thursday, March 28, 2002 1:41 AM > To: jdom-interest@jdom.org > Subject: [jdom-interest] ConcurrentModificationException > > > I've gotten a ConcurrentModificationException in my code. Can > someone share the main reasons for getting this Exception? > > I eliminated the error by grabbing my List from Jaxen rather > than JDOM, though, this is obviously not my preferred solution. > > I'm running JDOM b8 (and Jaxen- beta 8) > > I'm not using threads, and didn't "remove" anything from > the List - either through the iterator or outside of the iterator. > I would certainly like to know the JDOM programming constructs > to avoid. > --------------------------------- > Snippet of offending code: (sorry for the linewrap) > > //List templateList=sectionElement.getChildren("template"); > //This JDOM List fails > > List templateList=UtilXML.getXpathResults(sectionElement,"template"); > //This (convenience method) Jaxen List succeeds > > Iterator templateIter=templateList.iterator(); > > int pageCount=0; > while (templateIter.hasNext()) { //This is line 78: > where the exception occurs > pageCount++; > PageMap myPageMap= new PageMap(section); > > for (int i=0;(i templateIter.hasNext());i++) { > for (int j=0;(j templateIter.hasNext());j++) { > Element templateElement=(Element) templateIter.next(); > Template myTemplate= new Template(templateElement); > myPageMap.addTemplate(myTemplate, i, j); > } > } > myPageMap.writePageToDocument(sectionElement,pageCount); > } > > ------------------------------------- > here's the stacktrace: > > java.util.ConcurrentModificationException > at > org.jdom.ContentList$FilterListIterator.checkConcurrentModific > ation(ContentList.java:1206) > at > org.jdom.ContentList$FilterListIterator.hasNext(ContentList.java:928) > at ig.CatalogBuilder.buildSection(CatalogBuilder.java:78) > at ig.CatalogBuilder.(CatalogBuilder.java:65) > at ig.TestCatalogBuilder.main(TestCatalogBuilder.java:24) > Exception in thread "main" > From hip at a.cs.okstate.edu Thu Mar 28 10:32:46 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Problem with Jdom8 - getChildren() on root do esn't work... In-Reply-To: Your message of "Thu, 28 Mar 2002 13:17:25 EST." <498B0C8F9141D511927B009027B1138754FB4D@email-temp.amadeusboston.com> Message-ID: <200203281833.LAA27277@dorothy.denveronline.net> Deepali Abhyankar writes: > Hmm. Quick question - what jar files are you pointing to when you ran the > application below? Besides the jdom.jar for JDOM8. Ahhh yes, the nasty details, SDK 1.4, jdom.jar created this morning from the cvs as of this morning. I'm lazy so I put everthing in jre\lib\ext and it's contents are: Volume in drive C has no label. Volume Serial Number is D8E4-7769 Directory of C:\j2sdk1.4.0\jre\lib\ext 03/28/2002 10:11 AM . 03/28/2002 10:11 AM .. 08/31/2001 11:06 AM 320,367 BCEL.jar 08/31/2001 11:06 AM 105,573 bsf.jar 05/18/2001 08:30 PM 187,162 crimson.jar 02/07/2002 12:52 PM 4,391 dnsns.jar 11/27/2000 11:57 AM 29,871 jakarta-regexp-1.2.jar 08/31/2001 11:06 AM 61,975 java_cup.jar 01/10/2002 11:48 AM 184,306 jaxen-full.jar 02/06/2001 09:43 PM 28,404 jaxp.jar 03/28/2002 10:10 AM 126,794 jdom.jar 08/31/2001 11:06 AM 54,603 JLex.jar 03/19/2002 02:31 AM 1,447,679 jswat-20020319.jar 05/21/2001 10:19 AM 117,522 junit.jar 02/07/2002 12:52 PM 53,559 ldapsec.jar 02/07/2002 12:52 PM 664,070 localedata.jar 08/31/2001 11:06 AM 7,779 runtime.jar 01/10/2002 11:48 AM 23,390 saxpath.jar 08/31/2001 11:06 AM 57,679 stylebook-1.0-b3_xalan-2.jar 02/07/2002 12:52 PM 116,788 sunjce_provider.jar 01/24/2002 02:28 PM 29,181 validate.jar 08/31/2001 11:08 AM 872,241 xalan.jar 08/31/2001 11:06 AM 122,396 xalan2jdoc.jar 08/31/2001 11:08 AM 43,096 xalanj1compat.jar 08/31/2001 11:08 AM 23,881 xalansamples.jar 08/31/2001 11:08 AM 22,620 xalanservlet.jar 08/31/2001 11:06 AM 1,808,883 xerces.jar 08/31/2001 11:06 AM 129,139 xml.jar 08/31/2001 11:08 AM 474,327 xsltc.jar 27 File(s) 7,117,676 bytes 2 Dir(s) 939,499,520 bytes free From phil at triloggroup.com Thu Mar 28 12:56:39 2002 From: phil at triloggroup.com (phil@triloggroup.com) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] SAXBuilder enhancement request Message-ID: Very frequently, our users dump a XML content to a file (with an outputter), modify the resulting text, and then parse it to store it in the database. Fine. But, in order to make the XML text human readable, the use the indent & newline capability of the outputter. Unfortunately, and because there is no DTD, the parser cannot detect the additionnal spaces and cannot remove them as "ignorable whitespace". This is a very annoying limitation and, to deal with it (in certain cases, where the document is manually edited as text), we automatically remove all the text nodes that only contains spaces. From jhunter at acm.org Thu Mar 28 19:44:13 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Beta8 Released Message-ID: <3CA3E30D.887BD14B@acm.org> Hi everyone, Today we released JDOM 1.0 Beta8. The feature set is the same as RC1 announced two weeks ago, but we fixed the minor bugs people found in RC1. Look at the CHANGES.txt file for what's new since Beta7, and look at TODO.txt for what remains to be done. http://www.jdom.org/downloads/index.html -jh- From phil at triloggroup.com Thu Mar 28 12:42:00 2002 From: phil at triloggroup.com (phil@triloggroup.com) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Optimizing tree construction Message-ID: I added some methods to my own JDOM build, in order to optimize the tree construction when I don't need validation. In general, this happens when you read a document from a database or when you programmatically create a JDOM. For example, in our product we construct a JDOM from an HTML file, and then generate Java code that will rebuild the tree on demand, without parsing anything. In that case, I'm sure that the JDOM is valid and, as it is executed on a server, I want that process to be as fast as possible. The best way I found is to make this available as "protected" members. So, it is available only via inheritance, for well known subclasses of the base one. This ensure that a user, who do not know the actual class, cannot call these methods. Then, in my application I created a set of "Fast" classes, that leverage these new methods and provide "Fast" constructors (without checking the names validity). When building from a modified SAXParser, and because of the parser overhead, the gain is about 15-20%, which is not negligible at least. When building the tree from a java program, using new() and fastAdd() statements, the gain can be up to 50%! Brad, Jason, Alex.... what do you think about that? Can it be part of the standard JDOM? Phil. Here is the code I added: => Element class: protected void fastAddAttribute(Attribute o) { attributes.fastAddAttribute(o); } protected void fastAddContent(Element o) { content.fastAddContent(o); } protected void fastAddContent(Comment o) { content.fastAddContent(o); } protected void fastAddContent(ProcessingInstruction o) { content.fastAddContent(o); } protected void fastAddContent(CDATA o) { content.fastAddContent(o); } protected void fastAddContent(Text o) { content.fastAddContent(o); } protected void fastAddContent(EntityRef o) { content.fastAddContent(o); } => ContentList class: // PHIL protected final void fastAddContent(Element o) { if( list==null ) { list = new ArrayList(INITIAL_ARRAY_SIZE); } o.parent = parent; list.add(o); modCount++; } protected final void fastAddContent(Comment o) { if( list==null ) { list = new ArrayList(INITIAL_ARRAY_SIZE); } o.parent = parent; list.add(o); modCount++; } protected final void fastAddContent(ProcessingInstruction o) { if( list==null ) { list = new ArrayList(INITIAL_ARRAY_SIZE); } o.parent = parent; list.add(o); modCount++; } protected final void fastAddContent(CDATA o) { if( list==null ) { list = new ArrayList(INITIAL_ARRAY_SIZE); } o.parent = parent; list.add(o); modCount++; } protected final void fastAddContent(Text o) { if( list==null ) { list = new ArrayList(INITIAL_ARRAY_SIZE); } o.parent = parent; list.add(o); modCount++; } protected final void fastAddContent(EntityRef o) { if( list==null ) { list = new ArrayList(INITIAL_ARRAY_SIZE); } o.parent = parent; list.add(o); modCount++; } =>AttributeList class: final void fastAddAttribute(Attribute o) { if( list==null ) { list = new ArrayList(); } o.parent = parent; list.add(o); modCount++; } From phil at triloggroup.com Thu Mar 28 23:41:43 2002 From: phil at triloggroup.com (phil@triloggroup.com) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] SAXBuilder enhancement request /2 Message-ID: After looking at DOM4J, it appears that these guys added this capability recently ("stripWhitespaceText"). This is effectively very convenient when dealing with data centric document. Can we add it to JDOM? From phil at triloggroup.com Thu Mar 28 23:57:54 2002 From: phil at triloggroup.com (phil@triloggroup.com) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Next JDOM evolution Message-ID: After reading the TODO.TXT delivered with beta 8, it appears that CDATA & Text will evolve. This is a good thing, as long as these classes appear in the same hierarchy and are not merged in one class. There are currently to much applications using JDOM and doing such a change breaks them! For example, both the introduction of Text and the exception thrown from Document.getRootElement() really cost us a lot. And we are'nt yet synchronized with our partners, who did'nt yet update their code and then are incompatible! Please, ensure that now the API won't change, just evolve by adding capabilties and enhance the overall performance. We really need to have a stable and released API. I'm really afraid when reading artticle like the one written by Denis Snososki: >>>...It also suffers from an API that's still changing every few months with a new beta release (the next version, beta 8, is in preparation as I write this). JDOM does offer a convenient way of building and accessing simple XML documents, but the lack of stability makes it difficult to justify for use in production projects....<<< By the way, it is always the same debate: building a true class hierarchy. Currently, the source code with lots of instanceof is really awful, while a base Node class with make it more ellegant with any penality. Moreover, checking a node type will be faster when using a getNodeType() like method, instead of using instanceof operator. With the introduction of Text class, it is very easy and we should leverage it. Thanks, Phil. From adams at multispex.com Fri Mar 29 04:11:37 2002 From: adams at multispex.com (ShantAdam) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Beta8 Released References: <3CA3E30D.887BD14B@acm.org> Message-ID: <001101c1d71b$034c37a0$7301fea9@shantadam> Hi, I'm wondering what this warning is when compiling with the update: compile: [javac] Compiling 7 source files to C:\Program Files\xml_api\jdom\build\classes [javac] Note: sun.tools.javac.Main has been deprecated. [javac] 1 warning Shant Adam ----- Original Message ----- From: "Jason Hunter" To: "JDOM Interest" ; Sent: Thursday, March 28, 2002 10:44 PM Subject: [jdom-interest] Beta8 Released > Hi everyone, > > Today we released JDOM 1.0 Beta8. The feature set is the same as RC1 > announced two weeks ago, but we fixed the minor bugs people found in > RC1. Look at the CHANGES.txt file for what's new since Beta7, and look > at TODO.txt for what remains to be done. > > http://www.jdom.org/downloads/index.html > > -jh- > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos t.com > > From elharo at metalab.unc.edu Fri Mar 29 05:40:49 2002 From: elharo at metalab.unc.edu (Elliotte Rusty Harold) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] SAXBuilder enhancement request /2 In-Reply-To: References: Message-ID: At 8:41 AM +0100 3/29/02, phil@triloggroup.com wrote: >After looking at DOM4J, it appears that these guys added this >capability recently ("stripWhitespaceText"). This is >effectively very convenient when dealing with data centric document. >Can we add it to JDOM? > This makes me very nervous. It's a common misconception that white space is insignificant in XML. It's not. As long as the default is to keep all space, and throwing it away requires an explicit client choice, I can live with this, but please put big warnings about it in the JavaDoc. And you'd have to define very carefully what space is kept and what is not and document your choice. For instance, do you want to throw away all white space? All white-space only text nodes? All ignorable white space? These are three different things. Another thought: maybe what's needed is a more generic builder filter operation that could do this and a lot more? SAX filters could certainly handle it. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ From tpreston at amadeusboston.com Fri Mar 29 09:12:51 2002 From: tpreston at amadeusboston.com (Tom Preston) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] MORE ABOUT: Problem with Jdom8 - getChildren() on root ... Message-ID: <498B0C8F9141D511927B009027B1138754FCAE@email-temp.amadeusboston.com> There IS more to the story. We are using EJB. When we get rid of the EJB aspect the problem goes away. So, we find that the problem is returning a jdom 8 Document from EJB. Something in the marshalling process is messing up the document so that root.hasChildren() returns true while root.getChildren returns a zero sized list after ANY Document has been returned from ANY EJB method. Here is the trivial example for reproduction: Make an EJB which has this signature in the RemoteInterface: public Document getSimpleDoc() throws Exception, RemoteException; In the EJBean class implement the remote interface: public Document getSimpleDoc() throws Exception { Element theRoot = new Element("Root"); Element levelA = new Element("A"); Element levelB = new Element("B"); levelB.addContent(new Element("levelB").addContent("5")); theRoot.addContent(levelA.addContent(levelB)); Document doc = new Document(theRoot); Element root = doc.getRootElement(); System.out.println("Inside of the EJB Method: root.hasChildren(): " + root.hasChildren() + " root.getChildren().size(): " + root.getChildren().size() ); return doc; } Now make a trivial JSP to call the EJB getSimpleDoc() method: <%@ page import=" javax.naming.*; com.mycompany.ejb.session.productdisplay.*; org.jdom.*; org.jdom.output.XMLOutputter; com.mycompany.utilities.*;" errorPage="/components/common/ErrorPage.jsp" %> <% Context ctx = Utils.getServerInitialContext(); ProductDisplayHome productDisplayHome = (ProductDisplayHome)ctx.lookup("ProductDisplayHome"); ProductDisplay productDisplay = productDisplayHome.create(); Document doc = productDisplay.getSimpleDoc(); Element root = doc.getRootElement(); out.print("Inside of the JSP (the Caller) Method: root.hasChildren(): " + root.hasChildren() + " root.getChildren().size(): " + root.getChildren().size() ); // XMLOutputter xo = new XMLOutputter(" ", true); // xo.output(doc,System.out); %> You will see that the System.out.println from WITHIN the EJB (before the Document gets returned -- and therefore, before it gets marshalled and unmarshalled) prints out: Inside of the EJB Method: root.hasChildren(): true root.getChildren().size(): 1 But inside of the JSP when dealing with the Document that has gone thru serialization (marshalling and unmarshalling) you get: Inside of the JSP (the Caller) Method: root.hasChildren(): true root.getChildren().size(): 0 For the very same Document...the only difference being that the Document was passed thru EJB Marshalling and Unmarshalling, you have two different getChildren() of root results. My theory is that something in JDOM version 8 RC has made some field "transient" that shouldn't be and therefore the Document object is different before serialization than it is after serialization. I think that this is a major problem for anyone returning Document objects from EJB methods (like we were). Thanks Tom Preston -------------- next part -------------- An HTML attachment was scrubbed... URL: http://jdom.org/pipermail/jdom-interest/attachments/20020329/4ed926e2/attachment.htm From arosen at silverstream.com Fri Mar 29 11:18:08 2002 From: arosen at silverstream.com (Alex Rosen) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] SAXBuilder enhancement request /2 In-Reply-To: Message-ID: <00be01c1d756$767f2d50$6a65810a@silverstream.com> I've always wanted an option that would throw away all whitespace from Elements that have child Elements, perhaps with an exception for xml:space="preserve". This heuristic would ensure that data-centric XML would never lose information. "Data-centric" means any XML without mixed content, like J2EE deployment desciptors, Ant buildfiles, etc. It would, of course, be off by default. Alex > -----Original Message----- > From: jdom-interest-admin@jdom.org > [mailto:jdom-interest-admin@jdom.org]On Behalf Of Elliotte > Rusty Harold > Sent: Friday, March 29, 2002 8:41 AM > To: phil@triloggroup.com; jdom-interest@jdom.org > Subject: Re: [jdom-interest] SAXBuilder enhancement request /2 > > > At 8:41 AM +0100 3/29/02, phil@triloggroup.com wrote: > >After looking at DOM4J, it appears that these guys added this > >capability recently ("stripWhitespaceText"). This is > >effectively very convenient when dealing with data centric document. > >Can we add it to JDOM? > > > > This makes me very nervous. It's a common misconception that white > space is insignificant in XML. It's not. > > As long as the default is to keep all space, and throwing it away > requires an explicit client choice, I can live with this, but please > put big warnings about it in the JavaDoc. > > And you'd have to define very carefully what space is kept and what > is not and document your choice. For instance, do you want to throw > away all white space? All white-space only text nodes? All ignorable > white space? These are three different things. > > Another thought: maybe what's needed is a more generic builder filter > operation that could do this and a lot more? SAX filters could > certainly handle it. > -- > > +-----------------------+------------------------+-------------------+ > | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | > +-----------------------+------------------------+-------------------+ > | The XML Bible, 2nd Edition (Hungry Minds, 2001) | > | http://www.cafeconleche.org/books/bible2/ | > | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | > +----------------------------------+---------------------------------+ > | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | > | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | > +----------------------------------+---------------------------------+ > _______________________________________________ > To control your jdom-interest membership: > http://lists.denveronline.net/mailman/options/jdom-interest/yo uraddr@yourhost.com From jhunter at acm.org Fri Mar 29 19:07:39 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] org.jdom.xpath.XPath Message-ID: <3CA52BFB.C0B7C1C8@acm.org> I just checked in an org.jdom.xpath.XPath class written by Laurent Bihanic which provides a simple API for the common XPath calls you'll want to make. It by default right now wraps the Jaxen library, but it's designed so we can plug alternative implementations in the future. I welcome people using XPath to test it out and see how it works for you. Also, for the people helping design JDOM, the API isn't fixed and we should ensure it's exactly what we want. Bob, your comments are most welcome. -jh- From dms at sosnoski.com Fri Mar 29 19:19:51 2002 From: dms at sosnoski.com (Dennis Sosnoski) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] SAXBuilder enhancement request /2 References: Message-ID: <3CA52ED7.3030309@sosnoski.com> I've advocated this approach for document models and I'm glad to see it present in dom4j, but I absolutely agree that this should not be the default! Most XML usage in Java programs is data centric, though, with whitespace between elements used only for convenient formatting. A compliant XML parser gives you the whitespace as content (unless you're validating, in which case whitespace separating elements may be reported as ignorable whitespace), resulting in a lot of extra components in the document tree. This adds substantial overhead without contributing anything useful as far as the application is concerned. Many applications also want to ignore leading and trailing whitespace in character data content. An example of this type of usage is the web.xml file used by servlet applications. Recent versions of the spec require implementations to strip all leading and trailing whitespace from the content of elements. I'd personally recommend two options - one to discard character data sequences consisting only of whitespace, the other to strip leading and trailing whitespace from character data content. It could also be done using a filter, as ERH suggests, though this might be a little more complicated - for stripping trailing whitespace you'd need to make sure you have the entire character data sequence available, rather than just a portion. It's worth noting that EXML was silently deleting whitespace between elements for a very long time without any of its users complaining, as far as I know. I finally started pointing this out to people in my performance comparisons because it makes EXML's results look much better than the code justifies. - Dennis Elliotte Rusty Harold wrote: > At 8:41 AM +0100 3/29/02, phil@triloggroup.com wrote: > >> After looking at DOM4J, it appears that these guys added this >> capability recently ("stripWhitespaceText"). This is >> effectively very convenient when dealing with data centric document. >> Can we add it to JDOM? >> > > This makes me very nervous. It's a common misconception that white > space is insignificant in XML. It's not. > > As long as the default is to keep all space, and throwing it away > requires an explicit client choice, I can live with this, but please > put big warnings about it in the JavaDoc. > > And you'd have to define very carefully what space is kept and what is > not and document your choice. For instance, do you want to throw away > all white space? All white-space only text nodes? All ignorable white > space? These are three different things. > > Another thought: maybe what's needed is a more generic builder filter > operation that could do this and a lot more? SAX filters could > certainly handle it. From hip at a.cs.okstate.edu Fri Mar 29 21:18:34 2002 From: hip at a.cs.okstate.edu (Bradley S. Huffman) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] SAXBuilder enhancement request /2 In-Reply-To: Your message of "Fri, 29 Mar 2002 19:19:51 PST." <3CA52ED7.3030309@sosnoski.com> Message-ID: <200203300519.WAA03829@dorothy.denveronline.net> Dennis Sosnoski writes: > I'd personally recommend two options - one to discard character data > sequences consisting only of whitespace, the other to strip leading and > trailing whitespace from character data content. It could also be done > using a filter, as ERH suggests, though this might be a little more > complicated - for stripping trailing whitespace you'd need to make sure > you have the entire character data sequence available, rather than just > a portion. FYI, in SAXHandler we have the entire sequence of characters between tags. I think SAX's XMLFilter is too complicated for this application, so my I suggest a simple CharacterHandler as follows: public interface CharacterHandler { /** Return String for Text node */ public String text(char[] data); /** Return String for CDATA node */ public String cdata(char[] data); } and a setCharacterHandler(CharacterHandler) in SAXBuilder. Another option would be to allow JDOMFactory to return null from the text and cdata methods to indicate to SAXHandler there is nothing to add. Brad From dms at sosnoski.com Fri Mar 29 21:58:02 2002 From: dms at sosnoski.com (Dennis Sosnoski) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Next JDOM evolution References: Message-ID: <3CA553EA.9040902@sosnoski.com> Phil's comments illustrate exactly why I made the remark quoted. If JDOM is going to continue to be promoted for use in real products I think the development team owes it to their users to (1) keep the API stable, possibly adding methods but not breaking code in new releases, and (2) support and provide fixes to the released version rather than just the then-current CVS version. Otherwise, I feel JDOM should come with the same sort of disclaimer as the Sun Early Access releases of other JSRs - evaluation only, everything subject to change, not for use in production products, etc. As it is right now JDOM sometimes appears to be claiming the stature of a standard without accepting the responsibility that goes along with it. - Dennis phil@triloggroup.com wrote: >After reading the TODO.TXT delivered with beta 8, it appears that CDATA & Text will evolve. This is a good thing, as >long as these classes appear in the same hierarchy and are not merged in one class. There are currently to much >applications using JDOM and doing such a change breaks them! For example, both the introduction of Text and the >exception thrown from Document.getRootElement() really cost us a lot. And we are'nt yet synchronized with our partners, >who did'nt yet update their code and then are incompatible! > >Please, ensure that now the API won't change, just evolve by adding capabilties and enhance the overall performance. We >really need to have a stable and released API. I'm really afraid when reading artticle like the one written by Denis >Snososki: > >>>>...It also suffers from an API that's still changing every few months with a new beta release (the next version, beta >>>> >8, is in preparation as I write this). JDOM does offer a convenient way of building and accessing simple XML documents, >but the lack of stability makes it difficult to justify for use in production projects....<<< > >By the way, it is always the same debate: building a true class hierarchy. Currently, the source code with lots of >instanceof is really awful, while a base Node class with make it more ellegant with any penality. Moreover, checking a >node type will be faster when using a getNodeType() like method, instead of using instanceof operator. With the >introduction of Text class, it is very easy and we should leverage it. > >Thanks, >Phil. > >_______________________________________________ >To control your jdom-interest membership: >http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com > From jozart at csi.com Sat Mar 30 02:05:59 2002 From: jozart at csi.com (Joseph Bowbeer) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Re: SAXBuilder enhancement request /2 References: <200203300937.CAA25580@dorothy.denveronline.net> Message-ID: <000701c1d7d2$7e10d1a0$0181a8c0@corp.uievolution.com> Btw, a whitespace stripping filter is here: http://cvs.jdom.org/cgi-bin/viewcvs.cgi/jdom/samples/sax/DataUnformatFilter. java As the javadoc says: * This filter removes leading and trailing whitespace from field-oriented * XML without mixed content. Note that this class will likely not yield * appropriate results for document-oriented XML like XHTML pages * which mix character data and elements together. ----- Original Message ----- > [...] It could also be done using a filter, as ERH suggests, though this might be a little more complicated - for stripping trailing whitespace you'd need to make sure you have the entire character data sequence available, rather than just a portion. [...] From dms at sosnoski.com Sat Mar 30 02:40:26 2002 From: dms at sosnoski.com (Dennis Sosnoski) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Re: SAXBuilder enhancement request /2 References: <200203300937.CAA25580@dorothy.denveronline.net> <000701c1d7d2$7e10d1a0$0181a8c0@corp.uievolution.com> Message-ID: <3CA5961A.7050002@sosnoski.com> From a quick look at the code this appears to remove character data consisting only of whitespace separating elements - it doesn't strip leading and trailing whitespace from the character data content of an element. It might be good to change the class description to make this clear. :-) It could be modified to strip leading and trailing whitespace with some work; right now it just collects whitespace character data if it hasn't seen anything that's not a whitespace, and once it sees a nonwhitespace passes everything on directly. Instead it'd need to accumulate all the character data once it sees a nonwhitespace (scanning from the start of each sequence, not the end), then strip trailing whitespace before it dumps the data to the next step (on any non-character data event). Performance would be better just doing the whitespace stripping within the SAXHandler, though (no copying and extra array creation steps). - Dennis Joseph Bowbeer wrote: >Btw, a whitespace stripping filter is here: > >http://cvs.jdom.org/cgi-bin/viewcvs.cgi/jdom/samples/sax/DataUnformatFilter. >java > >As the javadoc says: > >* This filter removes leading and trailing whitespace from field-oriented >* XML without mixed content. Note that this class will likely not yield >* appropriate results for document-oriented XML like XHTML pages >* which mix character data and elements together. > >----- Original Message ----- > > >[...] It could also be done using a filter, as ERH suggests, though this >might be a little more complicated - for stripping trailing whitespace you'd >need to make sure you have the entire character data sequence available, >rather than just a portion. [...] > > > From jozart at csi.com Sat Mar 30 03:12:50 2002 From: jozart at csi.com (Joseph Bowbeer) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Re: SAXBuilder enhancement request /2 References: <200203300937.CAA25580@dorothy.denveronline.net> <000701c1d7d2$7e10d1a0$0181a8c0@corp.uievolution.com> <3CA5961A.7050002@sosnoski.com> Message-ID: <001b01c1d7db$d4e2af40$0181a8c0@corp.uievolution.com> Oh yeah :-) It was only designed to remove the inter-element formatting introduced by DataFormatFilter. ----- Original Message ----- From: "Dennis Sosnoski" To: "Joseph Bowbeer" Cc: ; Sent: Saturday, March 30, 2002 2:40 AM Subject: Re: SAXBuilder enhancement request /2 > > From a quick look at the code this appears to remove character data > consisting only of whitespace separating elements - it doesn't strip > leading and trailing whitespace from the character data content of an > element. It might be good to change the class description to make this > clear. :-) > > It could be modified to strip leading and trailing whitespace with some > work; right now it just collects whitespace character data if it hasn't > seen anything that's not a whitespace, and once it sees a nonwhitespace > passes everything on directly. Instead it'd need to accumulate all the > character data once it sees a nonwhitespace (scanning from the start of > each sequence, not the end), then strip trailing whitespace before it > dumps the data to the next step (on any non-character data event). > > Performance would be better just doing the whitespace stripping within > the SAXHandler, though (no copying and extra array creation steps). > > - Dennis > > Joseph Bowbeer wrote: > > >Btw, a whitespace stripping filter is here: > > > >http://cvs.jdom.org/cgi-bin/viewcvs.cgi/jdom/samples/sax/DataUnformatFilter . > >java > > > >As the javadoc says: > > > >* This filter removes leading and trailing whitespace from field-oriented > >* XML without mixed content. Note that this class will likely not yield > >* appropriate results for document-oriented XML like XHTML pages > >* which mix character data and elements together. > > > >----- Original Message ----- > > > > >[...] It could also be done using a filter, as ERH suggests, though this > >might be a little more complicated - for stripping trailing whitespace you'd > >need to make sure you have the entire character data sequence available, > >rather than just a portion. [...] > > > > > > > > From elharo at metalab.unc.edu Sat Mar 30 04:13:22 2002 From: elharo at metalab.unc.edu (Elliotte Rusty Harold) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Re: SAXBuilder enhancement request /2 In-Reply-To: <3CA5961A.7050002@sosnoski.com> References: <200203300937.CAA25580@dorothy.denveronline.net> <000701c1d7d2$7e10d1a0$0181a8c0@corp.uievolution.com> <3CA5961A.7050002@sosnoski.com> Message-ID: At 2:40 AM -0800 3/30/02, Dennis Sosnoski wrote: >From a quick look at the code this appears to remove character data >consisting only of whitespace separating elements - it doesn't strip >leading and trailing whitespace from the character data content of >an element. It might be good to change the class description to make >this clear. :-) > White space trimming from elements that contain non-white space data seems even more dangerous to me than removing white-space only nodes. Plus there's less of a use-case for it. It's not like it's all that hard to call String.trim(). I propose that JDOM *not* include any trimming functionality. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ From elharo at metalab.unc.edu Sat Mar 30 04:39:54 2002 From: elharo at metalab.unc.edu (Elliotte Rusty Harold) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Next JDOM evolution In-Reply-To: <3CA553EA.9040902@sosnoski.com> References: <3CA553EA.9040902@sosnoski.com> Message-ID: At 9:58 PM -0800 3/29/02, Dennis Sosnoski wrote: >Phil's comments illustrate exactly why I made the remark quoted. If >JDOM is going to continue to be promoted for use in real products I >think the development team owes it to their users to (1) keep the >API stable, possibly adding methods but not breaking code in new >releases, and (2) support and provide fixes to the released version >rather than just the then-current CVS version. > This is a beta of a 1.0 product. I don't think we're ready to make any promises of API stability yet. For what it's worth, we are getting close and I do plan to spend a large chunk of the next month reading through the entire JDOM Javadocs and code base to try to pick up on any problems that remain. I'll be doing this as part of writing the JDOM chapters of Processing XML with Java. >Otherwise, I feel JDOM should come with the same sort of disclaimer >as the Sun Early Access releases of other JSRs - evaluation only, >everything subject to change, not for use in production products, >etc. As it is right now JDOM sometimes appears to be claiming the >stature of a standard without accepting the responsibility that goes >along with it. > It's not a standard. It is a JSR. If someone really needs stability they can pick a milestone and not upgrade it. -- +-----------------------+------------------------+-------------------+ | Elliotte Rusty Harold | elharo@metalab.unc.edu | Writer/Programmer | +-----------------------+------------------------+-------------------+ | The XML Bible, 2nd Edition (Hungry Minds, 2001) | | http://www.cafeconleche.org/books/bible2/ | | http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ | +----------------------------------+---------------------------------+ | Read Cafe au Lait for Java News: http://www.cafeaulait.org/ | | Read Cafe con Leche for XML News: http://www.cafeconleche.org/ | +----------------------------------+---------------------------------+ From philip.nelson at omniresources.com Sat Mar 30 08:17:04 2002 From: philip.nelson at omniresources.com (philip.nelson@omniresources.com) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Re: SAXBuilder enhancement request /2 Message-ID: > White space trimming from elements that contain non-white space data > seems even more dangerous to me than removing white-space only nodes. > Plus there's less of a use-case for it. It's not like it's all that > hard to call String.trim(). I propose that JDOM *not* include any > trimming functionality. Yup. We already had this discussion and determined that trimming whitespace was too easy to do without cluttering the api. Again that mythical helper class in jdom-contrib if anybody really wants to... From dms at sosnoski.com Sat Mar 30 10:10:28 2002 From: dms at sosnoski.com (Dennis Sosnoski) Date: Fri Aug 6 17:07:31 2004 Subject: [Fwd: Re: [jdom-interest] Re: SAXBuilder enhancement request /2] Message-ID: <3CA5FF94.1030100@sosnoski.com> Whoops, meant this to go the list, too. -------------- next part -------------- An embedded message was scrubbed... From: Dennis Sosnoski Subject: Re: [jdom-interest] Re: SAXBuilder enhancement request /2 Date: Sat, 30 Mar 2002 10:09:42 -0800 Size: 1862 Url: http://jdom.org/pipermail/jdom-interest/attachments/20020330/21fa6fae/2.eml From noamt at yahoo.com Sat Mar 30 10:26:51 2002 From: noamt at yahoo.com (Noam Tamim) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Re: SAXBuilder enhancement request /2 In-Reply-To: Message-ID: <20020330182651.1465.qmail@web13906.mail.yahoo.com> --- philip.nelson@omniresources.com wrote: [whitespace trimming] > Yup. We already had this discussion and determined that trimming > whitespace > was too easy to do without cluttering the api. Again that mythical helper > class in jdom-contrib if anybody really wants to... But what if trimming-while-building can make the build process faster? ===== Noam. __________________________________________________ Do You Yahoo!? Yahoo! Greetings - send holiday greetings for Easter, Passover http://greetings.yahoo.com/ From jhunter at acm.org Sat Mar 30 11:43:12 2002 From: jhunter at acm.org (Jason Hunter) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Next JDOM evolution References: <3CA553EA.9040902@sosnoski.com> Message-ID: <3CA61550.FB23B440@acm.org> > Phil's comments illustrate exactly why I made the remark quoted. If JDOM > is going to continue to be promoted for use in real products I think the > development team owes it to their users to (1) keep the API stable, > possibly adding methods but not breaking code in new releases, and (2) > support and provide fixes to the released version rather than just the > then-current CVS version. Here's the text from the CHANGES.txt file from b7 to b8... REMOVED CLASSES --------------- None. REMOVED METHODS --------------- Removed the methods deprecated in beta7. DEPRECATED METHODS ------------------ Deprecated the DOMBuilder.build() methods that build from a File, URL, or InputStream. This helps people understand those methods are for testing only. DOMBuilder.build(org.w3c.dom.Document) and such are still undeprecated. Beta7 to Beta8 was a big improvement, but you don't see a whole lot of churn in backward compatability. We keep the option open to break compatability, but we don't churn needlessly. We also deprecate in Beta N before removal in Beta N+1, so if you're upgrading beta by beta you won't have problems and will have plenty of time to adjust your method calls. > Otherwise, I feel JDOM should come with the same sort of disclaimer as > the Sun Early Access releases of other JSRs - evaluation only, > everything subject to change, not for use in production products, etc. > As it is right now JDOM sometimes appears to be claiming the stature of > a standard without accepting the responsibility that goes along with it. It has the word "Beta" on it. The download page gives all kind of warnings. -jh- From philip.nelson at omniresources.com Sat Mar 30 12:15:27 2002 From: philip.nelson at omniresources.com (philip.nelson@omniresources.com) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Re: SAXBuilder enhancement request /2 Message-ID: > --- philip.nelson@omniresources.com wrote: > [whitespace trimming] > > Yup. We already had this discussion and determined that trimming > > whitespace was too easy to do without cluttering the api. > Again that > > mythical helper class in jdom-contrib if anybody really wants to... > > But what if trimming-while-building can make the build process faster? That could be a good thing and I'm all for somebody coming up with a good filter. Looks like we already agree that we wouldn't need to change the api for that. But, that isn't quite the same as adding some soft of trim method to element. On the issue of speed. The fastest thing I ran across that would work for building a JDOM document was to use the sax 1.0 version of MinML. JDOM no longer has a way to work with that sax api but I rolled my own in a couple of hours. The speed gain was great, ~50% as I recall. Of course you have to live without whitespace for the most part, namespaces, mixed content of any sort and probably other shortcomings you may not be able to live with. Christian Gross was talking last year at SDExpo about a similar approach to speed. He got his application working with a standard parser. Then he took the parser (Expat I think) and just started ripping it apart for things he didn't need. This idea of using a filter makes sense but *maybe* what most of us data oriented folks probably need is a faster and simpler parser that we could use when appropriate for our apps. From dms at sosnoski.com Sat Mar 30 14:01:22 2002 From: dms at sosnoski.com (Dennis Sosnoski) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Next JDOM evolution References: <3CA553EA.9040902@sosnoski.com> <3CA61550.FB23B440@acm.org> Message-ID: <3CA635B2.6010107@sosnoski.com> Jason Hunter wrote: >Here's the text from the CHANGES.txt file from b7 to b8... > >REMOVED CLASSES >--------------- >None. > >REMOVED METHODS >--------------- >Removed the methods deprecated in beta7. > >DEPRECATED METHODS >------------------ >Deprecated the DOMBuilder.build() methods that build from a File, URL, >or >InputStream. This helps people understand those methods are for testing >only. >DOMBuilder.build(org.w3c.dom.Document) and such are still undeprecated. > > >Beta7 to Beta8 was a big improvement, but you don't see a whole lot of >churn in backward compatability. We keep the option open to break >compatability, but we don't churn needlessly. We also deprecate in Beta >N before removal in Beta N+1, so if you're upgrading beta by beta you >won't have problems and will have plenty of time to adjust your method >calls. > This doesn't mention the change to using a Text element in Beta8, which definitely breaks existing code. >>Otherwise, I feel JDOM should come with the same sort of disclaimer as >>the Sun Early Access releases of other JSRs - evaluation only, >>everything subject to change, not for use in production products, etc. >>As it is right now JDOM sometimes appears to be claiming the stature of >>a standard without accepting the responsibility that goes along with it. >> > >It has the word "Beta" on it. The download page gives all kind of >warnings. > >-jh- > "all kinds of warnings" seems a bit of an overstatement. The only relevant text I can see is the general description of Milestone Builds, which the betas are listed under: " Milestone builds indicate large additions in functionality, or pre-release, feature-frozen builds that may soon become release builds. Although generally stable, they often contain new features that are still being tested for their value and usability. These are great for developers and users trying to see what is coming in the next versions of JDOM." That seems ambiguous at best, especially compared to the very explicit disclaimers on other, comparable, pre-releases. As I've said several times over the last year, I look forward to when JDOM does have a stable release. It definitely makes many types of operations very easy, and will be a great addition to the Java XML toolset once it's in stable form. Until then it's a risk to use in production products because it's essentially unsupported ("update to the latest CVS version and change your code to match" doesn't count in my book). - Dennis From phil at triloggroup.com Sat Mar 30 23:34:29 2002 From: phil at triloggroup.com (phil@triloggroup.com) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Next JDOM evolution Message-ID: I personnaly faced 3 problems when moving from B7 to B8 => First is the introduction of the text class. As we often do a getContent() and check the type of a node, this code was broken. Moreover, it is quite dificult to locate compared to a method removal or a signature change. => Secundo, getRootElement() now throws an exception instead of retuning null. Currently, we have lots of code like if( doc.getRootElement()!=null ) { //.... } And this code is also broken, and also *very* difficult to locate. For example, if you have a method like void doSomething( Element e ) { if( e!=null ) { //.... } You should be careful when you call it. Moreover, I thought that this change was happy for 2 reasons: * Document allows a null root, so it is not an illegal state but a valid one * this is not coherent with other methods (ex: Element.getChild(String name)). So, when to check the returned value and when to catch an exception? => The list changes also broke some code, throwing some Concurrent From phil at triloggroup.com Sat Mar 30 23:49:44 2002 From: phil at triloggroup.com (phil@triloggroup.com) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] Next JDOM evolution Message-ID: I personnaly faced 3 problems when moving from B7 to B8 => First is the introduction of the text class. As we often do a getContent() and check the type of a node, this code was broken. Moreover, it is quite dificult to locate compared to a method removal or a signature change. => Secundo, getRootElement() now throws an exception instead of retuning null. Currently, we have lots of code like if( doc.getRootElement()!=null ) { //.... } And this code is also broken, and also *very* difficult to locate. For example, if you have a method like void doSomething( Element e ) { if( e!=null ) { //.... } You should be careful when you call it. Moreover, I thought that this change was unhappy for the following 2 reasons: * Document allows a null root, so it is not an illegal state but a valid one * this is not coherent with other methods (ex: Element.getChild(String name)). So, when to check the returned value and when to catch an exception? As it is not an error, it should not throw an exception. To be honest, that change has so many impacts that it justified I built my own JDOM jar file and keep the old behavior!! => Finally, the list changes also broke some code, by throwing some ConcurrentModificationException or changing some behaviors (ex: getting a children list and, while browsing it, removing some elements). But I admit that, even if there some incompatibilities, we previously incorrectly used the list and this is safer now. >>>As I've said several times over the last year, I look forward to when JDOM does have a stable release<<< I completly agree with Denis. We are now using JDOM for while (about 1 year & half), because we trusted the product philosophy and found it as a great and easier alternative to the classical DOM. But since that time, it is still beta, evolving while not maintaining compatiblity, and we cannot rely on it. As Denis said, JDOM is often presented as a 'de facto' standard (which, for example, DOM4J is not while stable!) and it should assume this state. Brett already wrote chapters in his books, Elliot is also going to write some... It is really now time to release it, this is the only way to a wide acceptance and recongition. Phil. From phil at triloggroup.com Sun Mar 31 00:00:49 2002 From: phil at triloggroup.com (phil@triloggroup.com) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] SAXBuilder enhancement request /2 Message-ID: Alex wrote: >>>I've always wanted an option that would throw away all whitespace from Elements that have child Elements<<< It is not only for Elements that have children, because you may have cases liken Which is an empty list and should not contain any Text node. I think that the options should remove all space only string, regarding less of the other children. Dennis wrote: >>>I've advocated this approach for document models and I'm glad to see it present in dom4j, but I absolutely agree that this should not be the default<<< I completly agree: it should be an option, that one can set when dealing with data oriented files. It should not be activated by default! Elliot wrote: >>>This makes me very nervous. It's a common misconception that white space is insignificant in XML. It's not.<<< I also agree from a pure specification point of view. But this can be relaxed is specific case and it is up to an application to decide what to do with its data. The web.xml mentionned by Dennis is a good example fo that. Here a example of a servlet definition, directly copied from my environment: flowbuilderserver flowbuilderserver com.flowbuilder.FlowBuilderServlet 2 Do you think that the whitespaces are significant in that case? If the parser cannot remove them, then the application will do it and this will add a complexity layer to the application (taking care of unwanted Text nodes). Phil. From Shinnie.Gu at iuniverse.com.cn Sun Mar 31 23:49:48 2002 From: Shinnie.Gu at iuniverse.com.cn (Gu Xueying (Shinnie Gu)) Date: Fri Aug 6 17:07:31 2004 Subject: [jdom-interest] a question about validation Message-ID: hi, I have a question about validation. I use JDOM and when I have got a document by parser and have made some changes to the jdom tree(document) then I want to know whether the document which has been changed is valid according to DTD. Is there any method in JDOM to do that validation except parsing the document again? Any help is appreciated. Thanks Shinnie 58305001 - 8701