[From nobody Fri Aug 6 17:05:26 2004 X-Mozilla-Status2: 00000000 Message-ID: <3A41391A.4432F5F1@collab.net> Date: Wed, 20 Dec 2000 14:56:26 -0800 From: Jason Hunter <jhunter@collab.net> X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Gwenael Treguier <gtreguie@inexware.fr> CC: jdom-interest@jdom.org Subject: Re: [jdom-interest] Suggestions References: <00121911585700.01623@ares.inexware.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Gwenael Treguier wrote: > > Hello, > First, I often use CDATA to pass binary data (ie, MD5 encoded password). > To pass this data, I have to encode the bytes in Base64. > Could it be possible to add this feature to JDOM : A base64 encoder in JDOM? Hmm... Seems a bit out of place. I do see the use case though. Lots of people want to store binary data in XML files and use Base64 to do it. If people out there would find this really useful, speak up. > Second, but here I am not sure for the XML Specification, when you have a > reference to an entity in a plain text (ie, Dear &name;,), it seems complex > to parse the string to find entity and then do addContent("Dear > ").addContent(new Entity(name)).addContent(","); > If you just setText("Dear &name;,"), XMLOuputter gives Dear &amp;name;, > It could be done in XMLOutputter with : > protected String escapeElementEntities(String st) { > > case '&' : > + if (!isEntity(st.substring(i+1, st.length()))) > stEntity = "&amp;"; > } > > public boolean isEntity(String str) > { > int pos = str.indexOf(';'); > if (pos != -1 && org.jdom.Verifier.checkElementName(str.substring(0, > pos)) == null) > return true; > return false; > } That causes all kinds of irregularities because the tree structure wouldn't be a true representation anymore. It'd be part-tree and part-XML-string. -jh- ]