commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Aust <christ...@wilde-welt.de>
Subject Re: [betwixt] How can I ignore certain instances?
Date Wed, 16 Feb 2005 06:42:22 GMT
Robert,

Am 15.02.2005 um 22:06 schrieb robert burrell donkin:

> On Tue, 2005-02-15 at 14:50, Christian Aust wrote:
>> Hi,
>>
>> while writing XML from a large object tree, I'd like to ignore some
>> instances that don't need to get written out. I found that the method
>> ignoreElement(ElementDescriptor, Context) of AbstractBeanWriter simply
>> checks for emptyElements. Is there any other way to keep individual
>> instances from showing up in the XML? Some kind of strategy that I 
>> could
>> implement that would check each object against a "black list"? Kind 
>> regards,
>
> your post has reminded me that this is something that's been needed for
> a while now. the way that i'd see it working would be during the
> introspection so that only certain links in the bean graph were 
> followed
> by the XMLIntrospector at introspection time. so for example, when
> introspecting a double-linked tree getParent property could always be
> ignored.
>
> (as opposed to wanting to ignore particular object instances as they 
> are
> encountered during the bind time traversal)
>
> is this the kind of thing that would satisfy?

Unfortunately, not. What I need to do here is create incomplete XML 
with "unsatisfied references". We use betwixt to serialize Objects from 
a catalog database into a web application built with Flash. We need to 
write only a small subset of "Products" from the database, but since 
every product has connections to almost any other product, mostly all 
of them end up in the XML. The resulting files become huge, and Flash 
slows down to a crawl.

Such a strategy would probably not simply ignore forbidden instances 
but instead write them as refid-elements, as if they'd been written out 
before.

<product id="1">
    <name>...</name>
    <combinations>
       <product refid="2" />
       <product refid="3" />
       <product refid="4" />
    </combinations>
</product>

Here, product 2,3,4 would have been ignored by a blacklist and treated 
as already serialized, which they aren't. Any chance I could do this by 
tweaking the way the ID mapping works? Regards,

-  Christian

--

Christian Aust
mailto:christian@wilde-welt.de
icq: 84500990 - Yahoo!: datenimperator - MSN: datenimperator
PGP: A94E 0181 664D 27E3 F05A  A751 6A7E 90D1 A0A3 DEC7


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message