Constructing a Metadata Property String

How to Construct a Metadata Property String

To read or write a metadata object, you must pass a string of properties that describe the object to the SAS Metadata Server. This property string is passed to the server in the INMETADATA parameter of the method call.
A metadata object is described by the following:
  • its metadata type
  • attributes that are specific to the metadata object, such as its ID, name, description, and other characteristics
  • its associations with other metadata objects
The SAS Open Metadata Interface supports the following XML elements for defining a metadata property string:
metadata type
identifies the SAS Metadata Model metadata type that you want to read or write, enclosed in angle brackets. See the SAS Metadata Model: Reference for information about supported metadata types. The following example shows the XML element representing the PhysicalTable metadata type:
<PhysicalTable></PhysicalTable>
A shorthand method of specifying this XML element is as follows:
<PhysicalTable/>
metadata type attributes
specifies the attributes of the metadata type as XML attributes (enclosed in the angle brackets of the metadata type). The following example shows the PhysicalTable metadata type with "NE Sales" as the Name attribute.
<PhysicalTable Name="NE Sales"/>
association name and associated metadata type subelements
describe the relationship between the metadata object in the main XML element and one or more other metadata types as nested XML elements. For example:
<PhysicalTable Name="NE Sales"/>    
   <Columns>       
     <Column/>    
   </Columns> 
</PhysicalTable>
The SAS Metadata Model defines the association names that are supported for every metadata type, as well as the associated metadata types that are valid for each association name. In this example, the first nested element, Columns, is the association name subelement. The association name is a label that describes the relationship between the main XML element and the associated object subelement.
The second nested element, Column, is the associated object subelement. The associated object subelement specifies the associated metadata type that you are interested in. The Columns association name supports associated objects of the metadata types Column and ColumnRange. By specifying Column in the property string, you indicate to the SAS Metadata Server that you are interested only in associated objects of this metadata type.
The attributes that you specify in the input metadata property string depend on the method in which it will be used. For example, a metadata property string that is submitted to the AddMetadata method would not specify the Id attribute, as the server assigns a value for this attribute when the metadata object is created. The main element in a metadata property string for the UpdateMetadata and GetMetadata methods must specify the Id attribute.
CAUTION:
To meet XML parsing rules, the metadata type, attribute, association, and associated metadata type names that you specify in the metadata property string must exactly match those published in the metadata type documentation.

Quotation Marks and Special Characters

The metadata property string is passed as a string literal (a quoted string) in most programming environments. To ensure that the string is parsed correctly, it is recommended that any additional double quotation marks, such as those enclosing XML attribute values in the metadata property string, be marked to indicate that they should be treated as characters. Here are examples of using escape characters in different programming environments to mark the additional double quotation marks:
Java
"<PhysicalTable Id=\"123\" Name=\"TestTable\" />"
Visual Basic
"<PhysicalTable Id=""123"" Name=""TestTable"" />"
Visual C++
"<PhysicalTable Id=\"123\" Name=\"TestTable\" />"
SAS
"<PhysicalTable Id=""123"" Name=""TestTable"" />" "<PhysicalTable Id='123' Name='TestTable' />" '<PhysicalTable Id="123" Name="TestTable"/>'
Special characters that are used in XML syntax are specified as follows:
< = &lt;
> = &gt;
& = &amp;