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

Reply via email to