map-to problems

View: New views
7 Messages — Rating Filter:   Alert me  

map-to problems

by smokie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey All,

I have been trying out all sorts of XML -> POJO binders, but Castor
seams to have nearly everything that I need. But I have come across a
problem. I am trying to implement a client for the XMPP protocol and
some of the XML doesn't seam to fit with Castor.

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

When I declare xmlns as a attribute it never provides a value when
unmarshalled. Also how can I provide the data in xmlns:stream to my
POJO?

--
Best Regards,
Mark Wallsgrove

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: map-to problems

by Werner Guttmann-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mark,

both xmlns:stream="..." and xmlns="...." are XML namespace declarations,
and as such will not be accessible to you upon unmarshalling. The will
be used (internally) by Castor to 'bind' the XML to the corresponding
POJOs as mapped in your mapping file (assuming you are using a mapping
file, of course).

Does this make (more) sense to you ?

Regards
Werner

Mark Wallsgrove wrote:

> Hey All,
>
> I have been trying out all sorts of XML -> POJO binders, but Castor
> seams to have nearly everything that I need. But I have come across a
> problem. I am trying to implement a client for the XMPP protocol and
> some of the XML doesn't seam to fit with Castor.
>
> <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
> id="4AEACDCF" xmlns="jabber:client" from="shigeoka.com" />
>
> When I declare xmlns as a attribute it never provides a value when
> unmarshalled. Also how can I provide the data in xmlns:stream to my
> POJO?
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: map-to problems

by smokie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi werner,

Thanks for the reply. That does make sense, and yes i am using a
mapping file. Is there a way how you can use more than one namespace?
If i place two map-to elements in a class it throws a exception..

Best regards,
Mark

On 11/3/09, Werner Guttmann <wguttmn@...> wrote:

> Hi Mark,
>
> both xmlns:stream="..." and xmlns="...." are XML namespace declarations,
> and as such will not be accessible to you upon unmarshalling. The will
> be used (internally) by Castor to 'bind' the XML to the corresponding
> POJOs as mapped in your mapping file (assuming you are using a mapping
> file, of course).
>
> Does this make (more) sense to you ?
>
> Regards
> Werner
>
> Mark Wallsgrove wrote:
>> Hey All,
>>
>> I have been trying out all sorts of XML -> POJO binders, but Castor
>> seams to have nearly everything that I need. But I have come across a
>> problem. I am trying to implement a client for the XMPP protocol and
>> some of the XML doesn't seam to fit with Castor.
>>
>> <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
>> id="4AEACDCF" xmlns="jabber:client" from="shigeoka.com" />
>>
>> When I declare xmlns as a attribute it never provides a value when
>> unmarshalled. Also how can I provide the data in xmlns:stream to my
>> POJO?
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>


--
Best Regards,
Mark Wallsgrove

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Re: map-to problems

by Werner Guttmann-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mark,

Mark Wallsgrove wrote:
> Hi werner,
>
> Thanks for the reply. That does make sense, and yes i am using a
> mapping file. Is there a way how you can use more than one namespace?
No, definitely not. Bear in mind that you are binding a Java class to an
XML artefact in your XML document instance. As such, this XML artefact
can carry one (and only one) namespace URI (prefix). Anything else would
violate the core definitions of XML.

> If i place two map-to elements in a class it throws a exception..
>
> Best regards,
> Mark
>
> On 11/3/09, Werner Guttmann <wguttmn@...> wrote:
>> Hi Mark,
>>
>> both xmlns:stream="..." and xmlns="...." are XML namespace declarations,
>> and as such will not be accessible to you upon unmarshalling. The will
>> be used (internally) by Castor to 'bind' the XML to the corresponding
>> POJOs as mapped in your mapping file (assuming you are using a mapping
>> file, of course).
>>
>> Does this make (more) sense to you ?
>>
>> Regards
>> Werner
>>
>> Mark Wallsgrove wrote:
>>> Hey All,
>>>
>>> I have been trying out all sorts of XML -> POJO binders, but Castor
>>> seams to have nearly everything that I need. But I have come across a
>>> problem. I am trying to implement a client for the XMPP protocol and
>>> some of the XML doesn't seam to fit with Castor.
>>>
>>> <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
>>> id="4AEACDCF" xmlns="jabber:client" from="shigeoka.com" />
>>>
>>> When I declare xmlns as a attribute it never provides a value when
>>> unmarshalled. Also how can I provide the data in xmlns:stream to my
>>> POJO?
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: map-to problems

