Looks good, Joshua, though if the type="..." value is constant you can just say:
<value style="attribute" name="type" constant="ns4:Vector"/> rather than having to set a field. This is kind of a kludge with the namespace handling. To really do this correctly there's a QName class added to org.jibx.runtime in 1.1.3, with serialize and deserialize methods included. That's probably overkill for what Frank wants to do, though. - Dennis Dennis M. Sosnoski SOA and Web Services in Java Training and Consulting http://www.sosnoski.com - http://www.sosnoski.co.nz Seattle, WA +1-425-939-0576 - Wellington, NZ +64-4-298-6117 Davies, Joshua wrote: > Here's the closest I could come up with: > > <binding direction="output"> > <namespace uri="http://xml.apache.org/xml-instance" prefix="xsi" /> > <namespace uri="http://xml.apache.org/xml-soap" prefix="ns4" /> > > <mapping name="myList" class="MyList"> > <value style="attribute" name="type" field="type" > ns="http://xml.apache.org/xml-instance" /> > > <collection field="items"> > <value name="item" /> > </collection> > </mapping> > </binding> > This binding generates this output: > > <?xml version="1.0" encoding="UTF-8" standalone="no"?> > <myList xmlns:xsi="http://xml.apache.org/xml-instance" > xmlns:ns4="http://xml.apache.org/xml-soap" xsi:type="ns4:Vector"> > <item>item_1</item> > <item>item_2</item> > </myList> > > Which is pretty close to what you showed below (the "xsi" namespace is > declared in the "myList" element because it's the top-level element - > if "myList" is contained in another element, the namespace could go up > there). > > What I don't see is any way to "automate" the association of the > "xsi:type"s value to the "ns4" namespace - in other words, in code, I > set the "type" field to be equal to "ns4:Vector". > > ------------------------------------------------------------------------ > *From:* [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] *On Behalf Of *Luo, > Frank > *Sent:* Monday, January 29, 2007 3:30 PM > *To:* [email protected] > *Subject:* [jibx-users] generating attributes for a collection > > Hi, there, > > Can someone show me how to generate the following xml? I am having > trouble generating attributes for a collection. > > <myList xsi:type="ns4:Vector" > xmlns:ns4="http://xml.apache.org/xml-soap"> > > <item>item_1</item> > > <item>item_2</item> > > </myList> > > Thx. > > Frank > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > ------------------------------------------------------------------------ > > _______________________________________________ > jibx-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/jibx-users > ------------------------------------------------------------------------- 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 [email protected] https://lists.sourceforge.net/lists/listinfo/jibx-users
