You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "vs.souza" <vs...@gmail.com> on 2012/04/05 20:36:05 UTC
Parsing XML and binding to Java Object
Hello friends,
I am using restlet to consume a restful service and I receive the following
response from server:
<?xml version="1.0" encoding="UTF-8"?>
<vulnerability>
<complete type="integer">5</complete>
<created-on type="datetime">2003-02-21T02:10:00-05:00</created-on>
<cve-description></cve-description>
<description></description>
<disclosure-date
type="datetime">2000-02-27T00:00:00-05:00</disclosure-date>
<disclosure-source-id type="integer"></disclosure-source-id>
<discovery-date type="datetime">1970-01-01T00:00:00-05:00</discovery-date>
<exploit-publish-date
type="datetime">1970-01-01T00:00:00-05:00</exploit-publish-date>
<keywords></keywords>
<manual-notes></manual-notes>
<osvdb-id type="integer">1234</osvdb-id>
<promoted-on type="datetime"></promoted-on>
<short-description></short-description>
<solution></solution>
<solution-date type="datetime">1970-01-01T00:00:00-05:00</solution-date>
<t-description></t-description>
<title>Lynx Long URL Overflow Vulnerabilities</title>
<updated-on type="datetime">2007-12-12T00:25:12-05:00</updated-on>
<user-id type="integer"></user-id>
<ext-references>
<ext-reference>
<ext-reference-type-id type="integer">3</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>2000-0209</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">5</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>1012</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">19</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>28149</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">24</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>http://downloads.digium.com/pub/security/AST-2007-027.pdf</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">3</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>2007-6430</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">30</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>http://www.securityfocus.com/archive/1/archive/1/485287/100/0/threaded</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">33</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>http://downloads.digium.com/pub/security/AST-2007-027.html
</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">5</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>26928</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">38</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>ADV-2007-4260</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">31</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>1019110</value>
</ext-reference>
<ext-reference>
<ext-reference-type-id type="integer">13</ext-reference-type-id>
<fourofour type="boolean">false</fourofour>
<indirect type="boolean">false</indirect>
<value>39124</value>
</ext-reference>
</ext-references>
</vulnerability>
I have a Java bean and I need to bind the xml to a java object. Is there a
way to do the binding? should I use xquery to parse it? Can you guys help me
with a point to start. I have no idea for a starting point to do this.
Thanks and my best regards.
--
View this message in context: http://camel.465427.n5.nabble.com/Parsing-XML-and-binding-to-Java-Object-tp5621145p5621145.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Parsing XML and binding to Java Object
Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Apr 6, 2012 at 12:01 AM, Christian Müller
<ch...@gmail.com> wrote:
> Use the camel-jaxb component/dataformat: http://camel.apache.org/jaxb.html
>
Yeah we have some data formats listed here which can do Object <-> XML
http://camel.apache.org/data-format
> Best,
> Christian
>
> On Thu, Apr 5, 2012 at 8:36 PM, vs.souza <vs...@gmail.com> wrote:
>
>> Hello friends,
>>
>> I am using restlet to consume a restful service and I receive the following
>> response from server:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <vulnerability>
>> <complete type="integer">5</complete>
>> <created-on type="datetime">2003-02-21T02:10:00-05:00</created-on>
>> <cve-description></cve-description>
>> <description></description>
>> <disclosure-date
>> type="datetime">2000-02-27T00:00:00-05:00</disclosure-date>
>> <disclosure-source-id type="integer"></disclosure-source-id>
>> <discovery-date type="datetime">1970-01-01T00:00:00-05:00</discovery-date>
>> <exploit-publish-date
>> type="datetime">1970-01-01T00:00:00-05:00</exploit-publish-date>
>> <keywords></keywords>
>> <manual-notes></manual-notes>
>> <osvdb-id type="integer">1234</osvdb-id>
>> <promoted-on type="datetime"></promoted-on>
>> <short-description></short-description>
>> <solution></solution>
>> <solution-date type="datetime">1970-01-01T00:00:00-05:00</solution-date>
>> <t-description></t-description>
>> <title>Lynx Long URL Overflow Vulnerabilities</title>
>> <updated-on type="datetime">2007-12-12T00:25:12-05:00</updated-on>
>> <user-id type="integer"></user-id>
>> <ext-references>
>> <ext-reference>
>> <ext-reference-type-id type="integer">3</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>> <value>2000-0209</value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">5</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>> <value>1012</value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">19</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>> <value>28149</value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">24</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>>
>> <value>http://downloads.digium.com/pub/security/AST-2007-027.pdf</value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">3</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>> <value>2007-6430</value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">30</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>>
>> <value>
>> http://www.securityfocus.com/archive/1/archive/1/485287/100/0/threaded
>> </value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">33</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>> <value>http://downloads.digium.com/pub/security/AST-2007-027.html
>> </value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">5</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>> <value>26928</value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">38</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>> <value>ADV-2007-4260</value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">31</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>> <value>1019110</value>
>> </ext-reference>
>> <ext-reference>
>> <ext-reference-type-id type="integer">13</ext-reference-type-id>
>> <fourofour type="boolean">false</fourofour>
>> <indirect type="boolean">false</indirect>
>> <value>39124</value>
>> </ext-reference>
>> </ext-references>
>> </vulnerability>
>>
>>
>> I have a Java bean and I need to bind the xml to a java object. Is there a
>> way to do the binding? should I use xquery to parse it? Can you guys help
>> me
>> with a point to start. I have no idea for a starting point to do this.
>>
>> Thanks and my best regards.
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Parsing-XML-and-binding-to-Java-Object-tp5621145p5621145.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
--
Claus Ibsen
-----------------
CamelOne 2012 Conference, May 15-16, 2012: http://camelone.com
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
Re: Parsing XML and binding to Java Object
Posted by Christian Müller <ch...@gmail.com>.
Use the camel-jaxb component/dataformat: http://camel.apache.org/jaxb.html
Best,
Christian
On Thu, Apr 5, 2012 at 8:36 PM, vs.souza <vs...@gmail.com> wrote:
> Hello friends,
>
> I am using restlet to consume a restful service and I receive the following
> response from server:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <vulnerability>
> <complete type="integer">5</complete>
> <created-on type="datetime">2003-02-21T02:10:00-05:00</created-on>
> <cve-description></cve-description>
> <description></description>
> <disclosure-date
> type="datetime">2000-02-27T00:00:00-05:00</disclosure-date>
> <disclosure-source-id type="integer"></disclosure-source-id>
> <discovery-date type="datetime">1970-01-01T00:00:00-05:00</discovery-date>
> <exploit-publish-date
> type="datetime">1970-01-01T00:00:00-05:00</exploit-publish-date>
> <keywords></keywords>
> <manual-notes></manual-notes>
> <osvdb-id type="integer">1234</osvdb-id>
> <promoted-on type="datetime"></promoted-on>
> <short-description></short-description>
> <solution></solution>
> <solution-date type="datetime">1970-01-01T00:00:00-05:00</solution-date>
> <t-description></t-description>
> <title>Lynx Long URL Overflow Vulnerabilities</title>
> <updated-on type="datetime">2007-12-12T00:25:12-05:00</updated-on>
> <user-id type="integer"></user-id>
> <ext-references>
> <ext-reference>
> <ext-reference-type-id type="integer">3</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
> <value>2000-0209</value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">5</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
> <value>1012</value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">19</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
> <value>28149</value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">24</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
>
> <value>http://downloads.digium.com/pub/security/AST-2007-027.pdf</value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">3</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
> <value>2007-6430</value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">30</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
>
> <value>
> http://www.securityfocus.com/archive/1/archive/1/485287/100/0/threaded
> </value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">33</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
> <value>http://downloads.digium.com/pub/security/AST-2007-027.html
> </value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">5</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
> <value>26928</value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">38</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
> <value>ADV-2007-4260</value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">31</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
> <value>1019110</value>
> </ext-reference>
> <ext-reference>
> <ext-reference-type-id type="integer">13</ext-reference-type-id>
> <fourofour type="boolean">false</fourofour>
> <indirect type="boolean">false</indirect>
> <value>39124</value>
> </ext-reference>
> </ext-references>
> </vulnerability>
>
>
> I have a Java bean and I need to bind the xml to a java object. Is there a
> way to do the binding? should I use xquery to parse it? Can you guys help
> me
> with a point to start. I have no idea for a starting point to do this.
>
> Thanks and my best regards.
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Parsing-XML-and-binding-to-Java-Object-tp5621145p5621145.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>