Sun Identity Manager 8.1 Resources Reference


The following example reads the first 19 characters of a line, trims extraneous white space, and assigns the string as the value to the USERID resource attribute. It then skips forward five spaces and extracts the NAME resource attribute. This attribute has a maximum of 21 characters, and white space is trimmed. The sample checks for the string “Phone number: “. A telephone number will be parsed out and assigned to the PHONE resource attribute. The phone number begins after the space in “Phone number: “ and ends at the next space encountered. The trailing space is trimmed.

<AttrParse name=’Example AttrParse’>
   <str name=’USERID’ trim=’true’ len=’19’/>
   <skip len=’5’/>
   <str name=’NAME’ trim=’true’ len=’21’/>
   <t offset=’-1’>Phone number: </t>
   <str name=’PHONE’ trim=’true’ term=’ ’/>

The following strings satisfy the Example AttrParse grammar. (The· symbols represent spaces.)


In the first case after parsing, the user attribute map would contain:

USERID=“gwashington123”, NAME=“George Washington”, PHONE=“123-1234”

Similarly, the second user attribute map would contain:

USERID=”alincoln”, NAME=”Abraham Lincoln”, PHONE=“321-4321”

The rest of the text is ignored.