You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Scott Sanders <ss...@nextance.com> on 2002/04/05 19:47:26 UTC

BeanUtils and Digester Release?

Anyone hae any blockers that would stop the release of BeanUtils 1.3 or
Digester 1.2?

Digester has the XML rules stuff that I would like to get released, and
both have had some good bugfixes.

Opiniions, suggestions?

Scott Sanders

Re: [FileUpload] Delete uploaded files on exit

Posted by John McNally <jm...@collab.net>.
applied. thanks.

john mcnally

Kelvin Tan wrote:
> 
> I've attached a patch for uploaded files to be deleted when the JVM exits
> properly. Basically a call to deleteOnExit for the uploaded file. I didn't
> really want a bunch of tmp files lying around.
> 
> Regards,
> Kelvin
> 
>   ------------------------------------------------------------------------
>                 Name: patch.txt
>    patch.txt    Type: Plain Text (text/plain)
>             Encoding: quoted-printable
> 
>   ------------------------------------------------------------------------
> --
> 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>


[FileUpload] Delete uploaded files on exit

Posted by Kelvin Tan <ke...@relevanz.com>.
I've attached a patch for uploaded files to be deleted when the JVM exits
properly. Basically a call to deleteOnExit for the uploaded file. I didn't
really want a bunch of tmp files lying around.

Regards,
Kelvin

Re: [Question] Betwix & JAXB

Posted by Stephen Colebourne <sc...@eurobell.co.uk>.
This is true, Joda also performs Java->XML mappings. And like Betwixt it is
not intended for use starting from just any old XML. (Java is king, XML is
just a data format).