by smokie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Darm! It would seam that XMPP relies on such violations! Could you
sugggest any binding tools which ignores the namespace rule?

On 11/3/09, Werner Guttmann <wguttmn@...> wrote:

> Hi Mark,
>
> Mark Wallsgrove wrote:
>> Hi werner,
>>
>> Thanks for the reply. That does make sense, and yes i am using a
>> mapping file. Is there a way how you can use more than one namespace?
> No, definitely not. Bear in mind that you are binding a Java class to an
> XML artefact in your XML document instance. As such, this XML artefact
> can carry one (and only one) namespace URI (prefix). Anything else would
> violate the core definitions of XML.
>
>> If i place two map-to elements in a class it throws a exception..
>>
>> Best regards,
>> Mark
>>
>> On 11/3/09, Werner Guttmann <wguttmn@...> wrote:
>>> Hi Mark,
>>>
>>> both xmlns:stream="..." and xmlns="...." are XML namespace declarations,
>>> and as such will not be accessible to you upon unmarshalling. The will
>>> be used (internally) by Castor to 'bind' the XML to the corresponding
>>> POJOs as mapped in your mapping file (assuming you are using a mapping
>>> file, of course).
>>>
>>> Does this make (more) sense to you ?
>>>
>>> Regards
>>> Werner
>>>
>>> Mark Wallsgrove wrote:
>>>> Hey All,
>>>>
>>>> I have been trying out all sorts of XML -> POJO binders, but Castor
>>>> seams to have nearly everything that I need. But I have come across a
>>>> problem. I am trying to implement a client for the XMPP protocol and
>>>> some of the XML doesn't seam to fit with Castor.
>>>>
>>>> <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
>>>> id="4AEACDCF" xmlns="jabber:client" from="shigeoka.com" />
>>>>
>>>> When I declare xmlns as a attribute it never provides a value when
>>>> unmarshalled. Also how can I provide the data in xmlns:stream to my
>>>> POJO?
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>


--
Best Regards,
Mark Wallsgrove

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Re: map-to problems

by Werner Guttmann-6 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Before doing so, can you post a complete (albeit minimal) XMPP document
instance for us to have a short look and suggest a few things.

Regards
Werner

Mark Wallsgrove wrote:

> Darm! It would seam that XMPP relies on such violations! Could you
> sugggest any binding tools which ignores the namespace rule?
>
> On 11/3/09, Werner Guttmann <wguttmn@...> wrote:
>> Hi Mark,
>>
>> Mark Wallsgrove wrote:
>>> Hi werner,
>>>
>>> Thanks for the reply. That does make sense, and yes i am using a
>>> mapping file. Is there a way how you can use more than one namespace?
>> No, definitely not. Bear in mind that you are binding a Java class to an
>> XML artefact in your XML document instance. As such, this XML artefact
>> can carry one (and only one) namespace URI (prefix). Anything else would
>> violate the core definitions of XML.
>>
>>> If i place two map-to elements in a class it throws a exception..
>>>
>>> Best regards,
>>> Mark
>>>
>>> On 11/3/09, Werner Guttmann <wguttmn@...> wrote:
>>>> Hi Mark,
>>>>
>>>> both xmlns:stream="..." and xmlns="...." are XML namespace declarations,
>>>> and as such will not be accessible to you upon unmarshalling. The will
>>>> be used (internally) by Castor to 'bind' the XML to the corresponding
>>>> POJOs as mapped in your mapping file (assuming you are using a mapping
>>>> file, of course).
>>>>
>>>> Does this make (more) sense to you ?
>>>>
>>>> Regards
>>>> Werner
>>>>
>>>> Mark Wallsgrove wrote:
>>>>> Hey All,
>>>>>
>>>>> I have been trying out all sorts of XML -> POJO binders, but Castor
>>>>> seams to have nearly everything that I need. But I have come across a
>>>>> problem. I am trying to implement a client for the XMPP protocol and
>>>>> some of the XML doesn't seam to fit with Castor.
>>>>>
>>>>> <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
>>>>> id="4AEACDCF" xmlns="jabber:client" from="shigeoka.com" />
>>>>>
>>>>> When I declare xmlns as a attribute it never provides a value when
>>>>> unmarshalled. Also how can I provide the data in xmlns:stream to my
>>>>> POJO?
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe from this list, please visit:
>>>>
>>>>     http://xircles.codehaus.org/manage_email
>>>>
>>>>
>>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>>     http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Re: Re: map-to problems

