Share via


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.
Bb265022.vs_note(en-us,office.12).gif  Note
This attribute was only necessary in releases prior to Microsoft Office InfoPath 2003 Service Pack 1 and will not be automatically generated by Microsoft Office InfoPath 2007.
Bb265022.vs_note(en-us,office.12).gif  Note
This attribute was only necessary in releases prior to Microsoft Office InfoPath 2003 Service Pack 1 and will not be automatically generated by Microsoft Office InfoPath 2007.
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.

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).

Bb265022.vs_note(en-us,office.12).gif  Note
Office InfoPath 2007 will generate only one chooseFragment node. For more information, see the innerFragment attribute.
Bb265022.vs_note(en-us,office.12).gif  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>