You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by di...@multitask.com.au on 2002/10/31 22:18:15 UTC
Re: Using XML to create Java objects
How does this compare to Jelly:
http://jakarta.apache.org/commons/sandbox/jelly/ ?
There seems to be a lot of overlap there....
--
dIon Gillard, Multitask Consulting
Work: http://www.multitask.com.au
Developers: http://adslgateway.multitask.com.au/developers
Russell White <ru...@yahoo.com> wrote on 31/10/2002 11:47:56 PM:
> All of you intersted in using XML object mapping as well UI building
with XML
> may be interested in the Swang project.
>
> http://swang.sourceforge.net
> or
> http://sourceforge.net/projects/swang
>
> Swang is reflective, and very powerful. It provides a plugguble modular
> TagHandler mechanism, and a very flexible schema. One example of
themodularity
> of Swang is that the popular BeanShell scripting language is included as
a
> TagHandler in the distribution. The beans shell script has access to the
> objects created with Swang, and vice versa. The means that you can use
natural
> Java notation, and complex expressions.
>
> My comany uses Swang to provided rich UIs to applications that used to
be just
> HTML. Now thanks to JSP and XSL, we can provide any Java based UI along
with
> the HTML version.
>
> Swang also takes some of the worry out of handling things like threads,
and
> thread safe changing of object properties by allowing you to mark
> methods to be
> invoked using SwingUitilities.invokeLater() just by setting the
attribute
> 'later' to true.
>
> Check it out. I am really looking for advice on future versions, andam
looking
> to other projects for synergy and community effort.
>
>
> Forgive me that the example is not very full of features, but it does
give a
> good idea of the power. Also there is some documentation, certainly
enough to
> get started, but I am working on making it much better. The source code
is not
> large, and pretty simple to follow.
>
> WR
>
> Russ White
> --- Qwerty Poiu <qw...@hotmail.com> wrote:
>
> <HR>
> <html><div style='background-color:'><DIV>
> <P>Hey Matt and all,</P>
> <P>I think a xml to object mapper that doesn't need any config filoes
like
> Digester is worthwile, and I would love to try it out. I like
Digester
> and JAXB, JAXme, etc, but I still think these are not the end of the
> story.<BR>I want to use such an engine in conjuction with a few Schema
and
> transformation languages to create forms in java and HTML, but what I
> really am interested in is the Design Patterns behind all this, and
> considering as many points of view as possible is really boradening my
> horizons.<BR></P>
> <P>Tim C.</P></DIV>
> <DIV></DIV>
> <DIV></DIV>>From: Matt Pickering <MP...@YAHOO.COM>
> <DIV></DIV>>Reply-To: general@xml.apache.org
> <DIV></DIV>>To: general@xml.apache.org
> <DIV></DIV>>Subject: Using XML to create Java objects
> <DIV></DIV>>Date: Tue, 29 Oct 2002 21:37:19 -0800 (PST)
> <DIV></DIV>>
> <DIV></DIV>>Hello all,
> <DIV></DIV>>
> <DIV></DIV>>I use XML on a daily basis in my day job and recently
> <DIV></DIV>>I've started work on some gaming projects that use XML
> <DIV></DIV>>to store configuration and game data. One of the most
> <DIV></DIV>>tedious tasks I've had to deal with in both realms is
> <DIV></DIV>>the parsing of XML in order to create Java objects,
> <DIV></DIV>>both simple and complex.
> <DIV></DIV>>
> <DIV></DIV>>I know libraries and tools exist to do this, but they
> <DIV></DIV>>all have one major drawback: they require me to write
> <DIV></DIV>>code to describe the objects I want to create and map
> <DIV></DIV>>the XML to them.
> <DIV></DIV>>
> <DIV></DIV>>I've written an engine that allows me to express
> <DIV></DIV>>simple and composite Java objects as XML and have Java
> <DIV></DIV>>objects come out without any work on my part other
> <DIV></DIV>>than providing a listener to capture the objects as
> <DIV></DIV>>they are created.
> <DIV></DIV>>
> <DIV></DIV>>The engine uses Java Reflection to construct objects
> <DIV></DIV>>and call methods. Methods can accept simple
> <DIV></DIV>>parameters or other objects, which can also be
> <DIV></DIV>>expressed as nested XML.
> <DIV></DIV>>
> <DIV></DIV>>The XML markup has to follow a few simple rules and a
> <DIV></DIV>>mechanism is provided to allow the user to define
> <DIV></DIV>>constants that can substitute one value for another as
> <DIV></DIV>>well as define the tags that map to various objects.
> <DIV></DIV>>
> <DIV></DIV>>Here is a simple example of some XML markup that
> <DIV></DIV>>creates a Java Properties object:
> <DIV></DIV>>
> <DIV></DIV>><PROPERTIES>
> <DIV></DIV>> <?xml:namespace prefix = twgp /><twgp:alchemy DIV
> <>>xmlns:twgp="http://www.wargameproject.org/transmuteml">
> <DIV></DIV>> <twgp:mapping DIV < tag="myprops"
> parentTag="*">>class="java.util.Properties"/>
> <DIV></DIV>> </twgp:alchemy>
> <DIV></DIV>> <MYPROPS>
> <DIV></DIV>> <property value="value1" key="prop1"></property>
> <DIV></DIV>> <property value="value2" key="prop2"></property>
> <DIV></DIV>> <!-- Since Properties is a subclass of
> </DIV>>Hashtable, the following shows
</DIV>> we can also
> call put() instead of
</DIV>>setProperty(). -->
> <DIV></DIV>> <put value="value3" key="prop3"></put>
> <DIV></DIV>> </MYPROPS>
> <DIV></DIV>></PROPERTIES>
> <DIV></DIV>>
> <DIV></DIV>>I've been using this engine to built game
> <DIV></DIV>>configuration files as well as to build config files
> <DIV></DIV>>for some rules-based code I use in my day job.
> <DIV></DIV>>
> <DIV></DIV>>My question to the list is this: Would there be any
> <DIV></DIV>>interest to the community at large in such an engine?
> <DIV></DIV>>
> <DIV></DIV>>I was planning to release the engine along with the
> <DIV></DIV>>gaming code, but it is being maintained as a separate
> <DIV></DIV>>codebase. I am willing to break the engine out and
> <DIV></DIV>>maintain it as a separate project if there is
> <DIV></DIV>>sufficient interest.
> <DIV></DIV>>
> <DIV></DIV>>The engine is general purpose but is scoped for
> <DIV></DIV>>applications that use XML as configuration data but
> <DIV></DIV>>don't want the hassle of having to parse the XML to
> <DIV></DIV>>suit differing requirements. It is not a
> <DIV></DIV>>serialization mechanism (although I plan to add a
> <DIV></DIV>>converter to take instantiated objects and dump out
> <DIV></DIV>>compatible XML markup). It certainly isn't a "be-all,
> <DIV></DIV>>end-all" solution to the problem of XML-Java
> <DIV></DIV>>conversion, but can address a decent amount of the
> <DIV></DIV>>problems that an average developer may face in using
> <DIV></DIV>>XML and Java.
> <DIV></DIV>>
> <DIV></DIV>>If anyone would like to know more, please reply to the
> <DIV></DIV>>list or me directly. If this ins't the appropriate
> <DIV></DIV>>forum for this, I do apologize and I will repost this
> <DIV></DIV>>to the Jakarta list and take my chances there.
> <DIV></DIV>>
> <DIV></DIV>>Matt Pickering
> <DIV></DIV>>
> <DIV></DIV>>
> <DIV></DIV>>
> <DIV></DIV>>
> <DIV></DIV>>__________________________________________________
> <DIV></DIV>>Do you Yahoo!?
> <DIV></DIV>>HotJobs - Search new jobs daily now
> <DIV></DIV>>http://hotjobs.yahoo.com/
> <DIV></DIV>>
> <DIV></DIV>>
> ---------------------------------------------------------------------
>
> <DIV></DIV>>In case of troubles, e-mail: webmaster@xml.apache.org
> <DIV></DIV>>To unsubscribe, e-mail:
general-unsubscribe@xml.apache.org
> <DIV></DIV>>For additional commands, e-mail:
general-help@xml.apache.org
> <DIV></DIV></twgp:mapping></div><br clear=all><hr>Unlimited
Internetaccess for
> only $21.95/month. Try MSN! <a
href="http://g.msn.com/8HMREN/2019">Click
> Here</a> </html>
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail: webmaster@xml.apache.org
> To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>
>
>
> __________________________________________________
> Do you Yahoo!?
> HotJobs - Search new jobs daily now
> http://hotjobs.yahoo.com/
>
> ---------------------------------------------------------------------
> In case of troubles, e-mail: webmaster@xml.apache.org
> To unsubscribe, e-mail: general-unsubscribe@xml.apache.org
> For additional commands, e-mail: general-help@xml.apache.org
>
> ForwardSourceID:NT000891E2
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>