[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Simple Moxy / JAXB Question

Hi Smokie,

I apologize for the delay in getting back to you.  Looking at the input and output you sent (slightly re-formatted) below, the issue I see is that 4 extra namespace declarations are included.  While the document is technically correct, you would rather not see the extra clutter.

<stream:stream
    xmlns:stream="http://etherx.jabber.org/streams"
    xmlns="jabber:client"
    id="4AE5694A"
    from="shigeoka.com" />

<stream
    xmlns="http://etherx.jabber.org/streams"
    xmlns:ns2="jabber:client"
    xmlns:ns3="urn:ietf:params:xml:ns:xmpp-stanzas"
    xmlns:ns4="jabber:server:dialback"
    xmlns:ns5="jabber:server"
    xmlns:ns6="urn:ietf:params:xml:ns:xmpp-streams"
    id="4AE5694A"
    from="shigeoka.com"/>

I took a quick look at the XMPP schemas (http://xmpp.org/schemas/) and the other namespaces do appear to be relevant to the domain.  The approach MOXy takes is to declare the relevant namespaces assuming they'll be used rather than taking a performance hit of determining the declarations of demand.  If you are interested in such a feature the best route is to enter it as an EclipseLink bug at the link below:

https://bugs.eclipse.org/bugs/enter_bug.cgi?product=EclipseLink
-Blaise

smokie wrote:
Hey,

I am looking at creating a XMPP client using EclipseLink Moxy. I have
converted a XSD that is provided by the XMPP community into POJOs
(http://xmpp.org/schemas/). Currently I read in this XML:

<stream:stream xmlns:stream="http://etherx.jabber.org/streams" id="4AE5694A"
xmlns="jabber:client" from="shigeoka.com" />

When I print Java object to the screen I then get:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<stream xmlns="http://etherx.jabber.org/streams" xmlns:ns2="jabber:client"
xmlns:ns3="urn:ietf:params:xml:ns:xmpp-stanzas"
xmlns:ns4="jabber:server:dialback" xmlns:ns5="jabber:server"
xmlns:ns6="urn:ietf:params:xml:ns:xmpp-streams" id="4AE5694A"
from="shigeoka.com"/>

>From what I can see, there are two problems. The namespaces are incorrect
and default data is being applied. What is the best approach for solving
these problems?

Best Regards,
Smokie