Assuming your class is:
public class MyNode {
private String myAttr1;
private String myAttr2;
private String value;
// ...default constructor + getters and setters
}
is this what you are looking for?
<class name="MyNode">
<map-to xml="myNode"/>
<field name="MyAttr1" type="string">
<bind-xml name="myAttr1" node="attribute"/>
</field>
<field name="MyAttr2" type="string">
<bind-xml name="myAttr2" node="attribute"/>
</field>
<field name="Value" type="string">
<bind-xml node="text"/>
</field>
</class>
--- Hubert Rabago <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm having a difficult time trying to map an element
> like this:
>
> <myNode myAttr1="value1" myAttr2="value2">My Node's
> Value</myNode>
>
> My java object has fields for myNode, myAttr1, and
> myAttr2. I have
> some flexibility in changing the object, and have
> even tried creating
> an inner class that will allow me to move the
> mapping into another
> <class> defintion, but either I did something wrong
> or Castor won't
> work with inner classes.
>
> I have several elements like this, with both nodes
> and attributes, and
> in general I would like to avoid creating new
> classes just for them
> (or I'd go from five classes to about sixty).
>
> I tried the "location" attribute as well but it will
> only work if I
> don't want/need the actual value of the element
> itself, which I do.
>
> Can anyone point me to what I can do or a doc I can
> consult for this
> situation? I had a hard time looking for the
> answers in the castor
> docs, the mailing archives, and google.
>
> TIA,
>
> Hubert
>
>
>
>
-----------------------------------------------------------
>
> If you wish to unsubscribe from this mailing, send
> mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
>
_______________________________
Do you Yahoo!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev