SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Pro SQL Server XML

Add to Technorati Favorites Add to Google
 

XML Puzzle Contest Winners

By Michael Coles in Pro SQL Server XML | 06-20-2008 7:18 PM | Categories: Filed under: , , , ,
Rating: (not yet rated) |  Discuss | 3,921 Reads | 265 Reads in Last 30 Days |no comments

In the last entry I promised to share the answer to the XML puzzle today.  Here's a quick recap of the question -

SQL 2005 BOL gives the following example of a full-text search XML thesaurus file:

<XML ID="Microsoft Search Thesaurus">
  <thesaurus xmlns="x-schema:tsSchema.xml">
    <diacritics = false/>
    <expansion>
      <sub>Internet Explorer</sub>
      <sub>IE</sub>
      <sub>IE5</sub>
    </expansion>
    <replacement>
      <pat>NT5</pat>
      <pat>W2K</pat>
      <sub>Windows 2000</sub>
    </replacement>
    <expansion>
      <sub>run</sub>
      <sub>jog</sub>
    </expansion>
  </thesaurus>
</XML>
 

According to the XML 1.0 Recommendation what are two things that are wrong with this file?

I said there were two things wrong with this XML document, but in fact I accepted any combination of any two of the following three issues:

  1. <diacritics = false> is an XML tag that attempts to assign the value "false" directly to the XML tag; there's no attribute.
  2. Also in the <diacritics = false> tag there are no quotes (single or double) around the value "false".  This would cause any standard XML parser to throw an exception.
  3. The last issue is not as obvious, and won't necessarily cause most currently available XML parsers to error out. According to the standard, element names cannot begin with the string 'xml' or any combination of letters that match the regular expression (('X'|'x') ('M'|'m') ('L'|'l')).  Tag names that start with 'xml' are reserved for future use by the standard.  This means you can't have an element named 'xml', 'Xml', or 'XML'; the root element of this example document is named 'XML'.

I received several correct answers, but had to limit the contest to two correct answers selected at random: Darshan Singh and Saggi Neumann will both be receiving copies of the Apress book Pro SQL Server 2008 XML.  Thanks to everyone who participated, and congratulations to the winners!

Comments
There are no comments on this post
Leave a Comment
Only members of SQLServerCentral may leave comments. Register now for your free account or Sign-In if you are already a member.