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
- From: "David RR Webber \(XML\)" <david@drrw.info>
- To: cam@lists.oasis-open.org
- Date: Wed, 14 Dec 2005 18:03:20 -0700
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.
and just for comparison - the original schema is here (yes its
gnarly!)
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]