Sun IDM: XML Object Language

 

Intro

* Often used in forms
– especially a list of allowed values for Select or MultiSelect fields
* Can also be used in workflows and rules
* For example:

<Field name='global.state'>
    <Display class='Select'>
       <Property name='title' value='State'/>
       <Property name='allowedValues'>
         <List>
            <String>Alabama</String>
            <String>Alaska</String>
            <String>Arizona</String>
            <String>Arkansas</String>
            <String>California</String>
            <String>Washington</String>
            <String>Washington D.C.</String>
            <String>West Virginia</String>
            <String>Wisconsin</String>
            <String>Wyoming</String>
         </List>
       </Property>
    </Display>
</Field>

Compared to XPRESS

* Static, not evaluated, hence more efficient

<String>cat</String> 
vs: 
<s>cat</s>
<Integer>10</Integer> 
vs: 
<i>10</i>
 <Boolean>true</Boolean>
 <Boolean>false</Boolean 
vs:
 <i>1</i>
 <i>0</i>
<null/> 
vs: 
<null/>
<Map>
<MapEntry key='name' value='neko'/>
<MapEntry key='ID' value='123'/>
</Map> 
vs:
<map>
<s>name</s>
<s>neko</s>
<s>ID</s>
<i>123</i>
</map>
<List>
<String>cat</String>
<String>dog</String>
<integer>673</Integer>
</List> 
vs:
<list>
<s>cat</s>
<s>dog</s>
<i>673</i>
</list>
<Long>123456789</Long> 
vs: N/A
<Date>20020911 09:15:00</Date> 
vs: 
N/A

Using XML Objects in XPRESS

* You can use XML objects within XPRESS anywhere an expression is allowed. In the example below, a map is passed as an argument to an invoked method:

<invoke name='printTheMap'>
    <ref>mapPrinter</ref>
       <Map>
       </Map>
</invoke>

Example 1, using both types of syntax

<Form>
    <Field name='department'>
      <Display class='Select'>
        <Property name='allowedValues'>
          <List>
           <String>Engineering</String>
           <String>Marketing</String>
           <String>Sales</String>
          </List>
        </Property>
      </Display>
    </Field>
 
    <Field name='department2'>
      <Display class='Select'>
        <Property name='allowedValues'>
          <expression>
            <list>
              <s>Engineering</s>
              <s>Marketing</s>
              <s>Sales</s>
            </list>
          </expression>
        </Property>
      </Display>
    </Field>
</Form>

Example 2: Using XML Object Syntax to Map Objects

<Map>
   <MapEntry key='name' value='Jeff'/>
   <MapEntry key='phone' value='338-1818'/>
</Map>

vs:

<map>
   <s>name</s>
   <s>Jeff</s>
   <s>phone</s>
   <s>338-1818</s>
</map>

References

* Chapter 6 XML Object Language

This entry was posted in SunIDM and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.