[Yanel-dev] Handling of XML Serialization

Balz Schreier balz.schreier at gmail.com
Thu Jan 6 19:55:14 CET 2011


Dear all, dear Simon,

this topic is still around in my thoughts and I could not believe that there
are so many options for this XML serialization.
now I think I discovered an even better approach, probably the best :-) ,
because this approach is purely based on the Java SE standards.

the magic word is JAXB, Java API for XML Binding.

Look at this URL:
http://download.oracle.com/javase/6/docs/api/index.html?javax/xml/bind/anno=
tation/XmlRootElement.html

as of Java SE 6, you can simply annotate a bean class and with a one-liner
it gets serialized.
do you also think that this is even better than including yet another
opensource-framework in the already large library park of Yanel?

Sorry for leading the way to SimpleXML, but sometimes we need to discover it
like this :)
I will try this JAXB based approach next week and give some facts about my
initial touch points.

@ALL: Did anyone work already with these new annotations?

The official URL of the reference implementation is here:
http://jaxb.java.net/

Cheers
Balz



On Wed, Jan 5, 2011 at 6:36 PM, Balz Schreier <balz.schreier at gmail.com>wrot=
e:

> That's good news!
> I can imagine that SimpleXML is also very useful if you have a data model
> with some inheritance from abstract or concrete classes.
> in that case, SimpleXML also inherits the configurations from the parent
> classes and persists the XMLs correctly.
>
> I hope I do find time soon to implement this in my own project too...
>
> Cheers
> Balz
>
>
> On Wed, Jan 5, 2011 at 6:00 PM, simon <simon at 333.ch> wrote:
>
>> Am 22.10.2010 15:19, schrieb basZero:
>>
>>  Dear all,
>>>
>>> having worked with Yanel for some weeks now, I noticed that very often
>>> people still deal with Document objects, append children, deal with
>>> namespaces and have to care about inheritance by themselves.
>>>
>>> In some cases it might be much more convenient to use something like th=
is
>>> framework:
>>>
>>> http://simple.sourceforge.net/download/stream/doc/tutorial/tutorial.php=
#start
>>>
>>> Instead of dealing with actual XML nodes you deal with your data objects
>>> only.
>>>
>>> Write: With the current version of Yanel, one could use this already wh=
en
>>> persisting XML (you only tell Yarep to add a new node and then you
>>> directly
>>> write into that outputstream, this write procedure can be taken over fr=
om
>>> the framework above (factory: store object).
>>>
>>> Read: Yarep returns nodes. So the framework's factory can be used to
>>> create
>>> your data objects by simply passing the inputstream of the node and you
>>> are
>>> done.
>>>
>>> This is just an idea how to get rid of dealing with XML as such and wou=
ld
>>> eliminate a lot of boilerplate code in your projects. Maybe the Yanel
>>> staff
>>> can take a look at this and think about possible usage of this.
>>>
>>> Cheers
>>>
>>>  hello balz, hello all
>>
>> thanks for sharing this. i just tried the simple-xml lib and i had a very
>> pleasant expirience. i had worked with several techniques to
>> read/modify/write xml with java. e.g. jdom, dom4j, avalon configure. but
>> simple-xml was way the closest to get the java feeling.
>> you don't have to read the xml and going from tag to tag and add the
>> values to your objects. with simple-xml you read the xml and get the
>> objects.
>>
>> i hope to find soon time to solve a yanel task with the help of
>> simple-xml. maybe reading/modifying/writing the sitetree would be nice.
>>
>> thanks
>> simon
>>
>>
>> --
>> Yanel-development mailing list Yanel-development at wyona.com
>> http://lists.wyona.org/cgi-bin/mailman/listinfo/yanel-development
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wyona.org/pipermail/yanel-development/attachments/2011010=
6/8cb3ab90/attachment.htm


More information about the Yanel-development mailing list