Let us take a simple example to understand how Automatic Property Extraction can be used in Documentum. We will see how an XML Application is created, how it is attached to the content file, and eventually how it works.
First_XMLApp_Template.xml)
and attach it to dm_document
object type with Default Lifecycle.Following is the Template file First_XMLApp_Template.xml
:
<?xml version="1.0" encoding="UTF-8"?> <ROOTTAG> <TITLEOFPAGE/> <SHORTDESC/> </ROOTTAG>
First_XMLApp_TemplateRule.xml)
for the template and associate the Template file with this Rules file. Following is the Rules file First_XMLApp_TemplateRule.xml:
<?xml version="1.0" encoding="UTF-8"?> <rules> <tagcontent tag_name="TITLEOFPAGE"> <textline charlength="200" instruction="Enter Title of the page" label="Page Title" required="Y"> </textline> </tagcontent> <tagcontent tag_name="SHORTDESC"> <textline charlength="200" instruction="Enter a small description/subject of the page" label="Page subject" required="Y"> </textline> </tagcontent> </rules>
a_category
attribute of the template.API>id,c,dm_document where object_name = 'First_XMLApp_Template.xml' and a_is_template = '1'
API>set,c,l,a_category
Data: FirstXMLApp
API>save,c,l
Note that 'l' shown in the API commands is an alias reference to the object ID returned when you fire a query. More on API commands in Chapter 26.
We will create the XML Application file FirstXMLApp.xml
in the next few steps.
Please note that while filling in the Category field, you must strip off the .xml
extension from the name of the XML Configuration file. If this is not done, the XML Application against the template in question will not work.
FirstXMLApp.xml
. The purpose of this XML Application will be to map the values in the <TITLEOFPAGE>
element and <SHORTDESC>
element in the Template XML file to title
and subject
attributes of the dm_document object respectively. The XML Configuration file FirstXMLApp.xml
is shown below:FirstXMLApp.xml
is shown below:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE application SYSTEM "config_5.2.dtd"> <application> <name>FirstXMLApp</name> <app_pattern> <element>ROOTTAG</element> <!-- Specifying the XML Root element--> </app_pattern> <map_rules> <xml_content_rule> <element_selection_pattern> <element>ROOTTAG</element> </element_selection_pattern> <variables> <!-- Defining variables to map values in object attribute--> <variable> <name>TitleOfPage</name> <!-- Storing the value of TITLEOFPAGE template element --> <content_of_element> <element_selection_pattern> <element>TITLEOFPAGE</element> </element_selection_pattern> </content_of_element> </variable> <variable> <name>ShortDescOfPage</name> <!-- Storing the value of SHORTDESC template element --> <content_of_element> <element_selection_pattern> <element>SHORTDESC</element> </element_selection_pattern> </content_of_element> </variable> </variables> <object_type>dm_document</object_type> <!-- Specifying the object type--> <metadata> <dctmattr> <name>title</name> <!-- Saving value in title attribute--> <template><var name="TitleOfPage"/></template> </dctmattr> <dctmattr> <name>subject</name><!-- Saving value in subject attribute--> <template><var name="ShortDescOfPage"/></template> </dctmattr> </metadata> <make_entity/> </xml_content_rule> </map_rules> </application>
Let's discuss the anatomy of the above XML configuration file:
<!DOCTYPE application SYSTEM "config_5.2.dtd">
This is the XML file prolog. Since the XML configuration is an XML document, the DTD that it will conform to is specified here. The config_5.2.dtd
file that is referenced in the XML application file can be found at the following location in Web Publisher:Cabinets | System | Applications | Default XML Application.
<application>
This is the root element of XML configuration file.
<name>FirstXMLApp</name>
This is the name of the XML Application.
<element>ROOTTAG</element>
Case-sensitive root element of the Template XML file that has to be processed via the XML Application.
<element>ROOTTAG</element>
This is the root element name of the Template XML file that has to be processed via the XML Application.
The scores of XML elements that you see in the XML configuration file are declared in the config_5.2.dtd
file.
<variable>
indicates a variable name defined and its value such as XML element name and attribute value. Here two variables have been declared: variable TitleOfPage
stores the value of the TITLEOFPAGE
XML element and variable ShortDescOfPage
stores the value of the SHORTDESC
XML element.
<object_type>dm_document</object_type>
<object_type>
specifies the Documentum object type whose attributes need to be mapped by the XML elements.
<dctmattr>
: Sets the value of a single-valued Documentum object property.
For repeating-valued Documentum object properties, use the <dctmattr_repeating>
element in your XML configuration file. We will look at a related example later in this chapter.
Choose File | New folder and create a new XML Application folder as shown in figure 18.4.
FirstXMLApp
has been created, click on it and import the XML configuration file within this folder.Before importing the XML configuration file, ensure config_5.2.dtd
and the FirstXMLApp.xml
file reside at the same location on your machine's local hard drive. Choose File | Import and select the FirstXMLApp.xml
file from your local machine as shown in figure 18.5.
dm_xml_config
, format as XML Document and XML Category as Default XML Application as shown in figure 18.6. Remember to strip off .xml
from the name while importing this configuration file.This completes the steps required for associating the XML Application with a content Template XML file.
3.145.162.114