Joda got written because I could find no alternative that met my
requirements. JAXB is XML focussed, I needed a Java focussed solution.
Castor had an unsuitable licence (you can't use it in a development kit),
plus it doesn't support Maps and I found a problem with Lists too. JOX
(@sourceforge) was focussed on mapping XML style names to Java ones using a
DTD, and also didn't support Maps or infinite recursion.

At the time of writing it, I didn't know about Betwixt. Now I am considering
if Betwixt and Joda may integrate - not quite sure yet. Joda currently
handles Maps and ids in a way I don't think betwixt does yet. But betwixt
offers a greater range of output formats and operates on plain JavaBeans..

And as Juozas said, more choice is generally good.
Stephen

> Hi,
> It is also JavaBean-XML mapping framefork :
> http://joda.sourceforge.net/
> And it is no problem if you will decide to implement a new one, if you
think
> it can
> be better or have something unique. Users will decide "bad" or "good".
> >
> > Is there a rundown available on the reasons why Betwix is developing in
> > paralel with JAXB?
> >
> > I've used Castor for quite some time and have been happy with its
> > performance.
> > Apache Axis build their own JavaBean-XML mapping and Betwix is yet
another
> > development in the area.
> >
> > Thanks,
> >
> > Ivelin



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


Re: [Question] Betwix & JAXB

Posted by Juozas Baliuka <ba...@centras.lt>.
Hi,
It is also JavaBean-XML mapping framefork :
http://joda.sourceforge.net/
And it is no problem if you will decide to implement a new one, if you think
it can
be better or have something unique. Users will decide "bad" or "good".
>
> Is there a rundown available on the reasons why Betwix is developing in
> paralel with JAXB?
>
> I've used Castor for quite some time and have been happy with its
> performance.
> Apache Axis build their own JavaBean-XML mapping and Betwix is yet another
> development in the area.
>
> Thanks,
>
> Ivelin
>
>
>
> --
> 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: [Question] Betwix & JAXB

Posted by James Strachan <ja...@yahoo.co.uk>.
----- Original Message -----
From: "Ivelin Ivanov" <iv...@apache.org>
>
> I would love it if the new Betwix marshaling with href and id's generates
an
> XML file,
> which would be equally valid to apply against "/next/next/next/".
> Not quite familiar how XPath would treat XLink refs.

>From a href you can use regular XPath to walk the link for you. XLink is
kinda just XPath with some extension stuff (which in this context isn't
required). You can even traverse links into other XML documents using the
document() XPath function (from XSLT).

James



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


Re: [Question] Betwix & JAXB

Posted by Ivelin Ivanov <iv...@apache.org>.
Thanks for the clarification. So I've mistaken @id for @name.

See below.

----- Original Message -----
From: "Dmitri Plotnikov" <su...@plotnix.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Thursday, April 11, 2002 10:49 PM
Subject: Re: [Question] Betwix & JAXB


> Hi, James, Ivelin,
>
> [...snip...]
>
> > In many cases all these options would be equally good to me.
> > Rarely do I need to customize, although when it's needed it must be
there.
> >
> > >
> > > e.g. for a Map
> > >
> > > Map map = new HashMap();
> > > map.put( "a", "1234" );
> > > map.put( "b", "5678" );
> > >
> > >
> > > how should this look as XML? e.g.
> > >
> > ...
> > > Or
> >
> > Dmitri can probably help here, but I understand that the following form
is
> > becoming popular:
> >
> >
> > Map map = myBean.getItem();
> > map.put( "a", "1234" );
> > map.put( "b", "5678" );
> >
> > <item id="a">1234</item>
> > <item id="b">5678</item>
> >
> > which is consistent with arrays:
> >
> > <item id="1">1234</mapName>
> > <item id="2">5678</mapName >
> >
> >
> > And thus the XPath is natural "/mybean/item[@id='a']"
>
> JXPath takes a dual approach to mapping of maps, or "dynamic property
> objects" as they are called in JXPath.
>
> On the one hand, you can use XPaths like "/map/foo", which are natural
when
> you know that the map is really just a more dynamic sister of a JavaBean,
so
> "foo" is really a property of a logical "bean" called "map".  A good
example
> of such use is a java.util.Properties object.
>
> On the other hand, if your map is used as a generic dictionary and you may
> not even know upfront what keys it will have, the alternative syntax is
more
> preferable:  "/map[@name = 'foo']", or "/map[@name =
> _some_expression_that_computes_the_key_]".  "@name" is an
attribute/keyword
> in JXPath that represents a key or a property name in the case of a
> JavaBean.
>
> Of course, if you ask what this all means in terms of XML, the answer
would
> probably not be satisfactory. The same thing appears more than once in the
> same "document": once as an element and once as an attribute.   However,
> JXPath does not concern itself with these nuances.  Instead of mapping
every
> kind of object model to the XML document model, it directly defines how
> XPaths are interpreted on those models - no XML involved at all.
>
> Here's another example of where this distinction manifests itself.  Let's
> say you have a cyclical graph.  You couldn't map it to XML without
> introducing some notion of references and all the related complexity.
With
> JXPath you don't need to do that, because it does not treat JavaBeans as
XML
> structures.  For example, if we have an object like this:
>
>    class Foo {
>       private Foo next;
>       public Foo getNext(){ return next; }
>       public void setNext(Foo foo) {this.next = next;}
>    }
>
>    Foo foo = new Foo();
>    foo.setNext(foo);
>
> We got ourselves a cyclical graph.
>
> In Java, I could say:  foo.getNext().getNext().getNext() and there would
not
> be anything wrong with it.  Likewise, in JXPath,
>
> context = JXPathContext.newContext(foo);
> Foo bar = (Foo)context.getValue("/next/next/next");
>
> Don't even ask me to what the corresponding XML document would look like.

I would love it if the new Betwix marshaling with href and id's generates an
XML file,
which would be equally valid to apply against "/next/next/next/".
Not quite familiar how XPath would treat XLink refs.

>
> I don't know if this is the "right" approach (the XPath standard, after
all,
> is a child of XML), but it works best for traversing graphs of JavaBeans
and
> does not really hurt the traversal of XML documents.
>
> What do you think?
>
> [...snip...]
>
> >
> > Ivelin
> > >
> > > James
>
> Regards,
>
> - Dmitri
>
>
> --
> 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: [Question] Betwix & JAXB

Posted by James Strachan <ja...@yahoo.co.uk>.
----- Original Message -----
From: "Ivelin Ivanov" <iv...@apache.org>
>
> This encoding looks wise to me too.
> Is this how Axis works?

Well its their default mapping for Hashtable & Maps I think. I think you can
register your own mashallers for stuff too to tweak it.

> James, did you have time to talk to the Axis folks, regarding a possible
> reuse of the bean <-> XML code?

Not yet. Its on my list and I'll get to it eventually. Knee deep in email,
Jaxen & dom4j at the moment...

> BTW, any idea why they named the enclosing tag <hash/> instead of <map/> ?

I think the example in the article was actually a Hashtable. Dunno if the
name is configurable yet.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


Re: [Question] Betwix & JAXB

Posted by Ivelin Ivanov <iv...@apache.org>.
This encoding looks wise to me too.
Is this how Axis works?


