JAXB and multiple namespaces

125 views
Skip to first unread message

Brian Leathem

unread,
Nov 4, 2009, 6:30:25 PM11/4/09
to The Java Posse
I'm pretty sure there is some JAXB expertise in the Java Posse
community, so here goes...

I am trying to parse an XML document that consists of multiple
namespaces, as in:
<eec:attr>
<eec:title>Summary List of samples</eec:title>
<eec:name>samples_list</eec:name>
<eec:type>textarea</eec:type>
<eec:value><p>Nd<sub>2</sub>F<sub>14</sub>B</p></eec:value>
</eec:attr>

I want to map the "eec:" namespace into a java object, but I want JAXB
to leave the empty namespace (xhtml) as a single string. ie. the
entire piece of xhtml in the "eec:value" element should be the value
of a single JAXB object property.

It seems like I'm supposed to create my own JAXB XmlAdapter, but I'm
completely unfamiliar with the JAXB API. Can anyone point me to the
right place to start?

Thanks,
Brian Leathem

Brian Leathem

unread,
Nov 5, 2009, 2:14:26 AM11/5/09
to The Java Posse
On Nov 4, 3:30 pm, Brian Leathem <bleat...@gmail.com> wrote:
> I want to map the "eec:" namespace into a java object, but I want JAXB
> to leave the empty namespace (xhtml) as a single string.  ie. the
> entire piece of xhtml in the "eec:value" element should be the value
> of a single JAXB object property.

It seems I can achieve my goal by correctly configuring the JAXB
handling of the <xa:any> tag, which doesn't seem to complicated. My
understanding of JAXB is slowly increasing...

This is probably the wrong forum to be posting this stuff anyways...

Brian

kirk

unread,
Nov 5, 2009, 8:54:35 AM11/5/09
to java...@googlegroups.com
Hi all,

Shameless plug. I'll be presenting my "Performance tuning with cheap
drink and poor tools" for the Sacramento JUG on Tuesday night. What I
just figured out is that I'll actually be giving the presentation from
the San Fransisco office of Exit Certified. Apparently they will also
open up their San Jose office for anyone that maybe interested in
attending. The session is intended to be fairly interactive so it's
going to be interesting to see how it all works out. However, if you're
interested in attending send email to address below.

ExitCertified San Francisco
450 Sansome Street, Suite 600
San Francisco, CA 94111.
Register with Brad.s...@exitcertified.com

ExitCertified San Jose
111 W St John Street
San Jose, CA 95113
Register with Dennis...@exitcertified.com

Regards,
Kirk

Reply all
Reply to author
Forward
0 new messages