<?xml version='1.0' encoding='utf-8' ?>

<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>The Lair of the SlowFox</title>
  <link>https://slowfox.dreamwidth.org/</link>
  <description>The Lair of the SlowFox - Dreamwidth Studios</description>
  <lastBuildDate>Thu, 07 Jan 2010 10:25:26 GMT</lastBuildDate>
  <generator>LiveJournal / Dreamwidth Studios</generator>
  <lj:journal>slowfox</lj:journal>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>https://v2.dreamwidth.org/320300/290754</url>
    <title>The Lair of the SlowFox</title>
    <link>https://slowfox.dreamwidth.org/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>https://slowfox.dreamwidth.org/89763.html</guid>
  <pubDate>Thu, 07 Jan 2010 10:25:26 GMT</pubDate>
  <title>xsd.exe and the xs:import element</title>
  <link>https://slowfox.dreamwidth.org/89763.html</link>
  <description>I have spent a largely unprofitable hour trying to work out why &lt;b&gt;xsd.exe&lt;/b&gt; couldn&apos;t parse a specific .xsd file I was presenting it with.&lt;br /&gt;&lt;br /&gt;If, for example, the parent .xsd has a namespace reference of&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;tt&gt;...xmlns:sf=&quot;&lt;a href=&quot;http://slowfox.dreamwidth.org/&quot;&gt;http://slowfox.dreamwidth.org/&lt;/a&gt;&quot;...&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;followed by an &lt;t&gt;import&lt;/t&gt; element&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;tt&gt;&amp;lt;xs:import namespace=&quot;&lt;a href=&quot;http://slowfox.dreamwidth.org/&quot;&gt;http://slowfox.dreamwidth.org/&lt;/a&gt;&quot; schemaLocation=&quot;SlowFox.xsd&quot;/&amp;gt;&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;then when running the xsd tool from the Visual Studio command prompt, you get the following error message:&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;Warning: Schema could not be validated. Class generation may fail or may produce incorrect results.&lt;/tt&gt;&lt;br /&gt;&lt;br /&gt;The answer, which I learnt courtesy of &lt;a href=&quot;http://www.hanselman.com/blog/XSDexeIsKickingMyButtManredux.aspx&quot;&gt;Scott Hanselman&lt;/a&gt;&apos;s blog is to provide all the dependent files on the command line, in addition to the parent .xsd.&lt;br /&gt;&lt;br /&gt;So you&apos;d run&lt;br /&gt;&lt;br /&gt;&lt;b&gt;xsd.exe /c MainSchemaDefinition.xsd SlowFox.xsd&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;which produces the desired result (C# classes generated automagically from the .xsd).&lt;br /&gt;&lt;br /&gt;The issue, apparently, is that the xsd tool can&apos;t handle the xs:import element (despite the fact that you&apos;ve given it an exact file name to match against the specified namespace), but if you provide all the consituent files as part of the command&apos;s argument, xsd.exe knows where to try and look for the various dependencies it stumbles across.&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=slowfox&amp;ditemid=89763&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://slowfox.dreamwidth.org/89763.html</comments>
  <category>xsd</category>
  <category>visual studio</category>
  <category>c#</category>
  <category>xml</category>
  <lj:mood>busy</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
</channel>
</rss>
