users@jaxb.java.net

Re: unmarshal + namespace declaration == unexpected element

From: Stephen More <stephen.more_at_gmail.com>
Date: Thu, 8 Jan 2009 10:02:40 -0500

On Thu, Jan 8, 2009 at 2:45 AM, Wolfgang Laun wrote:
> You can add a namespace definition to this annotation:
>
> @XmlRootElement(name =
> "DescribeVolumesResponse",namespace="http://ec2.amazonaws.com/doc/2008-12-01/")

That does make the exception go away, but the unmarshaling is no longer working.


Background: I am trying to use a java api to start and stop virtual
machines in Amazons Elastic Cloud:
http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1674
I have dug into the code hoping to find a fix, but it is not so easy.
Perhaps a jaxb expert could help out here.


-Steve




> On Wed, Jan 7, 2009 at 11:41 PM,
> wrote:
>>
>> I am able to unmarshal from XML to a java object when there is no
>> xmlns element.
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <DescribeVolumesResponse>
>> </DescribeVolumesResult>
>>
>> Once the namespace gets added to the xml I am getting unexpected
>> element exceptions:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <DescribeVolumesResponse xmlns="http://ec2.amazonaws.com/doc/2008-12-01/">
>> </DescribeVolumesResult>
>>
>> The annotation in the java file looks like this:
>> @XmlRootElement(name = "DescribeVolumesResponse")
>>
>>
>> What do I need to do so the unexpected element exceptions stop occurring ?
>>
>> -Thanks
>> Steve More
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>>
>
>