XRX/NIEM Services

From Wikibooks, open books for an open world
< XRX
Jump to: navigation, search

Motivation[edit]

You want to create a set of web services based on the National Information Exchange Model.

Process[edit]

We will import the core NIEM data as an XML Schema.

To do this first download the NIEM data model from the NIEM.gov web site. Inside the zip file you will find a niem-core directory with a niem-core.xsd file. Add this to your database and run the following XQuery on it:

Sample Code[edit]

declare namespace xs="http://www.w3.org/2001/XMLSchema";
declare option exist:serialize "method=xml media-type=text/xml indent=yes";
 
let $doc := '/db/niem/data/niem-core.xsd'
 
return
<results>{
      for $type in doc($doc)//xs:complexType
      return
          <type>{substring-before(data($type/@name), 'Type')}</type>
}</results>

This will return a list of all the NIEM complex types.

<results>
   <type>ActivityConveyanceAssociation</type>
   <type>ActivityDocumentAssociation</type>
   <type>ActivityInvolvedPersonAssociation</type>
   <type>ActivityItemAssociation</type>
   <type>ActivityOrganizationAssociation</type>
   <type>ActivityPersonAssociation</type>
   <type>ActivityScheduleAssociation</type>
   <type>Activity</type>
   <type>AddressGrid</type>
...

This XQuery can in turn be used as a web service to populate an XForms suggestion list similar to the Suggestion example in the XForms cookbook.


Back: Table SortingNext: Product Ratings