by smokie :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Werner,

By the looks of it there are few occurrences where multiple namespaces
are needed, but they are required none the less.

 <stream:stream xmlns="jabber:client"
xmlns:stream="http://etherx.jabber.org/streams" id="963816404"
from="jabber.org" version="1.0" xml:lang="en" />

I cannot get onto the XMPP website to investigate more, but they do
have a list of schemas:
http://www.xmpp.org/schemas/

I guess a simple fix would be to allow xmlns to become a attribute if
something like xmlns:stream already exists. Would this be possible?

Best Regards,
Mark Wallsgrove


2009/11/4 Werner Guttmann <wguttmn@...>:

> Before doing so, can you post a complete (albeit minimal) XMPP document
> instance for us to have a short look and suggest a few things.
>
> Regards
> Werner
>
> Mark Wallsgrove wrote:
>> Darm! It would seam that XMPP relies on such violations! Could you
>> sugggest any binding tools which ignores the namespace rule?
>>
>> On 11/3/09, Werner Guttmann <wguttmn@...> wrote:
>>> Hi Mark,
>>>
>>> Mark Wallsgrove wrote:
>>>> Hi werner,
>>>>
>>>> Thanks for the reply. That does make sense, and yes i am using a
>>>> mapping file. Is there a way how you can use more than one namespace?
>>> No, definitely not. Bear in mind that you are binding a Java class to an
>>> XML artefact in your XML document instance. As such, this XML artefact
>>> can carry one (and only one) namespace URI (prefix). Anything else would
>>> violate the core definitions of XML.
>>>
>>>> If i place two map-to elements in a class it throws a exception..
>>>>
>>>> Best regards,
>>>> Mark
>>>>
>>>> On 11/3/09, Werner Guttmann <wguttmn@...> wrote:
>>>>> Hi Mark,
>>>>>
>>>>> both xmlns:stream="..." and xmlns="...." are XML namespace declarations,
>>>>> and as such will not be accessible to you upon unmarshalling. The will
>>>>> be used (internally) by Castor to 'bind' the XML to the corresponding
>>>>> POJOs as mapped in your mapping file (assuming you are using a mapping
>>>>> file, of course).
>>>>>
>>>>> Does this make (more) sense to you ?
>>>>>
>>>>> Regards
>>>>> Werner
>>>>>
>>>>> Mark Wallsgrove wrote:
>>>>>> Hey All,
>>>>>>
>>>>>> I have been trying out all sorts of XML -> POJO binders, but Castor
>>>>>> seams to have nearly everything that I need. But I have come across a
>>>>>> problem. I am trying to implement a client for the XMPP protocol and
>>>>>> some of the XML doesn't seam to fit with Castor.
>>>>>>
>>>>>> <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
>>>>>> id="4AEACDCF" xmlns="jabber:client" from="shigeoka.com" />
>>>>>>
>>>>>> When I declare xmlns as a attribute it never provides a value when
>>>>>> unmarshalled. Also how can I provide the data in xmlns:stream to my
>>>>>> POJO?
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe from this list, please visit:
>>>>>
>>>>>     http://xircles.codehaus.org/manage_email
>>>>>
>>>>>
>>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe from this list, please visit:
>>>
>>>     http://xircles.codehaus.org/manage_email
>>>
>>>
>>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>



--
Best Regards,
Mark Wallsgrove

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email