This page is part of the FHIR Specification (v0.11: DSTU 1 Ballot 3). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4 R3 R2

XML 1.10.4.1

The XML syntax is closely based on XML notation:

 <name xmlns="http://hl7.org/fhir" (attrA="value")> 
   <nameA><!-- 1..1 type description of content  --><nameA>
   <nameB[x]><!-- 0..1 type1|type1 description  --></nameB>
   <nameC> <!--  1..* -->
     <nameD ><!-- 1..1 type>Relevant records  --></nameD>
   </nameC>
 <name>

Notes:

When represented as XML, resources may be validated by schema and schematron (see below), but operational systems are not required to do so (though the XML must always be valid against this specification and the schema and Schematron).

Atom Bundle Representation 1.10.4.1.1

In XML bundles are represented using an Atom format (http://tools.ietf.org/html/rfc4287), following this template:

<feed xmlns="http://www.w3.org/2005/Atom">
  <title><!-- 1..1 string Text statement of purpose --></title>
  <id><!-- 1..1 uri Unique URI for this bundle --></id>
  <link rel="self" href="[building application url (Service base on REST)]"/><!-- 0..1 -->
  <link rel="first" href="[paging: url for first page of result]"/><!-- 0..1 -->
  <link rel="previous" href="[paging: url for previous page of result]"/><!-- 0..1 -->
  <link rel="next" href="[paging: url for next page of result]"/><!-- 0..1 -->
  <link rel="last" href="[paging: url for last page of result]"/><!-- 0..1 -->
  <os:totalResults xmlns:os="http://a9.com/-/spec/opensearch/1.1/"/><!-- 0..1 integer 
              Paging: the total number of results --></os:totalResults>
  <updated><!-- 1..1 instant When the bundle was built --></updated>
  <author><!-- 0..1 Who created resource? -->
      <name><!-- 1..1 string Name of Human or Device that authored the resource --></name>
      <uri><!-- 0..1 uri Link to the resource for the author --></uri>
  </author>
  <entry><!-- Zero+ -->
    <title><!-- 1..1 string Text summary of resource content --></title>
    <id><!-- 1..1 uri Logical Id (URI) for this resource --></id>
    <link rel="self" href="Version Specific reference to Resource"><!-- 0..1 --></link>
    <updated><!-- 1..1 instant Last Updated for resource --></updated>
    <published><!-- 0..1 instant Time resource copied into the feed --></published>
    <author><!-- 0..1 Who created resource? -->
      <name><!-- 1..1 string Name of Human or Device that authored the resource --></name>
      <uri><!-- 0..1 uri Link to the resource for the author --></uri>
    </author>    
    <!-- Tags affixed to the resource (0..*):   --> 
    <category term="[Tag URI]" label="[Tag Label]" scheme="http://hl7.org/fhir/tag"/> 
    <content type="text/xml"><!-- 1..1 -->
      <[ResourceName] xmlns="http://hl7.org/fhir">
        <!-- Content for the resource -->
      </[ResourceName]>
    </content>
    <summary type="xhtml"><!-- 0..1 -->
      <div xmlns="http://www.w3.org/1999/xhtml"><!-- Narrative from resource --></div>
    </summary>
  </entry>
  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
    <!-- 0..1 Enveloped Digital Signature (see Atom section 5.1) -->
  </Signature>
</feed>

Notes 1.10.4.1.1.1

Bundling versions - deletion 1.10.4.1.1.2

When returning a set of resources or versions of a resource, an entry might indicate that the entry has been deleted. Deleted resources are represented in an atom feed as defined by rfc6721.txt:

<feed xmlns="http://www.w3.org/2005/Atom">
  ... feed elements and other entries ...
  <at:deleted-entry xmlns:at="http://purl.org/atompub/tombstones/1.0"
      ref="[Logical Id for deleted resource]" when="instant [when deleted]">
    <link rel="self" href="[Version Specific reference to Resource]"><!-- 0..1 --></link>
  </at:deleted-entry>
  ... other entries ...

A deleted resource returns a 410 error if it is accessed through the RESTful interface.

Implementation Notes 1.10.4.1

Binary Resources 1.10.4.1.0.1

There are situations where it is useful or required to handle pure binary content as resources. Typically, this is when the binary content is referred to from other FHIR Resources. The resource can contain any content, whether text, image, pdf, zip archive, etc. These resources are served in their native form on the rest interface, but can also be represented in XML or JSON, such as when including these resources in a bundle (used when it is convenient to include these in the feed directly rather than leaving them by reference).

When binary resources is represented as XML, it is represented as base64 encoded content along with a content-type, which is the mime-type as it would be specified in HTTP:

 <Binary xmlns="http://hl7.org/fhir" contentType="[mime type]">
   [Base64 Content]
 </Binary>

Binary resources can also be embedded as contained resources. If there's a desire to capture metadata about a binary object, an appropriate resource type must be used such as DocumentReference or Media.

XML Schema and Schematron 1.10.4.1

This specification provides schema definitions for all of the content models described here. The base schema is called "fhir-base.xsd" and defines all of the datatypes and also the base infrastructure types described on this page. In addition, there is a schema for each resource and a common schema fhir-all.xsd that includes all the resource schemas. A customized atom schema fhir-atom.xsd is provided for validating bundles.

In addition to the w3c schema files, this specification also provides Schematron files that enforce the various constraints defined for the datatypes and resources. These are packaged as files for each resource as well as a combined fhir-atom.sch file that incorporates the rules for all resources.

XML that is exchanged must be valid against the w3c schema and Schematron, nor is being valid against the schema and Schematron sufficient to be a conformant instance. (This specification makes several rules that cannot be checked by either mechanism.) Exchanged content must not specify the schema or even the schema instance namespace in the resource itself.

On This Page: