Article

coolguys's picture
article
Reads:

3093

Score:
2.5
2.5
2
 
Comments:

0

Checking for Blank Attributes in DirXML

(View Disclaimer)

Problem

A Forum reader recently asked:

"I'm trying to configure an Xml policy (DirXML 2.0.2) to check for blank attributes (workforceID) and veto the operation if blanks are found. The first rule checks if the attribute is even available, then creates a local variable for it. The next rule is: if local variable "test" match ".+" then continue, but the driver doesn't seem to understand ".+" - which I took from another sample policy. How can I identify if an attribute (this one happens to be numeric) is blank?"

And here's the response from Father Ramon ...

Solution

A regular expression match of ".+" should work. I would think what you are looking for is something more like this:

<rule>
  <conditions>
   <or>
    <if-op-attr name="workforceID" op="not-available"/>
    <if-op-attr name="workforceID" op="equal"/>
   </or>
  </conditions>
  <actions>
   <do-veto/>
  </actions>
</rule>

This is assuming that what you want to do is veto if the workforceID is missing or present, but equal to blank. If what you want to do is only veto if it is present and blank, remove the first condition.


Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

© 2013 Novell