tag:blogger.com,1999:blog-8852543472291091913.post8201149339176755488..comments2023-06-09T01:54:26.505-06:00Comments on Software Everything: The Easiest Java XML BindingAnonymoushttp://www.blogger.com/profile/15025531615679576013noreply@blogger.comBlogger19125tag:blogger.com,1999:blog-8852543472291091913.post-82606152378724846282011-07-06T08:04:52.910-06:002011-07-06T08:04:52.910-06:00A big thanks to all for pointing to XStream. This ...A big thanks to all for pointing to XStream. This is just, what I have been looking for.ygorhttps://www.blogger.com/profile/01816114989378602758noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-87588731468794510502009-08-04T09:26:29.277-06:002009-08-04T09:26:29.277-06:00I have used castor before
its awesome
I even use ...I have used castor before<br />its awesome<br /><br />I even use their marshal api to debug my java object values<br /><br />:DKalpesh Sonihttps://www.blogger.com/profile/16188622811832015268noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-51460576049167984712008-07-23T06:59:00.000-06:002008-07-23T06:59:00.000-06:00Your library is the best thing since sliced bread....Your library is the best thing since sliced bread. Awesome! Thank you!Felipe Couryhttps://www.blogger.com/profile/17312733589972777822noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-76281128859859762712008-07-08T08:34:00.000-06:002008-07-08T08:34:00.000-06:00Good article.Along the same lines, I found SimpleX...Good article.<BR/><BR/>Along the same lines, I found SimpleXML excellent.<BR/><BR/>http://simple.sourceforge.net/home.phpDavie Langhttps://www.blogger.com/profile/03333952327363911729noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-69521837249919575542008-07-05T16:20:00.000-06:002008-07-05T16:20:00.000-06:00Let me be the fourth person to say XStream. Why r...Let me be the fourth person to say <B>XStream</B>. Why reinvent the wheel, unless you are just doing it for kicks.Unknownhttps://www.blogger.com/profile/12612078156390293320noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-22797356938387112012008-07-04T12:25:00.000-06:002008-07-04T12:25:00.000-06:00I used XStream recently and if you write a little ...I used XStream recently and if you write a little wrapper class, it's really a one liner to go from objects to xml and back. The great thing is that you don't even need to touch your classes.Sébastienhttps://www.blogger.com/profile/17499111232100036733noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-84547249406719563042008-07-02T19:12:00.000-06:002008-07-02T19:12:00.000-06:00This works with namespaces as well. For example yo...This works with namespaces as well. For example you could use an annotation to map dc:author to a class field called dcAuthor.<BR/><BR/>Yes, I am looking to fix an XML format to a POJO for my particular use. This may not always be the case though as you have pointed out, where a ResultSet may be what you need instead.Anonymoushttps://www.blogger.com/profile/15025531615679576013noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-40921316425328901952008-07-02T18:13:00.000-06:002008-07-02T18:13:00.000-06:00I think xml actually works better if you model it ...I think xml actually works better if you model it as a ResultSet and then iterate over nodes selected via Xpath and then use those to map.<BR/><BR/>The thing about placing Annotations on field names is that it fixes one type of xml format to your pojo. What about namespaces? Other twists on simple xml formats like atom?<BR/><BR/>Instead consider the following pseuedocode...<BR/><BR/><BR/>XmlDataSource xds = new XmlDataSource();<BR/>xds.namespace('custom', CUSTOM_URI);<BR/><BR/>XmlResultSet xrs = XmlClass.xpath('/rss/model/item, /rss/channel/custom:item');<BR/>List< Item > items = new ArrayList< Item >();<BR/>while (xrs.next()) {<BR/> Item item = new Item();<BR/> item.setTitle(xrs.getString('title');<BR/> item.setDescription(xrs.getString('description');<BR/> items.add(item);<BR/>}<BR/><BR/>// do something with the items...<BR/><BR/>With a little auto-naming magic present in many of todays frameworks, the actual loop could be done for you,<BR/>and you get an easy to understand, non-invasive way to get data out of xml.<BR/><BR/>Either way, great article. There are def a lot of people out there who find current mapping methods unacceptable.Ivanhttps://www.blogger.com/profile/00530381404081691368noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-24224248195204554482008-07-02T13:18:00.000-06:002008-07-02T13:18:00.000-06:00You can try to use rhino script in java 6 that imp...You can try to use rhino script in java 6 that implements E4X like Flex.ilyashttps://www.blogger.com/profile/10311255402173838225noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-70219003866649060522008-07-02T08:53:00.000-06:002008-07-02T08:53:00.000-06:00I hope you blog more frequently that you have been...I hope you blog more frequently that you have been doing on average since 2005 =) Ill be checking this blog for more new betterer stuffMikhail Koryakhttps://www.blogger.com/profile/16832802200666472859noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-20328206198475449912008-07-02T07:28:00.000-06:002008-07-02T07:28:00.000-06:00"Have you tried out Castor? http://www.castor.org/..."Have you tried out Castor? http://www.castor.org/xml-mapping.html It's been around forever, is stable, and is rather easy to use."<BR/>- zse<BR/><BR/>I haven't looked at it before, but it looks like a good XML-POJO binding. I don't want to have to use external binding definitions though like with JiBX.Anonymoushttps://www.blogger.com/profile/15025531615679576013noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-68684417134689653372008-07-02T07:20:00.000-06:002008-07-02T07:20:00.000-06:00Have you tried out Castor?http://www.castor.org/xm...Have you tried out Castor?<BR/><BR/>http://www.castor.org/xml-mapping.html<BR/><BR/>It's been around forever, is stable, and is rather easy to use.Unknownhttps://www.blogger.com/profile/05392540931187067567noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-81096641313430034032008-07-02T06:48:00.000-06:002008-07-02T06:48:00.000-06:00Since there seems to be some interest I have start...Since there seems to be some interest I have started a sourceforge.net project called "Really Easy Java XML Binding" or "RE:JAXB" since this is sort of a reply to JAXB. Here is the <A HREF="http://sourceforge.net/projects/rejaxb/" REL="nofollow">link</A><BR/><BR/>I have included POJOs for RSS 1.0 and RSS 2.0 along with unit tests to verify that the mappings from XML and to XML are working correctly. What I am looking for are ways to improve the efficiency of the to and from binding code, as well as POJOs for other common XML formats.Anonymoushttps://www.blogger.com/profile/15025531615679576013noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-60313905840693614872008-07-02T06:26:00.000-06:002008-07-02T06:26:00.000-06:00"The only main difference is that I'm starting out..."The only main difference is that I'm starting out with Java Objects and want to have good XML out of them, not the other way around. You can have a look at the project (Xerialize) page on Google Code."<BR/>-ayman<BR/><BR/>The XMLBinderFactory class that I wrote can do this as well. Your project looks similar to what I did. I knew that this had to have been done before, I just couldn't find anything.<BR/><BR/>"Nice article. But the question remains unanswered, which XML Binder library have you used?"<BR/>-fargo<BR/><BR/>I made my own; the XMLBinderFactory class. I plan on turning it into a sourceforge project soon, at least to be able to more easily distribute the source code.<BR/><BR/>"It looks a lot like Xstream. You should have a look. Anyway, it's a good article, thanks for sharing your experience"<BR/>- laurent<BR/><BR/>This is very similar to what I have done except my method requires less lines of code, but Xstream probably can do a bit more. This is exactly what I was looking for in the beginning; I will check it out some more.<BR/><BR/>"i think you might like to have a look at: http://xfire.codehaus.org/Aegis+Binding"<BR/>- wayne<BR/>This is another XML-POJO binding, but it looks like XSD's are involved, which I don't want to have to use.Anonymoushttps://www.blogger.com/profile/15025531615679576013noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-82170992717753306602008-07-02T06:10:00.000-06:002008-07-02T06:10:00.000-06:00Hi,i think you might like to have a look at: http...Hi,<BR/><BR/>i think you might like to have a look at: http://xfire.codehaus.org/Aegis+Binding<BR/><BR/>regards<BR/>WayneWaynehttps://www.blogger.com/profile/14806302700950096306noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-79009782524735757512008-07-02T05:06:00.000-06:002008-07-02T05:06:00.000-06:00It looks a lot like Xstream. You should have a loo...It looks a lot like <A HREF="http://xstream.codehaus.org/" REL="nofollow">Xstream</A>. You should have a look. Anyway, it's a good article, thanks for sharing your experienceUnknownhttps://www.blogger.com/profile/17734821283515584449noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-66178934084203052002008-07-02T03:52:00.000-06:002008-07-02T03:52:00.000-06:00Nice article. But the question remains unanswered,...Nice article. But the question remains unanswered, which XML Binder library have you used?Unknownhttps://www.blogger.com/profile/14877570266659478589noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-76473464416283184072008-07-02T02:32:00.000-06:002008-07-02T02:32:00.000-06:00That's nice. I started with a similar project but...That's nice. I started with a similar project but did not have time to complete it. The basics do work, and as you have done, I use reflection and annotation to map Java Objects to XML nodes. <BR/>The only main difference is that I'm starting out with Java Objects and want to have good XML out of them, not the other way around. You can have a look at the project (<A HREF="http://code.google.com/p/xerialize/" REL="nofollow">Xerialize</A>) page on Google Code.Aymanhttps://www.blogger.com/profile/08469152582879981718noreply@blogger.comtag:blogger.com,1999:blog-8852543472291091913.post-75640543582395872722008-07-01T08:01:00.000-06:002008-07-01T08:01:00.000-06:00That's a really good article. I'd like to repost t...That's a really good article. I'd like to repost this on JavaLobby with your permission. If you are interested, contact me - james at dzone dot com - and we can organise it. <BR/><BR/>Thanks <BR/>JamesJameshttps://www.blogger.com/profile/08468972062514207894noreply@blogger.com