Creating an XML file

Occasionally, you need to create a Content Manager OnDemand XML file, and this section discusses the overall syntax and layout of the XML file. The XML syntax discussed in this section helps you understand XML to be able to construct the XML objects which are used by Content Manager OnDemand. For more detailed information on XML and specific XML syntax information, reference XML documentation.

Overall file structure

A Content Manager OnDemand XML file is a basic text file that can be created by the user.

Every Content Manager OnDemand XML file will contain the following:
  • An XML identifier tag
  • An OnDemand identifier tag
  • One or more Content Manager OnDemand objects
  • An OnDemand ending tag
XML identifier tag
The XML identifier tag specifies the version of XML that is used and the encoding that is used. The standard XML identifier is:
<?xml version="1.0" encoding="UTF-8"?>
OnDemand identifier tag
The OnDemand identifier tag specifies the purpose for which the XML file is used. The standard OnDemand identifier is:
<onDemand xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

Previous versions of Content Manager OnDemand included an xsi:noNamespaceSchemaLocation attribute on the OnDemand identifier tag to indicate the location of the Content Manager OnDemand schema file. The schema file is now located in the Content Manager OnDemand installation directory. Content Manager OnDemand no longer looks for the schema file location based on the xsi:noNamespaceSchemaLocation attribute in the input XML file. If the xsi:noNamespaceSchemaLocation attribute is present in the XML file, it is ignored.

Content Manager OnDemand objects
See Objects and data model used in the Content Manager OnDemand XML file for the objects and data model used in the XML file.
OnDemand ending tag
The OnDemand ending tag indicates the end of the Content Manager OnDemand XML file. The ending tag is:
</onDemand>
Every standard Content Manager OnDemand XML file looks like this:
<?xml version="1.0" encoding="UTF-8"?>

<onDemand xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
			... Content Manager OnDemand Objects ...
</onDemand>

Content Manager OnDemand objects

The basic building blocks for the XML file are referred to as objects.

The following objects can be included within the Content Manager OnDemand XML file:
  • systemParameters
  • user
  • group
  • printer
  • storageSet
  • applicationGroup
  • application
  • folder
  • cabinet
  • hold
  • odfRecipient
  • odfRecipientList
  • odfReportId
  • odfDistribution with odfReportBundles
These objects as well as all of the child objects are shown in detail in the XML data tables in XML objects in the Content Manager OnDemand XML file.
Ensure that you include the objects in this order:
  1. systemParameters
  2. user
  3. group
  4. printer
  5. storageSet
  6. applicationGroup
  7. application
  8. folder
  9. cabinet
  10. hold
  11. odfRecipient
  12. odfRecipientList
  13. odfReportId
  14. odfDistribution with odfReportBundles

Each object which is to be put into the XML file contains the following information:

  1. A Start of Object tag.
  2. A list of object attributes.
  3. An optional list of child objects.
  4. An End of Object tag.

Start of Object

An object is specified in the XML file by placing the object name after a < symbol. For example,
<user
starts a user object.
Important: The capitalization of the object names is important and should be used exactly as shown in the data tables in Objects and data model used in the Content Manager OnDemand XML file.

Object attributes

All of the information about the object is contained within the object attributes. To add an attribute, specify the attribute name followed by an "=" symbol followed by the value of the attribute in double quotes. (Note: all attribute values need to be enclosed in a set of double quotes even if the value is a numeric value or a single character.) After all of the attribute values the '>' character is used to indicate the end of the object tag. For example,
<user  name="SAMPLEUSER" phone="(212) 555-1212" timeOut="4" >
Indicates a user with a name of SAMPLEUSER, a phone number of (212) 555-1212, and a timeout value of 4 minutes. All of the attributes that can be specified for each object as well as the possible values and default values are shown in the XML data tables.
Important:
  1. The capitalization of the object names is important and should be used exactly as shown in the data tables in Objects and data model used in the Content Manager OnDemand XML file.
  2. Unless you set Case Sensitivity as one of the system parameters, when you add a user, Content Manager OnDemand converts lowercase letters in the user ID to uppercase. You can type the user ID in uppercase, lowercase, or mixed case letters. In the above example, whether you enter the user ID as SAMPLEUSER, sampleuser, or SampleUser, Content Manager OnDemand automatically converts it to SAMPLEUSER.

Child objects

Child objects are constructed the same way as the main Content Manager OnDemand objects. All child objects must occur after the object to which they are associated with and before the end of the object tag. In this example, there are two user permission children for the SampleUser user.
<user name="SampleUser" phone="(212) 555-1212" timeOut="4" >
<permission user="APP1" adminAuthority="Yes" />
<permission user="APP2" adminAuthority="Yes" />
Important: If an object does not contain any children, such as the permission objects shown above, it must be ended with a slash / and the > symbol.

See XML objects in the Content Manager OnDemand XML file for detailed information about the types of child objects that each object can have and, in some cases, the maximum number of child objects that can be created.

Some of the child objects themselves can have children. These are defined in the same way as above. See the second example in the Examples section below.

End of object

The last item the user object needs is the end of object tag. This is indicated by placing the name of the object between </ and >. For example,
</user>
indicates the end of the user object.
As with any object if the object does not contain child objects, the object can be ended by placing a /> at the end of the object definition. So the following,
<group name="Sample"  gid="1084000">
</group>
is equivalent to:
<group name="Sample" gid="1084000"/>

Examples