James, did you have time to talk to the Axis folks, regarding a possible
reuse of the bean <-> XML code?


BTW, any idea why they named the enclosing tag <hash/> instead of <map/> ?

Thanks,

Ivelin


----- Original Message -----
From: "James Strachan" <ja...@yahoo.co.uk>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Friday, April 19, 2002 8:57 AM
Subject: Re: [Question] Betwix & JAXB


> ----- Original Message -----
> From: "James Strachan" <ja...@yahoo.co.uk>
> > ----- Original Message -----
> > From: "Dmitri Plotnikov" <su...@plotnix.com>
> > > Hi, James, Ivelin,
> > >
> > > [...snip...]
> > >
> > > > In many cases all these options would be equally good to me.
> > > > Rarely do I need to customize, although when it's needed it must be
> > there.
> > > >
> > > > >
> > > > > e.g. for a Map
> > > > >
> > > > > Map map = new HashMap();
> > > > > map.put( "a", "1234" );
> > > > > map.put( "b", "5678" );
> > > > >
> > > > >
> > > > > how should this look as XML? e.g.
> > > > >
> > > > ...
> > > > > Or
> > > >
> > > > Dmitri can probably help here, but I understand that the following
> form
> > is
> > > > becoming popular:
> > > >
> > > >
> > > > Map map = myBean.getItem();
> > > > map.put( "a", "1234" );
> > > > map.put( "b", "5678" );
> > > >
> > > > <item id="a">1234</item>
> > > > <item id="b">5678</item>
> > > >
> > > > which is consistent with arrays:
> > > >
> > > > <item id="1">1234</mapName>
> > > > <item id="2">5678</mapName >
> > > >
> > > >
> > > > And thus the XPath is natural "/mybean/item[@id='a']"
> > >
> > > JXPath takes a dual approach to mapping of maps, or "dynamic property
> > > objects" as they are called in JXPath.
> > >
> > > On the one hand, you can use XPaths like "/map/foo", which are natural
> > when
> > > you know that the map is really just a more dynamic sister of a
> JavaBean,
> > so
> > > "foo" is really a property of a logical "bean" called "map".  A good
> > example
> > > of such use is a java.util.Properties object.
> >
> > Though this approach only works when the keys of the Map are Strings,
the
> > value of which are valid XML names (no colon, > <, quotes, spaces etc).
>
> FWIW I spotted a SOAP encoding of a Map today in this article...
>
> http://www-106.ibm.com/developerworks/library/ws-soapmap1/
>
> which is as follows...
>
>      <hash xmlns:ns2="http://xml.apache.org/xml-soap" xsi:type="ns2:Map">
>      <item>
>       <key xsi:type="xsd:string">2</key>
>       <value xsi:type="xsd:string">two</value>
>      </item>
>      <item>
>       <key xsi:type="xsd:string">1</key>
>       <value xsi:type="xsd:string">one</value>
>      </item>
>      </hash>
>
> So using elements for the key and the value can be quite useful as they
can
> hold type information too. A similar approach is used for Lists too.
>
> James
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> 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: [Question] Betwix & JAXB

Posted by James Strachan <ja...@yahoo.co.uk>.
----- Original Message -----
From: "James Strachan" <ja...@yahoo.co.uk>
> ----- Original Message -----
> From: "Dmitri Plotnikov" <su...@plotnix.com>
> > Hi, James, Ivelin,
> >
> > [...snip...]
> >
> > > In many cases all these options would be equally good to me.
> > > Rarely do I need to customize, although when it's needed it must be
> there.
> > >
> > > >
> > > > e.g. for a Map
> > > >
> > > > Map map = new HashMap();
> > > > map.put( "a", "1234" );
> > > > map.put( "b", "5678" );
> > > >
> > > >
> > > > how should this look as XML? e.g.
> > > >
> > > ...
> > > > Or
> > >
> > > Dmitri can probably help here, but I understand that the following
form
> is
> > > becoming popular:
> > >
> > >
> > > Map map = myBean.getItem();
> > > map.put( "a", "1234" );
> > > map.put( "b", "5678" );
> > >
> > > <item id="a">1234</item>
> > > <item id="b">5678</item>
> > >
> > > which is consistent with arrays:
> > >
> > > <item id="1">1234</mapName>
> > > <item id="2">5678</mapName >
> > >
> > >
> > > And thus the XPath is natural "/mybean/item[@id='a']"
> >
> > JXPath takes a dual approach to mapping of maps, or "dynamic property
> > objects" as they are called in JXPath.
> >
> > On the one hand, you can use XPaths like "/map/foo", which are natural
> when
> > you know that the map is really just a more dynamic sister of a
JavaBean,
> so
> > "foo" is really a property of a logical "bean" called "map".  A good
> example
> > of such use is a java.util.Properties object.
>
> Though this approach only works when the keys of the Map are Strings, the
> value of which are valid XML names (no colon, > <, quotes, spaces etc).

