← Prev in month ← Prev in thread
Next in thread → Next in month →

[FWD: [cam] CAM, XSD schema, inline namespace and handling XPath - FAQ]

From
David RR Webber \(XML\) <>
Date
2005-12-15T01:13:10+00:00
ID
Thread
[FWD: [cam] CAM, XSD schema, inline namespace and handling XPath - FAQ]
FYI,

 

DW

-------- Original Message --------
Subject:
[cam] CAM, XSD schema, inline namespace and handling XPath
-
FAQ
From: "David RR Webber (XML)"
<>
Date: Wed, December 14, 2005 8:03 pm
To:


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
---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that
generates this mail. You may a link to this group and all your TCs in
OASIS at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php
← Prev in month ← Prev in thread
Next in thread → Next in month →