OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

cam message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: CAM, XSD schema, inline namespace and handling XPath - FAQ


Team,
 
A number of people out there are having to grapple with XML associated with very complex XSD schema, particularly including the use of embedded inline namespace declarations, and especially with implied default namespace declarations.
 
Basically in these situations the human is able to deduce the intended namespace, but the machine can have a hard time - and especially the jaxen XPath processor.
 
The good news is that the jCAM implementation provides the means to resolve and handle these potential conflicts and produce a consistent validation result.
 
This quick note is the FAQ "how to" cookbook - plus a production example.
 
As we all know - the CAM template contains the reference copy of the XML structure as a simple well formed XML instance model.
 
So to make this all work - you basically do the following in the CAM template (not the original source XML - it says exact as it is):
 
1) Promote up any inline namespace declarations to the top of the CAM template - remove them from the CAM structure instance.
 
2) Declare one of more default namespaces to associate with any defaulted namespace use.
 
3) Tag any elements in the structure that need to be XPath referenced - that do not have namespace prefixes - with the matching
    item you declared in 2).
 
4) The jaxen processor may still get confused resolving the inline namespaces in the source - create makeOptional() assertions
    in the CAM template <BusinessContext> section - to tell it to ignore those references.
 
5) Code up rules and validations as normal in CAM template using qualified XPath references as needed.
 
That's it!
 
Here are the links to a sample XML source and the CAM template so you can see the technique.
 
 http://drrw.net/backup/NIH/R424-398-chk.cam
 
 http://drrw.net/backup/NIH/application.xml
 
and just for comparison - the original schema is here (yes its gnarly!)
 
 http://apply.grants.gov/system/schemas/applicant/MetaGrantApplication.xsd
 
Essentially this is showing you just how powerful CAM can be when faced with solving the huge complexity involved in schemas of this type - and reducing it to a set of rules that humans can begin to grapple with - in a production environment.
 
Thanks, DW


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]