The following is a complete Content Manager OnDemand XML file that contains two users and a user group.
<?xml version="1.0" encoding="UTF-8"?>
<onDemand xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

		<user
			name="SampleUser1"  email="Sample@us.ibm.com"  printer="Sample"
			userType="User Admin"
			createFoldersAuth="Yes">
			<permission user="SampleUser2" adminAuthority="Yes" />
			<permission user="SampleUser3" adminAuthority="No" />
			<permission group="SampleGroup1"/>
		</user>

		<user
			name="SampleUser2"  password="xxxxxxx"  timeOut="No Limit"
			description="This is a description of Sample User Two">
		</user>

		<group
			name="SampleGroup1"
			description="A Sample Group Number One"
			ownerUser="Admin">
			<user name="SampleUser2"/>
			<user name="SampleUser3"/>
		</group>

</onDemand>
The following example shows a folder with a field child and the field child has a fieldInfo child.
<?xml version="1.0" encoding="UTF-8"?>
<onDemand xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">   
	<folder name="FolderOne" searchType="Hit List">
		<field name="cost" fieldType="Decimal" >
			<fieldInfo user="SampleUser" sortOrder="2" greaterThan="Default" lessThan="Yes"/>
		</field>
	</folder>
</onDemand>

Creating Content Manager OnDemand XML files for update

When creating an XML file to be used for updating information, the syntax and layout of the file are the same as discussed in the previous section. However, there are two major differences.
  • Only the fields which are intended to be updated need to be specified.
  • Child objects might contain an additional attribute, task. The task attribute indicates the task that is performed by the child object.
Each object that you update must contain the name of the object. Any other attributes that are specified are updated to the specified value. If an object that is updated requires a change to another object, that object must be included in the XML file before the object that references it. For example, to change the user SampleUser to timeout after 10 minutes, you need to put the following XML code into an XML file.
<user name="SampleUser" timeOut="10"/>
When you specify some special characters in XML, you need to use the XML specification. For example:
Table 1. XML specification for special characters
XML code Character
&amp; &
&apos; '
&quot;
&lt; <
&gt; >
Your input file might look like this:
...
<user    
   name="DBRYANTDEU"  
   acctInfo="Engraving &amp; Printing"     
To rename some objects, you should use the newName attribute. For example, to change the name of a printer from Boston to New York, use the following XML code during an update:
<printer name="Boston" newName="NewYork"/>
Most objects might contain a set of similar child objects. To update these objects, you should use the task attribute. The task attribute can have three values:
add
Indicates that the child object should be added to the parent object. The default value for the task attribute is add. However, some child objects do not contain a task attribute. For those objects without a task attribute, the action taken for the object is the same action as the parent object.
update
This indicates that the child object already exists and should be updated with the attributes provided.
delete
This indicates that the child object already exists and should be removed from the parent object.
The task attribute is only examined during an update process. To add, update or delete a child object, the parent object must be specified, and must contain the child object to be updated. See the examples below.

The default value for the task attribute is "add". However, some child objects do not contain a task attribute. For those objects without a task attribute, the action taken for the object will be the same action as the parent object.

If an object that is updated requires a change to another object, that object must be included in the XML file before the object that references it.

Additional examples

To add a permission for the user SampleUser to the folder FolderOne, the following code could be used during an update:
<folder name="FolderOne">
<permission user="SampleUser" adminAuthority="Yes" maxHits="No Limit" />
</folder>
To remove the admin authority permission from SampleUser on the folder FolderOne, you need to update the permission child. The following code is an example:
<folder name="FolderOne">
<permission task="update" user="SampleUser" adminAuthority="No" />
</folder>
To remove the SampleUser permission from the folder, you need to delete the permission child.
<folder name="FolderOne">
<permission task="delete" user="SampleUser"/>
</folder>

Creating Content Manager OnDemand XML files for delete and export

When creating a Content Manager OnDemand XML file to be used to export or delete objects, the syntax and layout of the file is the same as discussed above, however there are two major differences:
  • The only attribute field which is examined is the name field.
  • All child objects are ignored.

When you export or delete objects, the only information that is required is the name of the object(s). Other attributes might be present in the XML file, but they are ignored. Child objects cannot be deleted through the delete process, they can be deleted only during an update process by using the attribute task="delete".

When you specify an application for delete or export, you must also specify the name of the application group in which the application is contained.

To export the users, SampleOne, SampleTwo and SampleThree, the following Content Manager OnDemand XML file can be used during an export:
<?xml version="1.0" encoding="UTF-8"?>
<onDemand xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<user name="SampleOne"/>
<user name="SampleTwo"/>
<user name="SampleThree"/>
</onDemand>
To delete the printer, OldPrinter, and the folder, MyFolder, use the following XML code:
<printer name="OldPrinter"/>
<folder name="MyFolder"/>
To delete all defined printers, export all the printers by using the following XML code and command:
<printer name="_ALL"/>

arsxml export -h <host> -u <uid> -p <password> -i input.xml -o 
allprinters.xml
Then use the output from this command to feed the delete command:
arsxml delete -h <host> -u <uid> -p <password> -i allprinters.xml

When you specify an application for delete or export, the name of the application group in which it is contained must also be specified.

Application Index Parameter Object

The indexParm child object of the application object has a slightly different syntax than all other objects. Due to the nature of the data associated with the Index Parameters it is not appropriate to use an object attribute to specify this information. Therefore, for this object (and only this object), the data associated with the object is simply the character data which appears between the <indexParm> and the </indexParm> flags.

For example, the following code can be used to set the index parameters associated with the SampleApp application:
<application name="SampleApp" .... >
<indexParm>
*dummy index parameters
parm1=value;
parm2=value;
parm3=value;
</indexParm>
</application>