You are here: Popular Formats > XML (Extensible Markup Language) Reader/Writer > xfMap > Reading the Input XML Document > Limiting Mapping Rule Activation with Except Expressions

Limiting mapping rule activation with except expressions.

A mapping rule can have one or moreexcept expression. The syntax forexcept expressionsin theelement’sexceptattribute is identical to match expressions, i.e:

(ancestorElement/)*element([booleanExpr])?
[(ancestorElement/)*element([booleanExpr])?]*

的除了expressions are evaluated in order and a mapping ruleR fails to match an element Eif any of theexcept expressions在映射规则matcheselementE.

For example, consider the following rule XML file and mapping rule fragments:

   ...  ...  ...  ...  Tristan Read m 40   Danielle Read f 43   Grifffen Read M 12  

Then the following mapping rule would match only the children and parents:

 ...matches all family members except the grandparents 

This is quite useful when it is easier/briefer to define a match set negatively (everything but ...) rather than positively (the match is a, or b, or c, or d, ...).