You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Scott Sanders <ss...@nextance.com> on 2002/01/08 04:36:43 UTC

Configuration that supports mixed content

Hello all,

I am a committer over at the commons, and I currently have a need to do
xml-based configuration based on mixed content xml.  Currently Digester
cannot handle mixed content without significant interface change, and
Paolo Gaspar (sp?) pointed me to the avalon cvs repo, specifically
org.apache.avalon.framework.configuration.

Is there something better than this that might be experimental (Peter,
this is directed at you with Myrmidon)?

Is anyone interested/willing to let me pull it out into commons and make
it a fully standalone component?

Thanks
Scott Sanders

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Configuration that supports mixed content

Posted by Berin Loritsch <bl...@apache.org>.
Paulo Gaspar wrote:

>>>Is anyone interested/willing to let me pull it out into commons and make
>>>it a fully standalone component?
>>>
>>Feel free to go for it. However I wonder if something like JDOM, 
>>Dom4j (which 
>>I have never used but hear is great) or similar is more to your liking ?
>>
> 
> I suggested that Scott would use the Configuration stuff from Avalon since
> he wanted something very light also for some Configuration stuff he is
> working on at the Commons (may be you get a new convert in the process).
> 
> JDom and Dom4J are far from being that light and are much slower too.
> 
> For this kind of work, JDom and Dom4J suffer from featuritis.


It is this lightness that we strive to maintain with the Configuration
object.

Another concept is one of an XMLizable object.  If you desire a Component
that has a portion of its configuration to be mixed content, then you need
a different mechanism than the Configuration object.

In my estimation, the only reason for mixed content in a configuration
file is to allow for expressive annotation.  The question comes as where
that annotation belongs.  If it describes a Component, and you want a
"rich" markup to express information about that Component you might want
to create an Annotation object that a Configuration Engine would be able
to use.

I have defined an interface like this:

interface XMLizable
{
     void toSAX(ContentHandler handler);
     String toXML();
}

In fact, the Cocoon project adopted it when I told them about it.  It allows
any arbitrary object to use the toSAX() or toXML() methods depending on the
need.  The XMLizable object is permitted to use mixed content.  I typically
call the SAX methods myself, and the toXML() merely wraps the toSAX()
method with a String serializer.

You have the choice of hardcoding the SAX calls, or by converting it from
a String.  If your Annotation object was created from a Configuration that
had specified the annotation like this:

<annotation>
   <![CDATA[
   This is some <emphasis>mixed</emphasis> content in a <code>CDATA</code>
   section.  The whole string is read as the value of the <code>annotation</code>
   configuration element.
   ]]>
</annotation>

This will maintain the simplicity and lightness of the Configuration objects
while allowing for mixed content in specific locations.

-- 

"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Configuration that supports mixed content

Posted by Paulo Gaspar <pa...@krankikom.de>.
> > Is anyone interested/willing to let me pull it out into commons and make
> > it a fully standalone component?
> 
> Feel free to go for it. However I wonder if something like JDOM, 
> Dom4j (which 
> I have never used but hear is great) or similar is more to your liking ?

I suggested that Scott would use the Configuration stuff from Avalon since
he wanted something very light also for some Configuration stuff he is
working on at the Commons (may be you get a new convert in the process).

JDom and Dom4J are far from being that light and are much slower too.

For this kind of work, JDom and Dom4J suffer from featuritis.


Have fun,
Paulo Gaspar


> -----Original Message-----
> From: Peter Donald [mailto:peter@apache.org]
> Sent: Tuesday, January 08, 2002 10:13 AM
> To: Avalon Developers List
> Subject: Re: Configuration that supports mixed content
> 
> 
> On Tue, 8 Jan 2002 14:36, Scott Sanders wrote:
> > I am a committer over at the commons, and I currently have a need to do
> > xml-based configuration based on mixed content xml.  Currently Digester
> > cannot handle mixed content without significant interface change, and
> > Paolo Gaspar (sp?) pointed me to the avalon cvs repo, specifically
> > org.apache.avalon.framework.configuration.
> 
> Configuration by default doesn't do mixed content. We decided it 
> was bad for 
> config data - however you should be able to write/copy/clone our 
> SAXHandler 
> and allow it to use mixed content.
> 
> > Is there something better than this that might be experimental (Peter,
> > this is directed at you with Myrmidon)?
> 
> Naah ant2 + Myrmidon will disallow mixed content too ;)
> 
> > Is anyone interested/willing to let me pull it out into commons and make
> > it a fully standalone component?
> 
> Feel free to go for it. However I wonder if something like JDOM, 
> Dom4j (which 
> I have never used but hear is great) or similar is more to your liking ?
> 
> -- 
> Cheers,
> 
> Pete
> 
> "Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu 
> 
> --
> To unsubscribe, e-mail:   
<ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Configuration that supports mixed content

Posted by Peter Donald <pe...@apache.org>.
On Tue, 8 Jan 2002 14:36, Scott Sanders wrote:
> I am a committer over at the commons, and I currently have a need to do
> xml-based configuration based on mixed content xml.  Currently Digester
> cannot handle mixed content without significant interface change, and
> Paolo Gaspar (sp?) pointed me to the avalon cvs repo, specifically
> org.apache.avalon.framework.configuration.

Configuration by default doesn't do mixed content. We decided it was bad for 
config data - however you should be able to write/copy/clone our SAXHandler 
and allow it to use mixed content.

> Is there something better than this that might be experimental (Peter,
> this is directed at you with Myrmidon)?

Naah ant2 + Myrmidon will disallow mixed content too ;)

> Is anyone interested/willing to let me pull it out into commons and make
> it a fully standalone component?

Feel free to go for it. However I wonder if something like JDOM, Dom4j (which 
I have never used but hear is great) or similar is more to your liking ?

-- 
Cheers,

Pete

"Invincibility is in oneself, vulnerability in the opponent." -- Sun Tzu 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Configuration that supports mixed content

Posted by Jeff Turner <je...@socialchange.net.au>.
On Mon, Jan 07, 2002 at 07:36:43PM -0800, Scott Sanders wrote:
> Hello all,
> 
> I am a committer over at the commons, and I currently have a need to do
> xml-based configuration based on mixed content xml.  Currently Digester
> cannot handle mixed content without significant interface change, and
> Paolo Gaspar (sp?) pointed me to the avalon cvs repo, specifically
> org.apache.avalon.framework.configuration.

People are very touchy about the configuration API ;) Mixed content has
been ruled out before, as it would complicate what is currently a nice,
simple API. The theory is that if you want mixed content, use
JDOM/dom4j/something else.

> Is there something better than this that might be experimental (Peter,
> this is directed at you with Myrmidon)?
> 
> Is anyone interested/willing to let me pull it out into commons and make
> it a fully standalone component?

If you have an idea of what you want the Configuration interface to look
like, I could help fork the Avalon code to meet your needs, since I'm
quite familiar with it.


--Jeff



> Thanks
> Scott Sanders
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>