跳轉到內容

XRX/NIEM 服務

來自華夏公益教科書
< XRX

您想要基於國家資訊交換模型建立一個 Web 服務集。

我們將匯入核心 NIEM 資料作為 XML 模式。

為此,首先從 NIEM.gov 網站下載 NIEM 資料模型。在 zip 檔案中,您將找到一個包含 niem-core.xsd 檔案的 niem-core 目錄。將其新增到您的資料庫中,並在其上執行以下 XQuery

示例程式碼

[編輯 | 編輯原始碼]
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>

這將返回所有 NIEM 複雜型別的列表。

<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>
...

這個 XQuery 可以反過來用作 Web 服務來填充與 XForms 食譜中的建議示例類似的 XForms 建議列表。


返回:表格排序下一步:產品評分

華夏公益教科書