FWIW I spotted a SOAP encoding of a Map today in this article...

http://www-106.ibm.com/developerworks/library/ws-soapmap1/

which is as follows...

     <hash xmlns:ns2="http://xml.apache.org/xml-soap" xsi:type="ns2:Map">
     <item>
      <key xsi:type="xsd:string">2</key>
      <value xsi:type="xsd:string">two</value>
     </item>
     <item>
      <key xsi:type="xsd:string">1</key>
      <value xsi:type="xsd:string">one</value>
     </item>
     </hash>

So using elements for the key and the value can be quite useful as they can
hold type information too. A similar approach is used for Lists too.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


Re: [Question] Betwix & JAXB

Posted by James Strachan <ja...@yahoo.co.uk>.
----- Original Message -----
From: "Dmitri Plotnikov" <su...@plotnix.com>
> Hi, James, Ivelin,
>
> [...snip...]
>
> > In many cases all these options would be equally good to me.
> > Rarely do I need to customize, although when it's needed it must be
there.
> >
> > >
> > > e.g. for a Map
> > >
> > > Map map = new HashMap();
> > > map.put( "a", "1234" );
> > > map.put( "b", "5678" );
> > >
> > >
> > > how should this look as XML? e.g.
> > >
> > ...
> > > Or
> >
> > Dmitri can probably help here, but I understand that the following form
is
> > becoming popular:
> >
> >
> > Map map = myBean.getItem();
> > map.put( "a", "1234" );
> > map.put( "b", "5678" );
> >
> > <item id="a">1234</item>
> > <item id="b">5678</item>
> >
> > which is consistent with arrays:
> >
> > <item id="1">1234</mapName>
> > <item id="2">5678</mapName >
> >
> >
> > And thus the XPath is natural "/mybean/item[@id='a']"
>
> JXPath takes a dual approach to mapping of maps, or "dynamic property
> objects" as they are called in JXPath.
>
> On the one hand, you can use XPaths like "/map/foo", which are natural
when
> you know that the map is really just a more dynamic sister of a JavaBean,
so
> "foo" is really a property of a logical "bean" called "map".  A good
example
> of such use is a java.util.Properties object.

Though this approach only works when the keys of the Map are Strings, the
value of which are valid XML names (no colon, > <, quotes, spaces etc).


> On the other hand, if your map is used as a generic dictionary and you may
> not even know upfront what keys it will have, the alternative syntax is
more
> preferable:  "/map[@name = 'foo']", or "/map[@name =
> _some_expression_that_computes_the_key_]".  "@name" is an
attribute/keyword
> in JXPath that represents a key or a property name in the case of a
> JavaBean.

Agreed. Or if you've wacky kinda types as keys or values then using XML
elements might be preferable, then additional attributes and sub-elements
can be used to describe the object, such as a type attribute.

e.g.

<map>
    <entry>
        <key type="Double">1234.1234</key>
        <value type="Date">12/02/2002</value>
    </entry>
</map>

> Of course, if you ask what this all means in terms of XML, the answer
would
> probably not be satisfactory. The same thing appears more than once in the
> same "document": once as an element and once as an attribute.   However,
> JXPath does not concern itself with these nuances.  Instead of mapping
every
> kind of object model to the XML document model, it directly defines how
> XPaths are interpreted on those models - no XML involved at all.

XML is a text format - it doesn't really have an implicit object model per
se (though I guess you could argue the InfoSet is an attempt to define an
XML object model but lets ignore that for now). This is one of the reasons
XML is so useful but also why its so confusing.

XPath defines an object model based on documents, elements, attributes and
text nodes (processing instructions & comments are in there too). So we've
really just been talking about the XPath object model but using XML text to
describe what that model looks like. Though I take your point that this
mapping doesn't have to be serializable as XML text. Similarly with DOM
trees they could be recursive too though I'm not sure how useful that is.


