This week I've been producing XML Thesaurus files for SQL Server. The prupose is to enable spell checking in full text. The thesaurus file is an XML file wih a defined schema, I was creating the file with an XmlTextWriter but couldn't for hte life of me get it to load.

After much digging I realised the issue was that my XML file had a processing instruction in it (<?xml version="1.0" encoding="utf-16"?>), this is standard in a most XML files but unfortunately it causes full text to fail the file.

So how do you stop the the XmlTextWriter from producing the processing instruction. Its not straight forward to find out, but it is straight forward to implement. Simply you don't use the WriteStartDocument method. All this does is write the processing instruction. Pretty obvious really.


This is cross posted from my SQLBlogcasts blog which can be found here, http://sqlblogcasts.com/blogs/simons/XmlTextWriter produces processing instruction

Categories:

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Theme design by Nukeation based on Jelle Druyts