in

SQLServerCentral.com

The largest free SQL Server community.

Pro SQL Server XML

SQL Server + XML Development Tutorials, Tips, and Tricks

June 2008 - Posts

  • XML Puzzle Contest Winners

    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!

Copyright Red Gate Software
Powered by Community Server (Commercial Edition), by Telligent Systems