<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to write spatial query results into XML files? in ArcGIS API for Silverlight Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73393#M1797</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just asked my friend, at least the logic is right. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have already used the xsd file to generate a cs file through command prompt. This cs file is the schema of XML file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The command is "xsd /classes /language:CS XSDSchemaFile.xsd"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there any suggestions on how to use this cs file to write the results from a collection into XML file? Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Nov 2010 14:21:13 GMT</pubDate>
    <dc:creator>DanDong</dc:creator>
    <dc:date>2010-11-15T14:21:13Z</dc:date>
    <item>
      <title>How to write spatial query results into XML files?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73392#M1796</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I work on my prj with VS2010 C#and ArcGIS silverlight API 2.0. Right now I have get results from spatial query and I want to write the results to XML files. And I have been given the xsd files about the format of these XML files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am a rookie here, so I am not sure whether my understanding is right or not.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;First, I think I should use the xsd file to generate a class that corresponds to the specified schema in the C# language, and saves it as XXXXX.cs in the current directory.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But...I can't fine the xsd.exe in VS2010, does anybody know where it is? and how can put a command to generate a class from the XSD file?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then if I want to write the results into XML file by using the schema provided by xsd file, what should I do?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am really a new here. So I guess my questions are stupid. &lt;span class="lia-unicode-emoji" title=":face_with_tongue:"&gt;😛&lt;/span&gt; Are there any suggestions or samples? Thanks very much!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 14 Nov 2010 17:11:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73392#M1796</guid>
      <dc:creator>DanDong</dc:creator>
      <dc:date>2010-11-14T17:11:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to write spatial query results into XML files?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73393#M1797</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just asked my friend, at least the logic is right. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have already used the xsd file to generate a cs file through command prompt. This cs file is the schema of XML file. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The command is "xsd /classes /language:CS XSDSchemaFile.xsd"&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Are there any suggestions on how to use this cs file to write the results from a collection into XML file? Thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Nov 2010 14:21:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73393#M1797</guid>
      <dc:creator>DanDong</dc:creator>
      <dc:date>2010-11-15T14:21:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to write spatial query results into XML files?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73394#M1798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This seems like a related thread, kindly see: &lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/8774-save-layer-to-xml-file"&gt;http://forums.arcgis.com/threads/8774-save-layer-to-xml-file&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While you will not be saving an entire layer to XML, the idea is the same, instead of layer.Graphics you will be using &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ESRI.ArcGIS.Client.Tasks.QueryEventArgs args.FeatureSet.FeatureSet.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Nov 2010 19:17:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73394#M1798</guid>
      <dc:creator>JenniferNery</dc:creator>
      <dc:date>2010-11-15T19:17:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to write spatial query results into XML files?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73395#M1799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This seems like a related thread, kindly see: &lt;A href="http://forums.arcgis.com/threads/8774-save-layer-to-xml-file" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/8774-save-layer-to-xml-file&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;While you will not be saving an entire layer to XML, the idea is the same, instead of layer.Graphics you will be using &lt;BR /&gt;ESRI.ArcGIS.Client.Tasks.QueryEventArgs args.FeatureSet.FeatureSet.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you Jennifer! That's what I want &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I write codes like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
XmlWriterSettings settings = new XmlWriterSettings();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.Indent = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.IndentChars = "";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; settings.NewLineOnAttributes = true;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Using XmlWriter to create xml file
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //using (XmlWriter writer=XmlWriter .Create("C:\xmlfile.xml",XmlWriterSettings))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string xmlfile = @"layer1_xml.xml";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (XmlWriter writer = XmlWriter.Create(xmlfile, settings ))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteComment ("Cutting results from layer1");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteStartElement ("Results Details");
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteAttributeString&amp;nbsp; (featureSet.Features[0].Attributes.ElementAt(0).Key.ToString(),featureSet.Features[0].Attributes.ElementAt(0).Value.ToString());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; writer.WriteEndElement();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //writer.Flush ;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But it seems like there is a mistake in the writer.creater. The error is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Error 1 The best overloaded method match for 'System.Xml.XmlWriter.Create(System.Xml.XmlWriter, System.Xml.XmlWriterSettings)' has some invalid arguments D:\AGS_mxd\dan\Final_backup\Final\MainPage.xaml.cs 907 43 Final&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I write the parameters correctly, but still can't figure this out. Any suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:51:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73395#M1799</guid>
      <dc:creator>DanDong</dc:creator>
      <dc:date>2021-12-10T22:51:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to write spatial query results into XML files?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73396#M1800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is your application WPF or Silverlight?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The XLMWriter class is depending on this.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With Silverlight, you can't create an XMLWriter writing to a file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So your code should be OK with WPF but not with Silverlight:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string xmlfile = @"layer1_xml.xml";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (XmlWriter writer = XmlWriter.Create(xmlfile, settings ))
 
&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;With SL, you need a stream as argument.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Something like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
string dataFile = @"graphics.xml";
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileStream = store.CreateFile(dataFile))
{
using (XmlWriter writer = XmlWriter.Create(fileStream, new XmlWriterSettings() { Indent = true }))
{
graphicsLayer.SerializeGraphics(writer);
writer.Close();
}
fileStream.Close();
}�??
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:51:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73396#M1800</guid>
      <dc:creator>DominiqueBroux</dc:creator>
      <dc:date>2021-12-10T22:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to write spatial query results into XML files?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73397#M1801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Is your application WPF or Silverlight?&lt;BR /&gt;The XLMWriter class is depending on this.&lt;BR /&gt; &lt;BR /&gt;With Silverlight, you can't create an XMLWriter writing to a file.&lt;BR /&gt; &lt;BR /&gt;So your code should be OK with WPF but not with Silverlight:&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string xmlfile = @"layer1_xml.xml";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; using (XmlWriter writer = XmlWriter.Create(xmlfile, settings ))
 
&lt;/PRE&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;BR /&gt;With SL, you need a stream as argument.&lt;BR /&gt;Something like:&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
string dataFile = @"graphics.xml";
using (IsolatedStorageFile store = IsolatedStorageFile.GetUserStoreForApplication())
{
using (IsolatedStorageFileStream fileStream = store.CreateFile(dataFile))
{
using (XmlWriter writer = XmlWriter.Create(fileStream, new XmlWriterSettings() { Indent = true }))
{
graphicsLayer.SerializeGraphics(writer);
writer.Close();
}
fileStream.Close();
}�??
&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks very much Dominique! My prj is silverlight, no wonder I can't create an XMLWriter writing to a file. I will try your codes. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:51:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-silverlight-questions/how-to-write-spatial-query-results-into-xml-files/m-p/73397#M1801</guid>
      <dc:creator>DanDong</dc:creator>
      <dc:date>2021-12-10T22:51:06Z</dc:date>
    </item>
  </channel>
</rss>