> Here's another example of where this distinction manifests itself.  Let's
> say you have a cyclical graph.  You couldn't map it to XML without
> introducing some notion of references and all the related complexity.
With
> JXPath you don't need to do that, because it does not treat JavaBeans as
XML
> structures.  For example, if we have an object like this:
>
>    class Foo {
>       private Foo next;
>       public Foo getNext(){ return next; }
>       public void setNext(Foo foo) {this.next = next;}
>    }
>
>    Foo foo = new Foo();
>    foo.setNext(foo);
>
> We got ourselves a cyclical graph.
>
> In Java, I could say:  foo.getNext().getNext().getNext() and there would
not
> be anything wrong with it.  Likewise, in JXPath,
>
> context = JXPathContext.newContext(foo);
> Foo bar = (Foo)context.getValue("/next/next/next");
>
> Don't even ask me to what the corresponding XML document would look like.
>
> I don't know if this is the "right" approach (the XPath standard, after
all,
> is a child of XML), but it works best for traversing graphs of JavaBeans
and
> does not really hurt the traversal of XML documents.
>
> What do you think?

What would //next do? Do you maintain a set of stuff you've visited to avoid
infinite recursion?

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


Re: [Question] Betwix & JAXB

Posted by Dmitri Plotnikov <su...@plotnix.com>.
Hi, James, Ivelin,

[...snip...]

> In many cases all these options would be equally good to me.
> Rarely do I need to customize, although when it's needed it must be there.
>
> >
> > e.g. for a Map
> >
> > Map map = new HashMap();
> > map.put( "a", "1234" );
> > map.put( "b", "5678" );
> >
> >
> > how should this look as XML? e.g.
> >
> ...
> > Or
>
> Dmitri can probably help here, but I understand that the following form is
> becoming popular:
>
>
> Map map = myBean.getItem();
> map.put( "a", "1234" );
> map.put( "b", "5678" );
>
> <item id="a">1234</item>
> <item id="b">5678</item>
>
> which is consistent with arrays:
>
> <item id="1">1234</mapName>
> <item id="2">5678</mapName >
>
>
> And thus the XPath is natural "/mybean/item[@id='a']"

JXPath takes a dual approach to mapping of maps, or "dynamic property
objects" as they are called in JXPath.

On the one hand, you can use XPaths like "/map/foo", which are natural when
you know that the map is really just a more dynamic sister of a JavaBean, so
"foo" is really a property of a logical "bean" called "map".  A good example
of such use is a java.util.Properties object.

On the other hand, if your map is used as a generic dictionary and you may
not even know upfront what keys it will have, the alternative syntax is more
preferable:  "/map[@name = 'foo']", or "/map[@name =
_some_expression_that_computes_the_key_]".  "@name" is an attribute/keyword
in JXPath that represents a key or a property name in the case of a
JavaBean.

Of course, if you ask what this all means in terms of XML, the answer would
probably not be satisfactory. The same thing appears more than once in the
same "document": once as an element and once as an attribute.   However,
JXPath does not concern itself with these nuances.  Instead of mapping every
kind of object model to the XML document model, it directly defines how
XPaths are interpreted on those models - no XML involved at all.

Here's another example of where this distinction manifests itself.  Let's
say you have a cyclical graph.  You couldn't map it to XML without
introducing some notion of references and all the related complexity.  With
JXPath you don't need to do that, because it does not treat JavaBeans as XML
structures.  For example, if we have an object like this:

   class Foo {
      private Foo next;
      public Foo getNext(){ return next; }
      public void setNext(Foo foo) {this.next = next;}
   }

   Foo foo = new Foo();
   foo.setNext(foo);

We got ourselves a cyclical graph.

In Java, I could say:  foo.getNext().getNext().getNext() and there would not
be anything wrong with it.  Likewise, in JXPath,

context = JXPathContext.newContext(foo);
Foo bar = (Foo)context.getValue("/next/next/next");

Don't even ask me to what the corresponding XML document would look like.

I don't know if this is the "right" approach (the XPath standard, after all,
is a child of XML), but it works best for traversing graphs of JavaBeans and
does not really hurt the traversal of XML documents.

What do you think?

[...snip...]

>
> Ivelin
> >
> > James

Regards,

- Dmitri


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


Re: [Question] Betwix & JAXB

Posted by Ivelin Ivanov <iv...@apache.org>.
----- Original Message -----
From: "James Strachan" <ja...@yahoo.co.uk>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Thursday, April 11, 2002 9:53 PM
Subject: Re: [Question] Betwix & JAXB


