So I tried mocking up an example based on your snippet, and the biggest problem is Castor can't find an object that corresponds to the root element of the xml. I think if you can get over that hurdle, you can use the location attribute of the bind-xml element in a mapping file to take care of the other elements wrapping the one you're interested in.

I've had to nest things several layers deep before, but I've always still had the root element corresponding to one of my Java objects. Perhaps someone else can comment on your idea and help with the root element problem.

Hope this was at least a little help.

Stephen


Kosarev A.V. wrote:
Hi!

How I can marshal/unmarshal objects from non root elements? It`s possible with Castor? E.g.:

<?xml version="1.0"?>
 <doc>
   <answer>
     <error code="33008">Not found element</error>
   </answer>
 </doc>

mrashal to Java class

public class Error
{
  private int code;

  public int getCode()
  {
      return code;
  }
  public void setCode(int code)
  {
      this.code = code;
  }
}

Thanks.


-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------



-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to