Menu

Mandatory Element in CAM Template

jcamnewbie
2009-11-09
2013-10-15
  • jcamnewbie

    jcamnewbie - 2009-11-09

    As per the default behavior in CAM, all the elements specified in the template
    are mandatory, is it possible to reverse the behavior i.e. all the elements /
    attributes are optional and mandatory check will be performed only if
    specified?

     
  • Martin Roberts

    Martin Roberts - 2009-11-10

    A simple way round this would be to add a flag to the compiling process that
    would switch the behaviour. What do you think of this?

     
  • drrwebber

    drrwebber - 2009-11-10

    Careful look at this - this seems counter intuitive - typically mandatory
    segments as defined in a schema will always be required. So if you build a
    template ingested from XSD - those will be reflected.

    I suspect you only want this behaviour to occur for certain branches of the
    structure.

    Using makeOptional() is therefore the preferred approach.

    You can use makeOptional with a global XPath reference to make child elements
    of a parent all optional - that seems a simpler solution.

     
  • jcamnewbie

    jcamnewbie - 2009-11-10

    Well there are multiple issues with this approach:

    1. Given the Schema is far too big as we are using an industry standard and we are using a fraction of the elements. Consider this .. the schema has say 100 elements and we are merely using 5 of them. Now we need to visit 95 elements to mark them as Optional.

    2. Also the CAM template becomes large leading to unnecessary processing i.e. usage of memory,, CPU etc etc.

    Compare it with this....
    Created a CAM template with only 5 fields for which validations need to be
    performed.

     
  • drrwebber

    drrwebber - 2009-11-10

    So if you are using an abbreviated version of the schema - a combination of
    datatype(any) and makeOptional() looks like the way to go.

    Remember you can prune down a big template using excludeTree() and
    excludeElement() and then running the Compress Template tool in the editor
    under the File / Export - to prune away undesired branches of the tree.

     
  • Andres O

    Andres O - 2013-10-14

    What is the difference between excludeElement() and excludeTree() when applied to a parent element?

     
    • drrwebber

      drrwebber - 2013-10-15

      Andres, actually there is no difference - as implemented they function identically.

      So - only difference is cosmetic - when you view the rules in the tabular report - for analysts to better understand the scope.

       

Log in to post a comment.