Paul Ulvinius Blog

From one developer to another

Issue with HR-XML schema in SQL Server 2005

Posted by paululvinius on November 23, 2007

We are developing a HR-software which stores its data as HR-XML (the Candidate schema) directly in a database table using SQL Server 2005. The XML-column is typed to the schema so that we get schema validation and data type storing optimization. In our tests everything runs fast, especially with the XML-indexes the database provides. The only issue we have encountered is that the XML schema has some string patterns which SQL Server also warns us about:
Warning: Type ‘’ is restricted by a facet ‘pattern’ that may impede full round-tripping of instances of this type.

The problem lies in the HR-XML type “LocalDateType”, which isn’t compatible with SQL server 2005 since it forces you to follow the pattern “\d\d\d\d-\d\d-\d\d”. SQL Server 2005 doesn’t allow this because there is no “Z”-postfix decorating the date. In SQL Server 2005, values of type xs:datetime, xs:date, and xs:time must be specified in ISO 8601 format and include a time zone (, chapter: “Using xs:datetime, xs:date, and xs:time”).
E.g. the element:

“Candidate/CandidateProfile/PersonalData/PersonDescriptors/BiologicalDescriptors/DateOfBirth” is defined with the type LocalDateNkNaType which in turn refers to the types “LocalDateType NotKnownLiteral NotApplicableLiteral”. The only usable choice here is obviously LocalDateType, which is not supported by SQL Server 2005. We chose to store DateOfBirth somewhere else, in favor of altering the schema. Its tempting to just add that ‘Z’ in the HR-XML schema, but being 99.99% compatible is just annoying.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: