Deprecated. XML Maps are deprecated as of the WebLogic Platform 8.1 release. For new code, use XQuery maps. For more information, see Introduction to XQuery Maps.

Declaring Variables with <xm:bind>

You can use the <xm:bind> attribute to declare a new variable for use in an XML map. Note that the variable you declare with <xm:bind> is available only within the scope of the element in which you declare it, and children of that element.

The following example declares a new Address variable a and binds it to the address member of the customerData structure. Because it is declared in the <address> element, the new variable is available to the <street> and <zip> elements, which are its children.

/**
 * @common:operation
 * @jws:parameter-xml xml-map::
 *     <customer>
 *         <name>{String customerData.name}</name>
 *         <address xm:bind="Address a is customerData.address">
 *             <street>{a.street}</street>
 *             <zip>{a.zip}</zip>
 *         </address>
 *     </customer>
 *     ::
 */
public void addCustomerData(MyStructure customerData)
{
    System.out.println("Customer name is " + customerData.get("name"));
    System.out.println("Customer zipcode is " +
        ((Address)customerData.get("address")).zip);
}

For reference information on <xm:bind>, see <xm:bind> Attribute.

Related Topics

Matching XML Shapes

Binding to Java Data Structure Members

<xm:bind> Attribute