title: C# XDocument.Parse - Invalid namespace declaration
body: <p>I'm getting an invalid namespace declaration error in some C# code that I'm using inside of an SSIS Script Transformation Component and it has me stumped. The code is as follows:</p>
  
  <pre><code>string xml = Row.RejectReason;
  XDocument xDoc = XDocument.Parse(xml);
  XNamespace tns = "http://sbr.gov.au/comn/event.02.data";
  </code></pre>
  
  <p>When using the above code in SSIS it errors out when trying to parse the XML (possibly because of whitespace), but if I use the same code in a console application it works fine. The only difference being how I declare the value of the xml string:</p>
  
  <pre><code>string xml = @"&lt;tns:Event xmlns:tns=""http://sbr.gov.au/comn/event.02.data""&gt;&lt;tns:MaximumSeverity.Code&gt;Error&lt;/tns:MaximumSeverity.Code&gt;&lt;tns:EventItems&gt;&lt;tns:EventItem&gt;&lt;tns:Error.Code&gt;MAAS.SUBMIT.REQ.UNAUTHORISEDABN&lt;/tns:Error.Code&gt;&lt;tns:Severity.Code&gt;Error&lt;/tns:Severity.Code&gt;&lt;tns:Short.Description&gt;Short desc&lt;/tns:Short.Description&gt;&lt;tns:Detailed.Description&gt;Detailed desc&lt;/tns:Detailed.Description&gt;&lt;tns:Parameters&gt;&lt;/tns:Parameters&gt;&lt;/tns:EventItem&gt;&lt;/tns:EventItems&gt;&lt;/tns:Event&gt;";
  </code></pre>
  
  <p>I've checked the XML string it's trying to pass and I can't see any issue or differences as to why it is failing.</p>
  
  <p>Any help would be greatly appreciated.</p>