Example of Using <XMLSELECT search="criteria"/> and a Template

The following is an example of a GetMetadataObjects request that uses an <XMLSELECT search="criteria"/> element to filter the initial set of objects that are retrieved, and a template to filter the associated objects that are retrieved:
<GetMetadataObjects>
   <Reposid>A00000001.A5DQTZY5</Reposid>
   <Type>Document</Type>
   <Objects/>
   <NS>SAS</NS>
<!-- OMI_XMLSELECT(128) + OMI_GET_METADATA(256) + OMI_TEMPLATE (4) 
+ OMI_ALL_SIMPLE (8) -->
   <Flags>396</Flags>    
   <Options>
      <XMLSELECT search="*[@Name ? 'Customer']"/>
      <Templates>
         <Document Id="" Name="" TextType="">
           <ResponsibleParties search="ResponsibleParty[@Role='OWNER']"/>
         </Document>
      </Templates>
   </Options>
</GetMetadataObjects>
In the request, note the following:
  • The <REPOSID> element identifies the repository from which to get the objects.
  • The <TYPE> element specifies to get objects of metadata type Document.
  • The <FLAGS> element specifies the sum of the OMI_XMLSELECT, OMI_GET_METADATA, OMI_TEMPLATE, and OMI_ALL_SIMPLE flags (128 + 256 + 4 + 8 = 396).
  • The <OPTIONS> element includes both an <XMLSELECT search="criteria"/> element and a <TEMPLATES> element. The <XMLSELECT search="criteria"/> search string specifies to get only Document objects that contain the word Customer in the Name attribute. The property string in the <TEMPLATES> element specifies to get only associated ResponsibleParty objects that have the Role attribute value of OWNER.
Here is an example of the output from the request:
<!-- Using the GETMETADATAOBJECTS method. -->

<Objects>
   <Document  Id="A5DQTZY5. BN000002" Name="2008 New Customers" 
ChangeState=" " Desc="New customers in the Southwest Region in 2008" LockedBy="" 
MetadataCreated="21Aug2008:21:11:32" MetadataUpdated="21Aug2008:21:11:32" 
PublicType=""  TextRole= ""  TextType="HTML" URI=""  URIType=""   
UsageVersion="0">
<ResponsibleParties SEARCH="ResponsibleParty[@Role='OWNER']">
<ResponsibleParty Id="A5DQTZY5. BE000004" ChangeState=" " Desc=" " LockedBy="" 
MetadataCreated="21Aug2008:21:11:32" MetadataUpdated="21Aug2008:21:11:32"  
Name="Manager" Role="Owner" UsageVersion="0"/></ResponsibleParties>
</Document>
</Objects> 
One Document object was found that included the name Customer in the Name attribute. One ResponsibleParty object was found that had the Role attribute value of OWNER.
SAS 9.3 supports many new features, including a new template form that helps you better control the scope of Get requests. For more information, see Understanding Templates and Creating Templates for the Get Methods.