> From: "Ivelin Ivanov" <iv...@apache.org>
> >
> > Hi James,
> >
> > Thanks for the detailed response.
> >
> > Yes, choice is healthy.
> >
> > I will hope however that the coices stay limited to 1 or 2 alternatives.
> > More than that, it will almost sound like waste of brain.
> >
> > I am very happy with JXPath and therefore I would think that Betwix is
the
> > tool I'd use for marshaling in future.
>
> FWIW I have nothing to do with JXPath at all - thats Dmitri's baby. I work
> on Jaxen instead (I did try bring Dmitri to the Jaxen-party but he
preferred
> to go his own way).
>
> http://jaxen.org

I've looked at Jaxen first but couldn't find built-in JavaBean support,
which is what I need most of the time.
Java is still my primary language and XML interfaces to the world are being
adopted quickly.
Tools like JXPath and Castor( maybe Betwix now ) are making my life much
easier.

> > What I really appreciate about JXPath is that it is quite smart about
auto
> > handling mapping for various types.
>
> Though picking a good default mapping is one thing; however there are
> various ways to do it and sometimes developers want to specify this
> explicitly - thats where betwixt comes in.

In many cases all these options would be equally good to me.
Rarely do I need to customize, although when it's needed it must be there.

>
> e.g. for a Map
>
> Map map = new HashMap();
> map.put( "a", "1234" );
> map.put( "b", "5678" );
>
>
> how should this look as XML? e.g.
>
...
> Or

Dmitri can probably help here, but I understand that the following form is
becoming popular:


Map map = myBean.getItem();
map.put( "a", "1234" );
map.put( "b", "5678" );

<item id="a">1234</item>
<item id="b">5678</item>

which is consistent with arrays:

<item id="1">1234</mapName>
<item id="2">5678</mapName >


And thus the XPath is natural "/mybean/item[@id='a']"

> Robert added support for handling of circular references. Right now it
> outputs unique IDs and uses HREF attributes to refer to previously
> serialized objects.

Excelent. I'll try that.
I suppose it will unmarshall correctly this markup too?


Keep up the good code coming.

Ivelin



>
> James
>
>
> --
> 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: [Question] Betwix & JAXB

Posted by James Strachan <ja...@yahoo.co.uk>.
From: "Ivelin Ivanov" <iv...@apache.org>
>
> Hi James,
>
> Thanks for the detailed response.
>
> Yes, choice is healthy.
>
> I will hope however that the coices stay limited to 1 or 2 alternatives.
> More than that, it will almost sound like waste of brain.
>
> I am very happy with JXPath and therefore I would think that Betwix is the
> tool I'd use for marshaling in future.

FWIW I have nothing to do with JXPath at all - thats Dmitri's baby. I work
on Jaxen instead (I did try bring Dmitri to the Jaxen-party but he preferred
to go his own way).

http://jaxen.org

Jaxen is an XPath 1.0 conformant XPath engine which works on all popular XML
models. Its the primary XPath engine used by the dom4j, EXML and JDOM
communities. Also DOM users use it, for example David Megginson included
Jaxen for DOM XPath support in the Reuters NewsML toolkit.


> What I really appreciate about JXPath is that it is quite smart about auto
> handling mapping for various types.

Though picking a good default mapping is one thing; however there are
various ways to do it and sometimes developers want to specify this
explicitly - thats where betwixt comes in.

e.g. for a Map

Map map = new HashMap();
map.put( "a", "1234" );
map.put( "b", "5678" );


how should this look as XML? e.g.

<map>
    <entry key="a">1234</entry>
    <entry key="b">5678</entry>
</map>

Or

<map>
    <a>1234</a>
    <b>5678></b>
</map>

Or even

<map>
    <entry>
        <key>a</key>
        <value>1234</value>
    </entry>
    <entry>
        <key>b</key>
        <value>5678</value>
    </entry>
</map>



> An inconvenience of Castor is that it's virtually useless without explicit
> mapping.
> If Betwix is going to be a lot more transparent and not require mapping
for
> most cases, I'd certainly enjoy it.


Cool

> BTW, when mapping is not provided, how does betwix handle circular
> references during marshaling? Xlink?

Robert added support for handling of circular references. Right now it
outputs unique IDs and uses HREF attributes to refer to previously
serialized objects.

James


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


Re: [Question] Betwix & JAXB

