CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: XML

Example Schema File

288 Views
Copy Code Show/Hide Line Numbers
   1:  <?xml version="1.0" encoding="UTF-8"?>
   2:  <xs:schema xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
   3:      <xs:element name="HL7v2xConformanceProfile">
   4:          <xs:annotation>
   5:              <xs:documentation>An unambiguous specification of one or more standard HL7 messages that have been analyzed for a particular use case.  It prescribes a set of precise constraints upon one or more standard HL7 messages.</xs:documentation>
   6:              <xs:appinfo>
   7:                  <sch:pattern name="Check for no optionality in Implementation profiles">
   8:                      <sch:rule context="HL7v2xConformanceProfile">
   9:                          <sch:report test="@ProfileType='Implementation' and count(HL7v2xStaticDef/descendant::*[@Usage='O'])!=0">May not have elements with a Usage of 'O' in an Implementation profile.</sch:report>
  10:                      </sch:rule>
  11:                  </sch:pattern>
  12:              </xs:appinfo>
  13:          </xs:annotation>
  14:          <xs:complexType>
  15:              <xs:sequence>
  16:                  <xs:element name="MetaData" type="MetaDataType">
  17:                      <xs:annotation>
  18:                          <xs:documentation>Provides descriptive information about the life-cycle of the HL7v2xConformanceProfile, as well as authorship and control information.</xs:documentation>
  19:                      </xs:annotation>
  20:                  </xs:element>
  21:                  <xs:element name="ImpNote" type="ImpNoteType" minOccurs="0">
  22:                      <xs:annotation>
  23:                          <xs:documentation>Implementation Notes provide a general description about how the profile is intended to be used, as well as hints on using or interpreting the profile.</xs:documentation>
  24:                      </xs:annotation>
  25:                  </xs:element>
  26:                  <xs:element name="UseCase">
  27:                      <xs:annotation>
  28:                          <xs:documentation>A use case model documents the scope and requirements for an HL7 message profile or set of message profiles.</xs:documentation>
  29:                          <xs:appinfo>
  30:                              <sch:pattern name="Check for Description or EventFlows">
  31:                                  <sch:rule context="UseCase">
  32:                                      <sch:report test="count(Purpose)=0 and count(EventFlow)=0">Must have at least a Description or EventFlows in a use-case.</sch:report>
  33:                                  </sch:rule>
  34:                              </sch:pattern>
  35:                          </xs:appinfo>
  36:                      </xs:annotation>
  37:                      <xs:complexType>
  38:                          <xs:sequence>
  39:                              <xs:element name="Purpose" type="NonEmptyStringType" minOccurs="0">
  40:                                  <xs:annotation>
  41:                                      <xs:documentation>Identifies the reason and/or objectives for the usecase</xs:documentation>
  42:                                  </xs:annotation>
  43:                              </xs:element>
  44:                              <xs:element name="Description" type="NonEmptyStringType" minOccurs="0">
  45:                                  <xs:annotation>
  46:                                      <xs:documentation>Descriptive text for the use-case.  In cases where the use-case is not broken down into component elements, this will include the complete details of the usecase.  Otherwise, it will contain a basic overview.</xs:documentation>
  47:                                  </xs:annotation>
  48:                              </xs:element>
  49:                              <xs:choice minOccurs="0" maxOccurs="unbounded">
  50:                                  <xs:element name="Actor" type="UseCaseElementType">
  51:                                      <xs:annotation>
  52:                                          <xs:documentation>Identifies and defines the entities involved in the use-case.  This includes the sending and receiving applications</xs:documentation>
  53:                                      </xs:annotation>
  54:                                  </xs:element>
  55:                                  <xs:element name="PreCondition" type="UseCaseElementType">
  56:                                      <xs:annotation>
  57:                                          <xs:documentation>Identifies a circumstance that must hold true prior to the use-case being invoked.</xs:documentation>
  58:                                      </xs:annotation>
  59:                                  </xs:element>
  60:                                  <xs:element name="PostCondition" type="UseCaseElementType">
  61:                                      <xs:annotation>
  62:                                          <xs:documentation>Identifies a circumstance that will hold true after the successful completion of the use-case.</xs:documentation>
  63:                                      </xs:annotation>
  64:                                  </xs:element>
  65:                                  <xs:element name="EventFlow" type="UseCaseElementType">
  66:                                      <xs:annotation>
  67:                                          <xs:documentation>Identifies a step within the chain of occurrences that lead to the successful completion of the use-case.  This includes the exchange of messages between applications.</xs:documentation>
  68:                                      </xs:annotation>
  69:                                  </xs:element>
  70:                                  <xs:element name="DerivedEvent" type="UseCaseElementType">
  71:                                      <xs:annotation>
  72:                                          <xs:documentation>
  73:                                              
  74:                                          </xs:documentation>
  75:                                      </xs:annotation>
  76:                                  </xs:element>
  77:                              </xs:choice>
  78:                          </xs:sequence>
  79:                      </xs:complexType>
  80:                      <xs:key name="ActorNamesUniqueInUseCase">
  81:                          <xs:selector xpath="Actor"/>
  82:                          <xs:field xpath="@Name"/>
  83:                      </xs:key>
  84:                      <xs:key name="PreConditionNamesUniqueInUseCase">
  85:                          <xs:selector xpath="PreCondition"/>
  86:                          <xs:field xpath="@Name"/>
  87:                      </xs:key>
  88:                      <xs:key name="PostConditionNamesUniqueInUseCase">
  89:                          <xs:selector xpath="PostCondition"/>
  90:                          <xs:field xpath="@Name"/>
  91:                      </xs:key>
  92:                      <xs:key name="EventFlowNamesUniqueInUseCase">
  93:                          <xs:selector xpath="EventFlow"/>
  94:                          <xs:field xpath="@Name"/>
  95:                      </xs:key>
  96:                      <xs:key name="DerivedEventNamesUniqueInUseCase">
  97:                          <xs:selector xpath="DerivedEvent"/>
  98:                          <xs:field xpath="@Name"/>
  99:                      </xs:key>
 100:                  </xs:element>
 101:                  <xs:element name="Encodings">
 102:                      <xs:annotation>
 103:                          <xs:documentation>Identifies all of the message encoding mechanisms supported by the profile.  Non-traditional encoding mechanisms may be identified if desired.</xs:documentation>
 104:                      </xs:annotation>
 105:                      <xs:complexType>
 106:                          <xs:sequence>
 107:                              <xs:element name="Encoding" maxOccurs="unbounded">
 108:                                  <xs:annotation>
 109:                                      <xs:documentation>Identifies one of the encoding mechanisms supported by the profile.</xs:documentation>
 110:                                  </xs:annotation>
 111:                                  <xs:simpleType>
 112:                                      <xs:union memberTypes="xs:NMTOKEN">
 113:                                          <xs:simpleType>
 114:                                              <xs:restriction base="xs:NMTOKEN">
 115:                                                  <xs:enumeration value="ER7"/>
 116:                                                  <xs:enumeration value="XML"/>
 117:                                              </xs:restriction>
 118:                                          </xs:simpleType>
 119:                                      </xs:union>
 120:                                  </xs:simpleType>
 121:                              </xs:element>
 122:                          </xs:sequence>
 123:                      </xs:complexType>
 124:                      <xs:key name="EncodingUniqueInEncodings">
 125:                          <xs:selector xpath="Encoding"/>
 126:                          <xs:field xpath="."/>
 127:                      </xs:key>
 128:                  </xs:element>
 129:                  <xs:sequence maxOccurs="unbounded">
 130:                      <xs:element name="DynamicDef">
 131:                          <xs:annotation>
 132:                              <xs:documentation>The dynamic definition is an interaction specification for a conversation between 2 or more systems.</xs:documentation>
 133:                              <xs:appinfo>
 134:                                  <sch:pattern name="Check QueryMode and QueryMessageType correspondence">
 135:                                      <sch:rule context="DynamicDef">
 136:                                          <sch:report test="@QueryMessageType='NonQuery' and @QueryMode">May only have a QueryMode when QueryMessageType is not 'NonQuery'.</sch:report>
 137:                                          <sch:report test="@QueryMessageType!='NonQuery' and not(@QueryMode)">Must have a QueryMode when QueryMessageType is not 'NonQuery'.</sch:report>
 138:                                      </sch:rule>
 139:                                  </sch:pattern>
 140:                              </xs:appinfo>
 141:                          </xs:annotation>
 142:                          <xs:complexType>
 143:                              <xs:attribute name="AccAck" type="AcknowledgmentType" default="NE">
 144:                                  <xs:annotation>
 145:                                      <xs:documentation>Identifies when and if HL7 'Accept' acknowledgments are required.  Allowed values are: AL (always), NE (never), SU (on success), ER (on error).  Default is 'NE'.</xs:documentation>
 146:                                  </xs:annotation>
 147:                              </xs:attribute>
 148:                              <xs:attribute name="AppAck" type="AcknowledgmentType" default="AL">
 149:                                  <xs:annotation>
 150:                                      <xs:documentation>Identifies when and if HL7 'Application' acknowledgments are required.  Allowed values are: AL (always), NE (never), SU (on success), ER (on error).  Default is 'AL'.</xs:documentation>
 151:                                  </xs:annotation>
 152:                              </xs:attribute>
 153:                              <xs:attribute name="MsgAckMode" default="Deferred">
 154:                                  <xs:annotation>
 155:                                      <xs:documentation>Identifies the type of acknowledgment expected by the sender of a message.  Allowed values are: Immediate and Deferred.  Default is Immediate.</xs:documentation>
 156:                                  </xs:annotation>
 157:                                  <xs:simpleType>
 158:                                      <xs:restriction base="xs:NMTOKEN">
 159:                                          <xs:enumeration value="Immediate"/>
 160:                                          <xs:enumeration value="Deferred"/>
 161:                                      </xs:restriction>
 162:                                  </xs:simpleType>
 163:                              </xs:attribute>
 164:                              <xs:attribute name="QueryMessageType" default="NonQuery">
 165:                                  <xs:annotation>
 166:                                      <xs:documentation>Identifies whether the message is query-related, and if so, what type of query message it is.  Allowed values are: NonQuery, Query, Response and Publish.  Default is NonQuery.
 167:                                      </xs:documentation>
 168:                                  </xs:annotation>
 169:                                  <xs:simpleType>
 170:                                      <xs:restriction base="xs:NMTOKEN">
 171:                                          <xs:enumeration value="NonQuery"/>
 172:                                          <xs:enumeration value="Query"/>
 173:                                          <xs:enumeration value="Response"/>
 174:                                          <xs:enumeration value="Publish"/>
 175:                                      </xs:restriction>
 176:                                  </xs:simpleType>
 177:                              </xs:attribute>
 178:                              <xs:attribute name="QueryMode" default="RealTime">
 179:                                  <xs:annotation>
 180:                                      <xs:documentation>Identifies the type of query being performed.  Allowed values are: Batch, RealTime or Both.</xs:documentation>
 181:                                  </xs:annotation>
 182:                                  <xs:simpleType>
 183:                                      <xs:restriction base="xs:NMTOKEN">
 184:                                          <xs:enumeration value="Batch"/>
 185:                                          <xs:enumeration value="RealTime"/>
 186:                                          <xs:enumeration value="Both"/>
 187:                                      </xs:restriction>
 188:                                  </xs:simpleType>
 189:                              </xs:attribute>
 190:                          </xs:complexType>
 191:                      </xs:element>
 192:                      <xs:choice maxOccurs="unbounded">
 193:                          <xs:element ref="HL7v2xStaticDef"/>
 194:                          <xs:element name="HL7v2xStaticDefRef">
 195:                              <xs:annotation>
 196:                                  <xs:documentation>Provides an identifier reference to the static definition for one of the messages used by the profile.</xs:documentation>
 197:                              </xs:annotation>
 198:                              <xs:complexType>
 199:                                  <xs:attribute name="Identifier" type="IdentifierType" use="required">
 200:                                      <xs:annotation>
 201:                                          <xs:documentation>The identifier for the static definition being referenced.</xs:documentation>
 202:                                      </xs:annotation>
 203:                                  </xs:attribute>
 204:                              </xs:complexType>
 205:                          </xs:element>
 206:                      </xs:choice>
 207:                  </xs:sequence>
 208:              </xs:sequence>
 209:              <xs:attribute name="HL7Version" use="required">
 210:                  <xs:annotation>
 211:                      <xs:documentation>Identifies the HL7 2.x version on which the profile is based and with which it is expected to comply.</xs:documentation>
 212:                  </xs:annotation>
 213:                  <xs:simpleType>
 214:                      <xs:union memberTypes="xs:NMTOKEN">
 215:                          <xs:simpleType>
 216:                              <xs:restriction base="xs:NMTOKEN">
 217:                                  <xs:enumeration value="2.0"/>
 218:                                  <xs:enumeration value="2.0D"/>
 219:                                  <xs:enumeration value="2.1"/>
 220:                                  <xs:enumeration value="2.2"/>
 221:                                  <xs:enumeration value="2.3"/>
 222:                                  <xs:enumeration value="2.3.1"/>
 223:                                  <xs:enumeration value="2.4"/>
 224:                                  <xs:enumeration value="2.5"/>
 225:                              </xs:restriction>
 226:                          </xs:simpleType>
 227:                      </xs:union>
 228:                  </xs:simpleType>
 229:              </xs:attribute>
 230:              <xs:attribute name="ProfileType" use="required">
 231:                  <xs:annotation>
 232:                      <xs:documentation>Categorizes the profile into one of 3 types: HL7 - represents a specific HL7 published standard (may only be submitted by the HL7 Organization); Constrainable - May contain "Optional" elements which must be further constrained in order to create implementation profiles; Implementation - Fully constrained with no optionality (reflects the behavior of a runtime system)</xs:documentation>
 233:                  </xs:annotation>
 234:                  <xs:simpleType>
 235:                      <xs:restriction base="xs:NMTOKEN">
 236:                          <xs:enumeration value="HL7"/>
 237:                          <xs:enumeration value="Implementation"/>
 238:                          <xs:enumeration value="Constrainable"/>
 239:                      </xs:restriction>
 240:                  </xs:simpleType>
 241:              </xs:attribute>
 242:              <xs:attribute name="Identiifer" type="IdentifierType">
 243:                  <xs:annotation>
 244:                      <xs:documentation>A unique identifier for this specific version of this dynamic profile.  If not specified, one will be assigned to the profile upon submission to a registry.</xs:documentation>
 245:                  </xs:annotation>
 246:              </xs:attribute>
 247:          </xs:complexType>
 248:      </xs:element>
 249:      <xs:element name="HL7v2xStaticDef">
 250:          <xs:annotation>
 251:              <xs:documentation>This represents a detailed profile of a single message.  It provides a detailed breakdown of exactly what the message may contain, including optionality and cardinality.</xs:documentation>
 252:              <xs:appinfo>
 253:                  <sch:pattern name="Check that MsgStructID is present for the appropriate versions, not present otherwise">
 254:                      <sch:rule context="HL7v2xStaticDef">
 255:                          <sch:report test="not(@MsgStructID) and not(contains('2.0;2.0D;2.1;2.2;2.3', parent::HL7v2xConformanceProfile/@HL7Version))">MsgStructID must be present for HL7 versions 2.3.1 and higher.</sch:report>
 256:                          <sch:report test="@MsgStructID and contains('2.0;2.0D;2.1;2.2;2.3', parent::HL7v2xConformanceProfile/@HL7Version)">MsgStructID must not be present for HL7 versions prior to 2.3.1</sch:report>
 257:                      </sch:rule>
 258:                  </sch:pattern>
 259:              </xs:appinfo>
 260:          </xs:annotation>
 261:          <xs:complexType>
 262:              <xs:sequence>
 263:                  <xs:element name="MetaData" type="MetaDataType" minOccurs="0">
 264:                      <xs:annotation>
 265:                          <xs:documentation>Provides descriptive information about the life-cycle of the HL7 v2x Static Definition, as well as authorship and control information.</xs:documentation>
 266:                      </xs:annotation>
 267:                  </xs:element>
 268:                  <xs:group ref="MessageGroup"/>
 269:                  <xs:element name="Segment" type="SegmentType">
 270:                      <xs:annotation>
 271:                          <xs:documentation>Documents the characteristics of a single HL7 segment within the context of a particular message or segment group.</xs:documentation>
 272:                      </xs:annotation>
 273:                  </xs:element>
 274:                  <xs:group ref="SegGroupOrSegmentGrouping" maxOccurs="unbounded"/>
 275:              </xs:sequence>
 276:              <xs:attribute name="MsgType" type="MsgTypeType" use="required">
 277:                  <xs:annotation>
 278:                      <xs:documentation>The HL7 message type code, as identified in MSH-9.1 (see HL7 Table 0076 - Message type).</xs:documentation>
 279:                  </xs:annotation>
 280:              </xs:attribute>
 281:              <xs:attribute name="EventType" type="EventTypeType" use="required">
 282:                  <xs:annotation>
 283:                      <xs:documentation>The HL7 event type code, as identified in MSH-9.2 (see HL7 Table 0003 - Event type)</xs:documentation>
 284:                  </xs:annotation>
 285:              </xs:attribute>
 286:              <xs:attribute name="MsgStructID" type="MsgStructIDType">
 287:                  <xs:annotation>
 288:                      <xs:documentation>The HL7 message structure code, as identified in MSH-9.3 (see HL7 Table 0354 - Message Structure Type). </xs:documentation>
 289:                  </xs:annotation>
 290:              </xs:attribute>
 291:              <xs:attribute name="OrderControl" type="OrderControlType">
 292:                  <xs:annotation>
 293:                      <xs:documentation>The HL7 Order control code, as identified in ORC 1 (see HL7 Table 0119 - Order Control Codes).</xs:documentation>
 294:                  </xs:annotation>
 295:              </xs:attribute>
 296:              <xs:attribute name="EventDesc" type="NonEmptyStringType" use="required">
 297:                  <xs:annotation>
 298:                      <xs:documentation>A description of the event carried by this message.</xs:documentation>
 299:                  </xs:annotation>
 300:              </xs:attribute>
 301:              <xs:attribute name="Identifier" type="IdentifierType" use="optional">
 302:                  <xs:annotation>
 303:                      <xs:documentation>A unique identifier for this specific version of this static definition.  If not specified, one will be assigned to the profile upon submission to a registry.</xs:documentation>
 304:                  </xs:annotation>
 305:              </xs:attribute>
 306:              <xs:attribute name="Role" default="Sender">
 307:                  <xs:annotation>
 308:                      <xs:documentation>Identifies whether the profile is constructed from the perspective of the message generator (Sender) or parser (Receiver).  Default is 'Sender'.</xs:documentation>
 309:                  </xs:annotation>
 310:                  <xs:simpleType>
 311:                      <xs:restriction base="xs:NMTOKEN">
 312:                          <xs:enumeration value="Sender"/>
 313:                          <xs:enumeration value="Receiver"/>
 314:                      </xs:restriction>
 315:                  </xs:simpleType>
 316:              </xs:attribute>
 317:          </xs:complexType>
 318:      </xs:element>
 319:      <xs:complexType name="UseCaseElementType">
 320:          <xs:simpleContent>
 321:              <xs:extension base="NonEmptyStringType">
 322:                  <xs:attribute name="Name" type="NonEmptyStringType" use="required">
 323:                      <xs:annotation>
 324:                          <xs:documentation>The unique name or number associated with a particular use-case element.</xs:documentation>
 325:                      </xs:annotation>
 326:                  </xs:attribute>
 327:              </xs:extension>
 328:          </xs:simpleContent>
 329:      </xs:complexType>
 330:      <xs:complexType name="MetaDataType">
 331:          <xs:attribute name="Name" type="NonEmptyStringType" use="required">
 332:              <xs:annotation>
 333:                  <xs:documentation>Provides a name that clearly and concisely defines the message exchange being profiled.</xs:documentation>
 334:              </xs:annotation>
 335:          </xs:attribute>
 336:          <xs:attribute name="OrgName" type="NonEmptyStringType" use="required">
 337:              <xs:annotation>
 338:                  <xs:documentation>Name of the organization that submitted the profile.</xs:documentation>
 339:              </xs:annotation>
 340:          </xs:attribute>
 341:          <xs:attribute name="Version" type="NonEmptyStringType" use="optional">
 342:              <xs:annotation>
 343:                  <xs:documentation>The version identifier assigned to this profile by the author.  There is no prescribed version numbering scheme.  However 'higher' versions should generally be interpreted to be more resent.</xs:documentation>
 344:              </xs:annotation>
 345:          </xs:attribute>
 346:          <xs:attribute name="Status" type="NonEmptyStringType" use="optional">
 347:              <xs:annotation>
 348:                  <xs:documentation>Status of this profile, as assigned by the author.  There is no prescribed status scheme at this time.  Possible values might include: 'Draft', 'Active', 'Superceded', 'Withdrawn'</xs:documentation>
 349:              </xs:annotation>
 350:          </xs:attribute>
 351:          <xs:attribute name="Topics" type="NonEmptyStringType" use="optional">
 352:              <xs:annotation>
 353:                  <xs:documentation>This provides a list of key-words that relate to the profile and that may be useful in profile searches.</xs:documentation>
 354:              </xs:annotation>
 355:          </xs:attribute>
 356:      </xs:complexType>
 357:      <xs:group name="SegGroupOrSegmentGrouping">
 358:          <xs:choice>
 359:              <xs:element name="SegGroup">
 360:                  <xs:annotation>
 361:                      <xs:documentation>Documents the characteristics of a grouping of HL7 segments within the context of a particular message or segment group.</xs:documentation>
 362:                  </xs:annotation>
 363:                  <xs:complexType>
 364:                      <xs:sequence>
 365:                          <xs:group ref="MessageElementsGroup"/>
 366:                          <xs:group ref="SegGroupOrSegmentGrouping" maxOccurs="unbounded"/>
 367:                      </xs:sequence>
 368:                      <xs:attribute name="Name" use="required">
 369:                          <xs:annotation>
 370:                              <xs:documentation>This is the short, formal name for the group.  It appears in the tag name when using the XML Encoding syntax.</xs:documentation>
 371:                          </xs:annotation>
 372:                          <xs:simpleType>
 373:                              <xs:restriction base="xs:NMTOKEN">
 374:                                  <xs:pattern value="([A-Z]|_)+"/>
 375:                              </xs:restriction>
 376:                          </xs:simpleType>
 377:                      </xs:attribute>
 378:                      <xs:attribute ref="LongName" use="required"/>
 379:                      <xs:attribute ref="Usage" use="required"/>
 380:                      <xs:attributeGroup ref="RepeatableElementAttributes"/>
 381:                  </xs:complexType>
 382:              </xs:element>
 383:              <xs:element name="Segment" type="SegmentType">
 384:                  <xs:annotation>
 385:                      <xs:documentation>Documents the characteristics of a single HL7 segment within the context of a particular message or segment group.</xs:documentation>
 386:                  </xs:annotation>
 387:              </xs:element>
 388:          </xs:choice>
 389:      </xs:group>
 390:      <xs:complexType name="SegmentType">
 391:          <xs:sequence>
 392:              <xs:group ref="MessageElementsGroup"/>
 393:              <xs:element name="Field" maxOccurs="unbounded">
 394:                  <xs:annotation>
 395:                      <xs:documentation>Documents the characteristics of a single HL7 field within the context of a particular message segment.</xs:documentation>
 396:                  </xs:annotation>
 397:                  <xs:complexType>
 398:                      <xs:sequence>
 399:                          <xs:group ref="LeafMessageElementsGroup"/>
 400:                          <xs:element name="Component" minOccurs="0" maxOccurs="unbounded">
 401:                              <xs:annotation>
 402:                                  <xs:documentation>Documents the characteristics of a single component within the context of a field.</xs:documentation>
 403:                              </xs:annotation>
 404:                              <xs:complexType>
 405:                                  <xs:sequence>
 406:                                      <xs:group ref="LeafMessageElementsGroup"/>
 407:                                      <xs:element name="SubComponent" minOccurs="0" maxOccurs="unbounded">
 408:                                          <xs:annotation>
 409:                                              <xs:documentation>Documents the characteristics of a single sub-component within the context of a component.</xs:documentation>
 410:                                          </xs:annotation>
 411:                                          <xs:complexType>
 412:                                              <xs:group ref="LeafMessageElementsGroup"/>
 413:                                              <xs:attributeGroup ref="LeafElementAttributes"/>
 414:                                          </xs:complexType>
 415:                                      </xs:element>
 416:                                  </xs:sequence>
 417:                                  <xs:attributeGroup ref="LeafElementAttributes"/>
 418:                              </xs:complexType>
 419:                          </xs:element>
 420:                      </xs:sequence>
 421:                      <xs:attributeGroup ref="RepeatableElementAttributes"/>
 422:                      <xs:attributeGroup ref="LeafElementAttributes"/>
 423:                      <xs:attribute name="ItemNo">
 424:                          <xs:annotation>
 425:                              <xs:documentation>The HL7-assigned item number corresponding with the semantic meaning of the field.</xs:documentation>
 426:                          </xs:annotation>
 427:                          <xs:simpleType>
 428:                              <xs:restriction base="xs:NMTOKEN">
 429:                                  <xs:pattern value="\d{5}"/>
 430:                              </xs:restriction>
 431:                          </xs:simpleType>
 432:                      </xs:attribute>
 433:                  </xs:complexType>
 434:              </xs:element>
 435:          </xs:sequence>
 436:          <xs:attribute name="Name" type="SegmentNameType" use="required">
 437:              <xs:annotation>
 438:                  <xs:documentation>This is the short, formal name for the segment.  It is used to identify the segment in both ER7 and XML encodings.</xs:documentation>
 439:              </xs:annotation>
 440:          </xs:attribute>
 441:          <xs:attribute ref="LongName"/>
 442:          <xs:attribute ref="Usage" use="required"/>
 443:          <xs:attributeGroup ref="RepeatableElementAttributes"/>
 444:      </xs:complexType>
 445:      <xs:attributeGroup name="LeafElementAttributes">
 446:          <xs:attribute name="Name" type="NonEmptyStringType" use="required">
 447:              <xs:annotation>
 448:                  <xs:documentation>The descriptive name for the field/component/sub-component</xs:documentation>
 449:              </xs:annotation>
 450:          </xs:attribute>
 451:          <xs:attribute ref="Usage" use="required"/>
 452:          <xs:attribute name="Datatype" type="DatatypeType" use="required">
 453:              <xs:annotation>
 454:                  <xs:documentation>Identifies the HL7 datatype associated with the element.</xs:documentation>
 455:              </xs:annotation>
 456:          </xs:attribute>
 457:          <xs:attribute name="Length" type="xs:positiveInteger">
 458:              <xs:annotation>
 459:                  <xs:documentation>Identifies the maximum allowed length for the content of the element.</xs:documentation>
 460:              </xs:annotation>
 461:          </xs:attribute>
 462:          <xs:attribute name="Table" type="TableType">
 463:              <xs:annotation>
 464:                  <xs:documentation>Identifies the name of the table associated with the content of this element.</xs:documentation>
 465:              </xs:annotation>
 466:          </xs:attribute>
 467:          <xs:attribute name="ConstantValue" type="NonEmptyStringType">
 468:              <xs:annotation>
 469:                  <xs:documentation>Identifies the fixed value associated with this element</xs:documentation>
 470:                  <xs:appinfo>
 471:                      <sch:pattern name="Check that ConstantValues only occur at leaf elements">
 472:                          <sch:rule context="*[@ConstantValue]">
 473:                              <sch:report test="count(Component|SubComponent)!=0">ConstantValues may only be specified for items with no components or sub-components.</sch:report>
 474:                          </sch:rule>
 475:                      </sch:pattern>
 476:                  </xs:appinfo>
 477:              </xs:annotation>
 478:              <!-- Can only have constant values for leaf elements -->
 479:          </xs:attribute>
 480:      </xs:attributeGroup>
 481:      <xs:attributeGroup name="RepeatableElementAttributes">
 482:          <xs:attribute name="Min" type="xs:nonNegativeInteger" use="required">
 483:              <xs:annotation>
 484:                  <xs:documentation>This identifies the minimum number of repetitions of the element that are permitted in a message instance.  This attribute should only be specified if the minimum number of repetitions is greater than 1, as the minimum for other elements is always '0'.</xs:documentation>
 485:              </xs:annotation>
 486:          </xs:attribute>
 487:          <xs:attribute name="Max" use="required">
 488:              <xs:annotation>
 489:                  <xs:documentation>This identifies the maximum number of repetitions of the element that are permitted in a message instance.  This attribute should only be specified if the maximum number of repetitions is greater than 1 and differs from the minimum attribute (i.e. the maximum number of repetitions is greater than the minimum number of repetitions).  The special value '*' may be used to represent 'unlimited' repetitions.</xs:documentation>
 490:                  <xs:appinfo>
 491:                      <sch:pattern name="Check that Max is greater than or equal to Min">
 492:                          <sch:rule context="*[@Max]">
 493:                              <sch:report test="@Min and @Max!='*' and @Min&gt;@Max">Min may not be greater than Max.</sch:report>
 494:                          </sch:rule>
 495:                      </sch:pattern>
 496:                  </xs:appinfo>
 497:              </xs:annotation>
 498:              <xs:simpleType>
 499:                  <xs:union>
 500:                      <xs:simpleType>
 501:                          <xs:restriction base="xs:positiveInteger">
 502:                              <xs:minInclusive value="1"/>
 503:                          </xs:restriction>
 504:                      </xs:simpleType>
 505:                      <xs:simpleType>
 506:                          <xs:restriction base="xs:string">
 507:                              <xs:enumeration value="*"/>
 508:                          </xs:restriction>
 509:                      </xs:simpleType>
 510:                  </xs:union>
 511:              </xs:simpleType>
 512:          </xs:attribute>
 513:      </xs:attributeGroup>
 514:      <xs:simpleType name="ImpNoteType">
 515:          <xs:restriction base="NonEmptyStringType"/>
 516:      </xs:simpleType>
 517:      <xs:group name="MessageGroup">
 518:          <xs:sequence>
 519:              <xs:element name="ImpNote" type="ImpNoteType" minOccurs="0">
 520:                  <xs:annotation>
 521:                      <xs:documentation>Implementation Notes provide a general description about how the element is intended to be used, as well as hints on using or interpreting the it.</xs:documentation>
 522:                  </xs:annotation>
 523:              </xs:element>
 524:              <xs:element name="Description" type="NonEmptyStringType" minOccurs="0">
 525:                  <xs:annotation>
 526:                      <xs:documentation>Provides an explanation or definition of what the element represents.</xs:documentation>
 527:                  </xs:annotation>
 528:              </xs:element>
 529:              <xs:element name="Reference" minOccurs="0">
 530:                  <xs:annotation>
 531:                      <xs:documentation>Identifies external sources or other locations within the profile where additional information can be found about this item.</xs:documentation>
 532:                  </xs:annotation>
 533:                  <xs:simpleType>
 534:                      <xs:restriction base="NonEmptyStringType"/>
 535:                  </xs:simpleType>
 536:              </xs:element>
 537:          </xs:sequence>
 538:      </xs:group>
 539:      <xs:group name="MessageElementsGroup">
 540:          <xs:sequence>
 541:              <xs:group ref="MessageGroup"/>
 542:              <xs:element name="Predicate" minOccurs="0">
 543:                  <xs:annotation>
 544:                      <xs:documentation>Identifies the conditionality rule for this element, if applicable</xs:documentation>
 545:                      <xs:appinfo>
 546:                          <sch:pattern name="Check that predicates only occur for conditional items">
 547:                              <sch:rule context="Predicate">
 548:                                  <sch:report test="parent::*/@Usage!='C' and parent::*/@Usage!='CE'">May not have a Predicate unless the Usage is 'C' or 'CE'.</sch:report>
 549:                              </sch:rule>
 550:                          </sch:pattern>
 551:                      </xs:appinfo>
 552:                  </xs:annotation>
 553:                  <xs:simpleType>
 554:                      <xs:restriction base="NonEmptyStringType"/>
 555:                  </xs:simpleType>
 556:              </xs:element>
 557:          </xs:sequence>
 558:      </xs:group>
 559:      <xs:group name="LeafMessageElementsGroup">
 560:          <xs:sequence>
 561:              <xs:group ref="MessageElementsGroup"/>
 562:              <xs:element name="DataValues" minOccurs="0" maxOccurs="unbounded">
 563:                  <xs:annotation>
 564:                      <xs:documentation>Provides a list of possible example values for the element.</xs:documentation>
 565:                      <xs:appinfo>
 566:                          <sch:pattern name="Check that DataValues only occur at leaf elements">
 567:                              <sch:rule context="DataValues">
 568:                                  <sch:report test="count(parent::*/*[self::Component or self::SubComponent])!=0">DataValues may only be specified for items with no components or sub-components.</sch:report>
 569:                              </sch:rule>
 570:                          </sch:pattern>
 571:                      </xs:appinfo>
 572:                  </xs:annotation>
 573:                  <xs:complexType>
 574:                      <xs:attribute name="ExValue" type="NonEmptyStringType">
 575:                          <xs:annotation>
 576:                              <xs:documentation>Identifies an individual example value.</xs:documentation>
 577:                          </xs:annotation>
 578:                      </xs:attribute>
 579:                  </xs:complexType>
 580:              </xs:element>
 581:          </xs:sequence>
 582:      </xs:group>
 583:      <xs:attribute name="Usage">
 584:          <xs:annotation>
 585:              <xs:documentation>Usage identifies the circumstances under which an element appears in a message.  Possible values are: 
 586:                  R - Required (must always be present); 
 587:                  RE - Required or Empty (must be present if available); 
 588:                  O - Optional (no guidance on when the element should appear); 
 589:                  C - Conditional (the element is required or allowed to be present when the condition specified in the Predicate element is true);
 590:                  CE - Conditional or Empty (the element is required or allowed to be present when the condition specified in the Predicate element is true and the information is available)
 591:                  X - Not supported (the element will not be sent)
 592:              </xs:documentation>
 593:              <xs:appinfo>
 594:                  <sch:pattern name="Check that all conditional items have predicates">
 595:                      <sch:rule context="*[@Usage='C' or @Usage='CE']">
 596:                          <sch:report test="count(Predicate)=0">Must have a Predicate when Usage is 'C' or 'CE'.</sch:report>
 597:                      </sch:rule>
 598:                  </sch:pattern>
 599:                  <sch:pattern name="Check that all non-leaf elements with a Usage other than 'Not Supported' have supported children">
 600:                      <sch:rule context="*[@Usage!='X' and count(Component|SubComponent)!=0]">
 601:                          <sch:report test="count(child::*[self::Component or self::SubComponent][@Usage!='X'])=0">Must have at least one supported Component or Sub-Component (Usage not 'X') when element is marked as supported.</sch:report>
 602:                      </sch:rule>
 603:                  </sch:pattern>
 604:              </xs:appinfo>
 605:          </xs:annotation>
 606:          <xs:simpleType>
 607:              <xs:restriction base="xs:NMTOKEN">
 608:                  <xs:enumeration value="R"/>
 609:                  <xs:enumeration value="RE"/>
 610:                  <xs:enumeration value="O"/>
 611:                  <xs:enumeration value="C"/>
 612:                  <xs:enumeration value="CE"/>
 613:                  <xs:enumeration value="X"/>
 614:              </xs:restriction>
 615:          </xs:simpleType>
 616:      </xs:attribute>
 617:      <xs:attribute name="LongName" type="NonEmptyStringType">
 618:          <xs:annotation>
 619:              <xs:documentation>This is the descriptive name for the element.  It does not appear in any encodings.</xs:documentation>
 620:          </xs:annotation>
 621:      </xs:attribute>
 622:      <xs:simpleType name="NonEmptyStringType">
 623:          <xs:restriction base="xs:string">
 624:              <xs:minLength value="1"/>
 625:          </xs:restriction>
 626:      </xs:simpleType>
 627:      <xs:simpleType name="AcknowledgmentType">
 628:          <xs:restriction base="xs:NMTOKEN">
 629:              <xs:enumeration value="AL"/>
 630:              <xs:enumeration value="NE"/>
 631:              <xs:enumeration value="SU"/>
 632:              <xs:enumeration value="ER"/>
 633:          </xs:restriction>
 634:      </xs:simpleType>
 635:      <xs:simpleType name="IdentifierType">
 636:          <xs:restriction base="xs:NMTOKEN">
 637:              <xs:pattern value="(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*"/>
 638:          </xs:restriction>
 639:      </xs:simpleType>
 640:      <xs:simpleType name="MsgTypeType">
 641:          <xs:restriction base="xs:NMTOKEN">
 642:              <xs:pattern value="[A-Z0-9]{3}"/>
 643:          </xs:restriction>
 644:      </xs:simpleType>
 645:      <xs:simpleType name="EventTypeType">
 646:          <xs:restriction base="xs:NMTOKEN">
 647:              <xs:pattern value="[A-Z0-9]{3}"/>
 648:          </xs:restriction>
 649:      </xs:simpleType>
 650:      <xs:simpleType name="MsgStructIDType">
 651:          <xs:restriction base="xs:NMTOKEN">
 652:              <xs:pattern value="[A-Z0-9]{3}(_[A-Z0-9]{3})?"/>
 653:          </xs:restriction>
 654:      </xs:simpleType>
 655:      <xs:simpleType name="OrderControlType">
 656:          <xs:restriction base="xs:NMTOKEN">
 657:              <xs:pattern value="[A-Z]{2}"/>
 658:          </xs:restriction>
 659:      </xs:simpleType>
 660:      <xs:simpleType name="DatatypeType">
 661:          <xs:restriction base="xs:NMTOKEN">
 662:              <xs:minLength value="1"/>
 663:          </xs:restriction>
 664:      </xs:simpleType>
 665:      <xs:simpleType name="SegmentNameType">
 666:          <xs:restriction base="xs:NMTOKEN">
 667:              <xs:pattern value="[A-Z][A-Z0-9]{2}"/>
 668:          </xs:restriction>
 669:      </xs:simpleType>
 670:      <xs:simpleType name="TableType">
 671:          <xs:restriction base="xs:NMTOKEN">
 672:              <xs:minLength value="1"/>
 673:          </xs:restriction>
 674:      </xs:simpleType>
 675:  </xs:schema>
by Richard Kavanagh
  March 05, 2010 @ 9:35am
Tags:

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate