You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by Shikha Prasad <sh...@mind-sol.net> on 2005/11/07 11:29:17 UTC

Problem with Unmarshallar

hi,

I have to read and XML document, using JAXB (i am using apache JAXME for that).
But every time i reach the method in which I am callling a unmarshallar, i encounter this problem:-
"Exception in thread "main" javax.xml.bind.UnmarshalException: A Manager for Address is not declared."

Where "Address" is the first node of the XML i have to read.
It will be of great help if i can get some expert comments. I am using the "Unmarshallar" method for the XML.
And also, please let me know if there are other ways read XML apart from marshalling and unmarshalling.

Hope to hear from you soon

Thanks and Regards,
Shikha

Re: Problem with Unmarshallar

Posted by Jochen Wiedmann <jo...@gmail.com>.
Shikha Prasad wrote:

> Exception in thread "main" _javax.xml.bind.UnmarshalException_: 
> JM_EVENT_UNEXPECTED_CHILD_ELEMENT: Unexpected element: 
> '{http://www.ibm.com/domainobjects}Image'

That means, that either a) your schema is wrong, because it doesn't 
state that there may be a child element "Image" at a certain point or b) 
you have an error in your XML example file, because the "Image" child 
element should not be, where it is.

One cannot guess from here, without knowing schema and sample file.


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: Problem with Unmarshallar

Posted by Shikha Prasad <sh...@mind-sol.net>.
Hi,

I have done as you have suggested, and now this is the error I am getting:-
Exception in thread "main" javax.xml.bind.UnmarshalException: JM_EVENT_UNEXPECTED_CHILD_ELEMENT: Unexpected element: '{http://www.ibm.com/domainobjects}Image'

I have no idea what this error means, please help me to rectify it.

Thanks and Regards,

Shikha

  ----- Original Message ----- 
  From: Jochen Wiedmann 
  To: Shikha Prasad 
  Cc: jaxme-dev@ws.apache.org 
  Sent: Saturday, November 12, 2005 6:23 PM
  Subject: Re: Problem with Unmarshallar


  On 11/12/05, Shikha Prasad <sh...@mind-sol.net> wrote:

  > <Images xmlns:default="http://www.ibm.com/domainobjects">

  It's not xmlns:default.It's simply xmlns.


  Jochen

Re: Problem with Unmarshallar

Posted by Jochen Wiedmann <jo...@gmail.com>.
On 11/12/05, Shikha Prasad <sh...@mind-sol.net> wrote:

> <Images xmlns:default="http://www.ibm.com/domainobjects">

It's not xmlns:default.It's simply xmlns.


Jochen

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org


Re: Problem with Unmarshallar

Posted by Shikha Prasad <sh...@mind-sol.net>.
Hi,

I have tried what you have suggested, but even after that, my code is not running and giving the same error. Please help me.

The XSD starts with the following:-
<?xml version="1.0" ?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 

xmlns:jxb="http://java.sun.com/xml/ns/jaxb" 

jxb:version="1.0" 

xmlns:domainObjects="http://www.ibm.com/domainobjects" 

targetNamespace="http://www.ibm.com/domainobjects"

xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" 

jxb:extensionBindingPrefixes="xjc">



and the XML file starts with the following:-

<?xml version="1.0" encoding="UTF-8"?>



<Images xmlns:default="http://www.ibm.com/domainobjects">

where Images is the root node.
Hope to hear from you soon.

Thanks and Regards,
Shikha
  ----- Original Message ----- 
  From: Jochen Wiedmann 
  To: Shikha Prasad 
  Sent: Monday, November 07, 2005 4:38 PM
  Subject: Re: Problem with Unmarshallar


  On 11/7/05, Shikha Prasad <sh...@mind-sol.net> wrote:

  > I am new to the language and JaxME, so it will be of great help, if you can
  > provide me some dummy xml, with a namespace.

  Basically all you have to do is: If the schema has an attribute

      targetNamespace='...'

  then the XML document must have an attribute like

      xmlns='...'

  with the same value.


  Jochen

  --
  Often it does seem a pity that Noah and his party did not miss the
  boat. (Mark Twain)

Re: Problem with Unmarshallar

Posted by Jochen Wiedmann <jo...@gmail.com>.
On 11/7/05, Shikha Prasad <sh...@mind-sol.net> wrote:

> javax.xml.bind.UnmarshalException: A Manager for Address is
> not declared."

This sounds like you forgot a namespace declaration in your XML document.


> And also, please let me know if there are other ways read XML apart from
> marshalling and unmarshalling.

What else do you need?


Jochen


--
Often it does seem a pity that Noah and his party did not miss the
boat. (Mark Twain)

---------------------------------------------------------------------
To unsubscribe, e-mail: jaxme-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: jaxme-dev-help@ws.apache.org