150 likes | 344 Views
Introduction to the NCIP DTDs and XML Schemas. Tony O’Brien Oct 2 nd 2002. DTD/XML Schema Basics. Linked to Implementation Profile 1 document Provide formal, unambiguous specification of NCIP message syntax Facilitate machine (& human) parsing of NCIP messages. NCIP has 4 of them!.
E N D
Introduction to the NCIP DTDs and XML Schemas Tony O’Brien Oct 2nd 2002
DTD/XML Schema Basics • Linked to Implementation Profile 1 document • Provide formal, unambiguous specification of NCIP message syntax • Facilitate machine (& human) parsing of NCIP messages
NCIP has 4 of them! • ncip_v1_0.dtd (main DTD) • ncip_v1_0.xsd (main Schema) • ncip_version.dtd (‘version’ DTD) • ncip_version.xsd (‘version’ Schema)
Main NCIP DTD • ncip_v1_0.dtd • Contains main set of 88 NCIP messages • Must be supported by NCIP conformant applications • Uses “datatype” attribute to provide XML-Schema-like type information
Main NCIP XML Schema • ncip_v1_0.xsd • Mirrors & is derived from main DTD • DTD datatype attributes converted into true XML Schema datatypes • Conformant apps do not currently need to support Schema • …but Schema will eventually replace DTD
‘Version’ DTD • ncip_version.dtd • Provides ‘NCIP versions supported’ info • Independent of main DTD • Implemented for NCIP v1.0 • ….but should remain in use as new versions of NCIP & the main DTD are developed
‘Version’ XML Schema • ncip_version.xsd • Mirrors & is derived from ‘version’ DTD
Location of DTD/Schema files • Hosted by NISO • www.niso.org/ncip/v1_0/imp1/dtd/ncip_v1_0.dtd • www.niso.org/ncip/v1_0/imp1/dtd/ncip_version.dtd • www.niso.org/ncip/v1_0/imp1/xsd/ncip_v1_0.xsd • www.niso.org/ncip/v1_0/imp1/xsd/ncip_version.xsd
Top Level Structure of main DTD & XML Schema • NCIPMessage is the root element • Consists of 1 ‘version’ attribute and 1 child element • Child element is a choice from 88 possible alternatives • 88 alternatives represent 44 initiation/response message pairs • These 44 ‘services’ can be further categorised:- • 4 ‘lookups’ eg. LookupUser/LookupUserResponse • 20 ‘updates’ eg. CheckOutItem/CheckOutItemResponse • 20 ‘notifications’ eg. ItemShipped/ItemShippedResponse
Top Level Structure of ‘Version’ DTD/Schema • NCIPVersionMessage is the root element • Consists of 1 ‘version’ element and 1 child element • Child element is a choice from 2 alternatives • Ie. A single version lookup ‘service’ • LookupVersion/LookupVersionResponse
Initiation Messages • Consist of an InitiationHeader element, followed by message-specific data • InitiationHeader contains:- • FromSystemId (s/v, optional) • FromSystemAuthentication (string, optional) • FromAgencyId (s/v, mandatory) • FromAgencyAuthentication (string, optional) • OnBehalfOfAgency (s/v, optional) • ToSystemId (s/v, optional) • ToAgencyId (s/v, mandatory) • ApplicationProfileType (s/v, optional)
Response messages • Consist of a ResponseHeader, followed by:- • For Lookup and Update Messages: A Problem element, or response-specific data • For Notification Messages: A MessagingError element, or nothing at all • ResponseHeader contains:- • FromSystemId (s/v, optional) • FromSystemAuthentication (string, optional) • FromAgencyId (s/v, mandatory) • FromAgencyAuthentication (string, optional) • ToSystemId (s/v, optional) • ToAgencyId (s/v, mandatory)
DTD/Schema data types • boolean • dateTime (ISO 8601) • integer • nonNegativeInteger • positiveInteger • string • ‘Wrapper’ elements
Enumerated Types • Scheme/Value pairs • Provides namespace for enumerations • ‘Closed’: No new lists of values may be defined in a given protocol version • Example: General Processing Error • ‘Open’: New lists of values may be defined without breaking protocol • Example: Agency User Privilege Type • Nb. In all cases, lists specified by protocol must be supported by conformant apps
Example Scheme/Value pair <AgencyUserPrivilegeType> <Scheme>http://www.niso.org/ncip/v1_0/imp1/schemes/ agencyuserprivilegetype/public.scm</Scheme> <Value>Adult</Value> </AgencyUserPrivilegeType> • Nb. A ‘Scheme’ element is always a URI • Guarantees globally unique list name • Does not guarantee presence of list at specified URI