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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well there are multiple issues with this approach:
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.
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
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?
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.
Well there are multiple issues with this approach:
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.
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.
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.
What is the difference between excludeElement() and excludeTree() when applied to a parent element?
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.