You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Christian Aust <ch...@wilde-welt.de> on 2005/02/15 15:50:47 UTC
[betwixt] How can I ignore certain instances?
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,
- 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
Re: [betwixt] How can I ignore certain instances?
Posted by robert burrell donkin <ro...@blueyonder.co.uk>.
committed a version of the patch that includes support for varying id
storage strategy for reading as well as writing.
many thanks.
- robert
On Wed, 2005-02-16 at 09:46, Christian Aust wrote:
> Christian Aust schrieb:
> > 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>
>
> I've posted a patch that allows me to do so to commons-dev. Regards,
>
> - Christian
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [betwixt] How can I ignore certain instances?
Posted by Christian Aust <ch...@wilde-welt.de>.
Christian Aust schrieb:
> 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>
I've posted a patch that allows me to do so to commons-dev. 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
Re: [betwixt] How can I ignore certain instances?
Posted by Christian Aust <ch...@wilde-welt.de>.
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
Re: [betwixt] How can I ignore certain instances?
Posted by robert burrell donkin <rd...@apache.org>.
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?
if so, then it would be very useful for you to consider the information
such a strategy would require to function in your case. (i've found it
best to build specifications from use cases.)
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org