Posted by Ivelin Ivanov <iv...@apache.org>.
Hi James,

Thanks for the detailed response.

Yes, choice is healthy.

I will hope however that the coices stay limited to 1 or 2 alternatives.
More than that, it will almost sound like waste of brain.

I am very happy with JXPath and therefore I would think that Betwix is the
tool I'd use for marshaling in future.
What I really appreciate about JXPath is that it is quite smart about auto
handling mapping for various types.
An inconvenience of Castor is that it's virtually useless without explicit
mapping.
If Betwix is going to be a lot more transparent and not require mapping for
most cases, I'd certainly enjoy it.

BTW, when mapping is not provided, how does betwix handle circular
references during marshaling? Xlink?

Cheers,

Ivelin





----- Original Message -----
From: "James Strachan" <ja...@yahoo.co.uk>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Monday, April 08, 2002 10:32 PM
Subject: Re: [Question] Betwix & JAXB


> Hi Ivelin
>
> From: "Ivelin Ivanov" <iv...@apache.org>
> > Is there a rundown available on the reasons why Betwix is developing in
> > paralel with JAXB?
>
> Good question :-)
>
>
> > I've used Castor for quite some time and have been happy with its
> > performance.
>
> JAXB takes the approach that a DTD (and one day an XML schema) is used to
> generate beans that can parse/output the XML, then you can derive from
them
> to add behaviour.
>
> Betwixt takes a different approach, that starting with any bean, it
already
> has a default XML representation; then betwixt can be customized with just
> the differences you want (moving elements around, adding arbitrary extra
XML
> nestings, renaming elements/attributes etc). Then betwixt can parse XML
> (using Digester, it essentially defaults digester rules) or output XML
> straight away, then customize to make it esthetically nicer XML later.
>
> On the list of things planned are SAX reader/writers and a DOM
> implementation using betwixt's mappings, then XSLT can be used on beans
> (like the Maven project does). Also I should finally get around to using
> Betwixt to add a bean Navigator to the Jaxen XPath engine. Betwixt
> essentially mirrors the Introspector / BeanInfo classes from java.beans
but
> for mapping information of beans to XML, so there's an XMLIntrospector and
> XMLBeanInfo etc.
>
>
> Both the JAXB & betwixt approaches are equally valid; JAXB is useful if
you
> want some beans generated from some kind of XML 'schema', betwixt is
better
> if you already have the beans and want to customize what the XML looks
like,
> or to automatically default digester rules for you, then maybe customize
> things later.
>
> So if you're starting from beans and want nice XML then betwixt is a good
> tool for the job; if you're starting with a DTD and want to write some
> beans, then look at JAXB.
>
> Castor is kinda in the middle between them with a bit more complexity
thrown
> in for good measure but its got some good stuff in there. Though I always
> get the impression Castor is trying to do too much together at the same
time
> rather than just doing one thing well, but maybe thats just me. I can't
help
> think of the phrase 'jack of all trades and master of none'. e.g. Castor
is
> JDO-like without being compliant, its kind of an O/R mapping tool, its a
> reasonable O/XML mapping tool and a kinda OQL engine all thrown in
together.
> An impressive body of work though.
>
> As an aside, betwixt focusses on the mapping metadata of how beans should
> map to XML, so betwixt could maybe be used to generate Castor java <-> XML
> bindings - though I'm not sure why you'd want to do that ;-)
>
>
> > Apache Axis build their own JavaBean-XML mapping and Betwix is yet
another
> > development in the area.
>
> Its on my list to investigate using Betwixt in Axis. SOAP supports various
> different encodings, 1 of which (usually called the 'soap encoding') is a
> well defined mapping of SOAP to java objects, so Axis probably implements
> that spec.
>
> However for some of the other encodings (such as none where you just get
> XML), then maybe betwixt could be used to map a SOAP schema to some
> implementation beans. i.e. to have a flexible, customizable mapping.
>
> I'd certainly like try out a Betwixt based serializer/deserializer for
Axis
> and see if it works neatly.
>
> James
>
>
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
>
> --
> 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: [Question] Betwix & JAXB

Posted by James Strachan <ja...@yahoo.co.uk>.
Hi Ivelin

From: "Ivelin Ivanov" <iv...@apache.org>
> Is there a rundown available on the reasons why Betwix is developing in
> paralel with JAXB?

Good question :-)


> I've used Castor for quite some time and have been happy with its
> performance.

