Show All

# chooseFragment Element

Specifies an XML fragment.

## Type

    xsd:complexType

## Structure

Name | Description
--- | ---
attributeData | (Optional element) Specifies the name, and associated value, of an attribute that will be inserted, or modified if it already exists, by the insert action of the xCollection or xOptional editing components.
followingSiblings | (Optional attribute) Specifies a relative XPath expression from the parent node that specifies the XML Document Object Model (DOM) nodes prior to which the insertion of the XML fragment should occur. Note This is not necessary in Microsoft Office InfoPath 2003 Service Pack 1 and will not be automatically generated by InfoPath.
parent | (Optional attribute) Specifies a relative XPath expression from the container node that specifies the XML DOM node under which the XML fragment is inserted.
innerFragment | (Optional attribute) Specifies a relative XPath expression from the parent node to the smallest fragment to be inserted. Note Use of this attribute requires Microsoft Office InfoPath 2003 Service Pack 1.

## Remarks

The chooseFragment element is a required element of the fragmentToInsert element.

The chooseFragment element has an open content model. It may contain text, or one or more element nodes, or mixed content (both element nodes and text nodes). In addition to or instead of XML data to be inserted directly as a fragment, it can contain one or more attributeData elements. In this case the attributeData elements are not included as inserted content, but are each used to specify setting an attribute value.

The chooseFragment elements are typically ordered in increasing size. The first will be the data fragment to be inserted by the insertBefore and insertAfter actions, when there is already at least one item in the collection. The insert action, on the other hand, can be invoked when there is currently a node in the XML tree corresponding to a container, but no node corresponding to an item (in other words, it can be used to insert the first item).

Note Microsoft Office InfoPath 2003 Service Pack 1 will generate only one chooseFragment node. For more information, see the innerFragment attribute.

Note Any element content within the XML fragment, other than attribute data, corresponds to new content to be inserted into the form's underlying XML document, and should be in the appropriate namespace.

## Example

The following is an example of the chooseFragment element:

    <xsf:editing>
       <xsf:xmlToEdit name="CD_10"
          item="/CustomUISample/CDCollection/CD"
          container="/CustomUISample">
          <xsf:editWith caption="CD"
             xd:autogeneration="template"
             component="xCollection">
             <xsf:fragmentToInsert>
                <xsf:chooseFragment parent="CDCollection">
                   <CD>
                      <Title></Title>
                      <Artist></Artist>
                      <Tracks>
                         <Track></Track>
                         <Track></Track>
                      </Tracks>
                   </CD>
                </xsf:chooseFragment>
             </xsf:fragmentToInsert>
          </xsf:editWith>
       </xsf:xmlToEdit>
    </xsf:editing>

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp