On 9/1/06, Kees de Kooter <[EMAIL PROTECTED]> wrote:
> On 9/1/06, Kees de Kooter <[EMAIL PROTECTED]> wrote:
> > (Sorry - previous message had incomplete subject)
> >
> > This is my class:
> >
> > public class Message {
> >
> >     private Integer messageId;
> >
> >     ...
> > }
> >
> > And this is the xml I need to produce.
> >
> > <ns1:message>
> >     <ns1:id ns2:default="1">1</ns1:id>
> > </ns1:message>
> >
> > I need to add some extra (constant) attributes of a different
> > namespace ("ns2:default") to the value of message Id.
> >
> > Is this at all possible with JiBX?
> >
> > thanks,
> > Kees
> >
>
> OK, made some progress myself.
>
> If I defina the binding like this:
>
>         <structure name="id" value-style="attribute">
>             <value style="text" get-method="getId" set-method="setId"/>
>             <value name="default" style="attribute" constant="1"/>
>         </structure>
>
> I get the following xml, which is amost right
>
> <ns1:id exact="true">1</ns1:id>
>
> How can I assign the proper namespace to the "exact" attribute?
>

Also found the final piece of the puzzle: I added namespaces to the binding.

<binding>

    <namespace prefix="ns1" uri="uri1" default="elements"/>

    <namespace prefix="ns2" uri="uri2"  default="attributes"/>

Now all my attributes are by default of ns2.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to