JAXB takes the approach that a DTD (and one day an XML schema) is used to
generate beans that can parse/output the XML, then you can derive from them
to add behaviour.

Betwixt takes a different approach, that starting with any bean, it already
has a default XML representation; then betwixt can be customized with just
the differences you want (moving elements around, adding arbitrary extra XML
nestings, renaming elements/attributes etc). Then betwixt can parse XML
(using Digester, it essentially defaults digester rules) or output XML
straight away, then customize to make it esthetically nicer XML later.

On the list of things planned are SAX reader/writers and a DOM
implementation using betwixt's mappings, then XSLT can be used on beans
(like the Maven project does). Also I should finally get around to using
Betwixt to add a bean Navigator to the Jaxen XPath engine. Betwixt
essentially mirrors the Introspector / BeanInfo classes from java.beans but
for mapping information of beans to XML, so there's an XMLIntrospector and
XMLBeanInfo etc.


Both the JAXB & betwixt approaches are equally valid; JAXB is useful if you
want some beans generated from some kind of XML 'schema', betwixt is better
if you already have the beans and want to customize what the XML looks like,
or to automatically default digester rules for you, then maybe customize
things later.

So if you're starting from beans and want nice XML then betwixt is a good
tool for the job; if you're starting with a DTD and want to write some
beans, then look at JAXB.

Castor is kinda in the middle between them with a bit more complexity thrown
in for good measure but its got some good stuff in there. Though I always
get the impression Castor is trying to do too much together at the same time
rather than just doing one thing well, but maybe thats just me. I can't help
think of the phrase 'jack of all trades and master of none'. e.g. Castor is
JDO-like without being compliant, its kind of an O/R mapping tool, its a
reasonable O/XML mapping tool and a kinda OQL engine all thrown in together.
An impressive body of work though.

As an aside, betwixt focusses on the mapping metadata of how beans should
map to XML, so betwixt could maybe be used to generate Castor java <-> XML
bindings - though I'm not sure why you'd want to do that ;-)


> Apache Axis build their own JavaBean-XML mapping and Betwix is yet another
> development in the area.

Its on my list to investigate using Betwixt in Axis. SOAP supports various
different encodings, 1 of which (usually called the 'soap encoding') is a
well defined mapping of SOAP to java objects, so Axis probably implements
that spec.

However for some of the other encodings (such as none where you just get
XML), then maybe betwixt could be used to map a SOAP schema to some
implementation beans. i.e. to have a flexible, customizable mapping.

I'd certainly like try out a Betwixt based serializer/deserializer for Axis
and see if it works neatly.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


[Question] Betwix & JAXB

Posted by Ivelin Ivanov <iv...@apache.org>.
Is there a rundown available on the reasons why Betwix is developing in
paralel with JAXB?

I've used Castor for quite some time and have been happy with its
performance.
Apache Axis build their own JavaBean-XML mapping and Betwix is yet another
development in the area.

Thanks,

Ivelin



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


Re: BeanUtils and Digester Release?

Posted by Klaasjan Brand <br...@topicus.nl>.
Scott Sanders wrote:
> Anyone hae any blockers that would stop the release of BeanUtils 1.3 or
> Digester 1.2?
> 
> Digester has the XML rules stuff that I would like to get released, and
> both have had some good bugfixes.
> 
> Opiniions, suggestions?
> 
> Scott Sanders
> 

I mentioned a bug in MethodUtils a few days back:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7740

I've provided a patch, but it's not yet committed.
It would be nice if the fix would be included...

greets,
Klaasjan Brand



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


Re: BeanUtils and Digester Release?

Posted by "Craig R. McClanahan" <cr...@apache.org>.
In principle, I'm fine with releasing these (and pool/dbcp as well as soon
as they are ready).  I'd like to take a pass through the bug reports and
email archives first, though, to see if there's anything important we
should address beforehand.

Craig


On Fri, 5 Apr 2002, Scott Sanders wrote:

> Date: Fri, 5 Apr 2002 09:47:26 -0800
> From: Scott Sanders <ss...@nextance.com>
> Reply-To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> To: Jakarta Commons Developers List <co...@jakarta.apache.org>
> Subject: BeanUtils and Digester Release?
>
> Anyone hae any blockers that would stop the release of BeanUtils 1.3 or
> Digester 1.2?
>
> Digester has the XML rules stuff that I would like to get released, and
> both have had some good bugfixes.
>
> Opiniions, suggestions?
>
> Scott Sanders
>


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