avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <blorit...@apache.org>
Subject Re: [Vote] Namespace support for Configuration objects
Date Mon, 01 Oct 2001 16:34:27 GMT
Leo Sutic wrote:
> > I would be -1 on this.  Configuration is built from SAX
> > currently, and adding
> > DOM nodes to the Configuration tree removes one of their main virtues: the
> > fact that they consume fewer resources.
> That would only be a virtue if you have massive amounts of configuration
> data in the system. So much, in fact, that it overwhelms any other category
> of objects. I have not encountered any example of this.

I still don't see the value.  In a configuration tree, you have child configuration
objects.  You have _*A*_ value, that can be transformed into a simple type if
necessary.  Complex "values" are stored as child configuration elements--and
nothing else.  In fact, if a Configuration object has children AND a value, it
is technically in error.

> Storing DOM nodes in configurations is resource-intensive, yes, but:
> a) few types of configuration require massive amounts of DOM data.

Read this again: FEW types require the overhead of DOM.

> b) There is only one instance in the whole system, if it is used by the
> ExcaliburComponentManager. The CM loads the config and portions out parts of
> it to its components.

In a complex system, you can have a megabyte of configuration information--
converted to dom would be too much.  Again, the benefit of a DOM node being
relatively available does not outweigh its costs.

> so the gain by using SAX over DOM is not as great.

Maybe not, but again, I don't see the usefulness of making the Configuration
object into a DOM.  It is not meant to be a DOM, and I think it is a harmful
pattern in the long run.

> However, Cocoon2 has (had?) an XML compiler that transformed
> SAX->bytestream. Maybe a
>   getValueAsCompiledXML ()
> or
>   streamValue (ContentHandler ch)
> The configuration would then be:
>  <myvalue>
>     <avalon:xml>
>        This text will be sent <b>along with the tags</b> to the
> <i>ContentHandler</i>
>        below.
>     </avalon:xml>
>  </myvalue>

This would be ILLEGAL according to the contracts we have set up for
Configuration elements.  You should not mix VALUE and CHILD ELEMENTS
in the same PARENT ELEMENT.  This is a bad pattern, is not predictable
regarding whitespace, and in the end is not desired.

If you want that value expressed in Avalon as is, it would have to be
changed to one of the following:

      This text will be sent <b>along with the tags</b> to the

 - or -

    This text will be sent &lt;b&gt;along with the tags&lt;/b&gt; to the

> Now:
>   Configuration config = ...
>   Configuration myvalue = config.getChild ("myvalue");
>   myValue.stream (ch); // Fires startDocument, characters, startElement (b),
> characters,
>                              // endElement (b), characters, startElement (i), characters,


now String myValue = config.getChild ("myvalue.xml");

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

View raw message