Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 55296 invoked from network); 13 Jul 2004 22:09:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 13 Jul 2004 22:09:40 -0000 Received: (qmail 53867 invoked by uid 500); 13 Jul 2004 22:09:14 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 53680 invoked by uid 500); 13 Jul 2004 22:09:12 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 53659 invoked by uid 99); 13 Jul 2004 22:09:11 -0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received: from [195.188.213.5] (HELO smtp-out2.blueyonder.co.uk) (195.188.213.5) by apache.org (qpsmtpd/0.27.1) with ESMTP; Tue, 13 Jul 2004 15:09:09 -0700 Received: from [10.0.0.2] ([82.38.65.173]) by smtp-out2.blueyonder.co.uk with Microsoft SMTPSVC(5.0.2195.6713); Tue, 13 Jul 2004 23:09:21 +0100 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v618) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <3F593071-D519-11D8-91AB-003065DC754C@blueyonder.co.uk> Content-Transfer-Encoding: 7bit Cc: hps@intermeta.de From: robert burrell donkin Subject: Re: [BETWIXT] Array of bytes anyone? Date: Tue, 13 Jul 2004 23:09:02 +0100 To: "Jakarta Commons Developers List" X-Mailer: Apple Mail (2.618) X-OriginalArrivalTime: 13 Jul 2004 22:09:21.0371 (UTC) FILETIME=[0C90DAB0:01C46926] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N On 13 Jul 2004, at 16:51, Henning P. Schmiedehausen wrote: > Hi, hi henning > for a project, I need Betwixt to convert a special sort of beans into > XML. Beans, which contain a byte [] property (They come from Hibernate > which maps BINARY and TEXT onto these types, which is fine). > > Regular Betwixt builds something like > > > 0 > 1 > 2 > 3 > > > for propery foo, which is not exactly the most efficient way to > express this array of bytes. Especially if it has about 5 MBytes > size. ;-) yep > I was wondering whether I could get this done with regular betwixt but > the isPrimitive() in XMLIntrospectorHelp always bite me. > XMLIntrospectorHelper is very limiting and will hopefully be completely deprecated sometime soon. the primitives concept needs to be extended into the more flexible concept of simple type. (the simple type concept is more often used in the xml-object binding community.) the refactored code with improved design has been merged into HEAD now and some of these changes in this direction have been made (but i've lost track a bit since i'm currently juggling a number of releases at the moment). just FYI the plan is to cut a 1.6 based on the improved design very soon. > In the end I came up with the attached patch, which works fine for me > (it might not > be ideal, because the resulting XML contains the raw sew^Wbinary data > if you write the bean out. i'm not sure i parse this correctly. (it's a little late, so it might be me.) care to expand? > For my application I extend the DefaultObjectStringConverter to do > base64 encoding on the fly and end up with nice looking XML like this: > > > > xCHPdC7mAlirPoYY8dZr1fACaXAqpW83BKOz// > yCMWUkzgtkvkMhD0MwQpclKdsOhHB1PbaRzbxA > 5KmsIprAxtG5Vkm2ze5jRUPY+og3Rqq5ccj19BL6joB0PKQmnJRlU0bw9ZGJntrIVH4g9Lq > 1E4Sx > bquW8iIOBGvsE3kYaW0bbf1mdPT2ubNnW2+fbm17wnhQxw9Ertbz1M69Mdp649/TZ// > 64WVw6Gg5 > aLwq2161CMeKB0glbtMXxpNGASDG4G42q16YDtOIbJwRF429GLfpc+OJAI7UkHhGvx+cDcH > YbTUC > YoSnsRNN+jn9AfcogqRDz/ > SfejeSC8FY0WQzggCCM8LT2BdjNs3T9fNEgCzWMyXRTRSCofdVFiD2 > L1cSbZxSgQAAAABJRU5ErkJggg== > > > > which is exactly what I need. > > I was wondering if it would be more clever to allow the user to > explicitly set the primitiveType property of the element descriptor > from the .betwixt file. I found no way to do so, though and I already > had this patch which works for me. the answer is yes but the concept needs to move from a fixed list of primitives to a flexible, configurable (with strategy plugin as well as property) simple type binding. this is definitely on the to-do list but i'm right in the middle of managing various release cycles so i'm not sure when i'll get the chance to look at this. it should be pretty straightforward and i'd be willing to help explain the new design, so if you'd like to volunteer to take this on, that would be great. > Anyway, here is the patch, discussions welcome. ;-) This is against > CVS HEAD. I would volunteer to write an Unit test for it if has a > chance to get applied. there is every chance that a fix for this would get committed with a unit test :) i have an idea that the patch is against the 0.5 code base (but i could be wrong since i haven't looked into this in detail). please set my suspicious mind at rest by updating before you start getting into this. - robert --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org