<?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 Unserialization of an arcobject in C++? in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/unserialization-of-an-arcobject-in-c/m-p/202195#M5265</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, i basically have a IPolynomalXform operator, that has been serialized to XML. How can i unserialize this xml file into a ArcObject? Its very vaguley mentioned, in the EDN documentation, however i cannot find any examples. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My understanding is i need to use a combination of IXML* objects to read-&amp;gt;unserialize-&amp;gt;get_object-&amp;gt;?????&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
HRESULT GeoTransformer::GetGeodataXFormFromFile(__in const ATL::CComBSTR&amp;amp; transformationFile)
{
 USES_CONVERSION;
 IXMLStreamPtr ipXMLStream(CLSID_XMLStream);
 IXMLSerializerPtr ipXMLSerializer(CLSID_XMLSerializer);
 
 ipXMLStream-&amp;gt;LoadFromFile(transformationFile);
 
 
 IXMLReaderPtr ipXMLReader(CLSID_XMLReader);
 hr = ipXMLReader-&amp;gt;ReadFrom(static_cast&amp;lt;IStreamPtr&amp;gt;(ipXMLStream));
 if(FAILED(hr))
 {
&amp;nbsp; std::cerr &amp;lt;&amp;lt; "[ERROR]: Cannot read XML transformation file [ " &amp;lt;&amp;lt; W2A(transformationFile) &amp;lt;&amp;lt; " ]" &amp;lt;&amp;lt; std::endl;
&amp;nbsp; return hr;
 }
 
 hr = ipXMLSerializer-&amp;gt;ReadObject(ipXMLReader, ?????, ?????, ?????);
 if(FAILED(hr))
 {
&amp;nbsp; std::cerr &amp;lt;&amp;lt; "[ERROR]: Cannot deserialize XML Transformation file [ " &amp;lt;&amp;lt; W2A(transformationFile) &amp;lt;&amp;lt; " ]" &amp;lt;&amp;lt; std::endl;
&amp;nbsp; return hr;
 }
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any combination of parameters or attempts always results in an error. Does anyone know?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Apr 2010 08:21:28 GMT</pubDate>
    <dc:creator>FrankPerks</dc:creator>
    <dc:date>2010-04-07T08:21:28Z</dc:date>
    <item>
      <title>Unserialization of an arcobject in C++?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unserialization-of-an-arcobject-in-c/m-p/202195#M5265</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi, i basically have a IPolynomalXform operator, that has been serialized to XML. How can i unserialize this xml file into a ArcObject? Its very vaguley mentioned, in the EDN documentation, however i cannot find any examples. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My understanding is i need to use a combination of IXML* objects to read-&amp;gt;unserialize-&amp;gt;get_object-&amp;gt;?????&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
HRESULT GeoTransformer::GetGeodataXFormFromFile(__in const ATL::CComBSTR&amp;amp; transformationFile)
{
 USES_CONVERSION;
 IXMLStreamPtr ipXMLStream(CLSID_XMLStream);
 IXMLSerializerPtr ipXMLSerializer(CLSID_XMLSerializer);
 
 ipXMLStream-&amp;gt;LoadFromFile(transformationFile);
 
 
 IXMLReaderPtr ipXMLReader(CLSID_XMLReader);
 hr = ipXMLReader-&amp;gt;ReadFrom(static_cast&amp;lt;IStreamPtr&amp;gt;(ipXMLStream));
 if(FAILED(hr))
 {
&amp;nbsp; std::cerr &amp;lt;&amp;lt; "[ERROR]: Cannot read XML transformation file [ " &amp;lt;&amp;lt; W2A(transformationFile) &amp;lt;&amp;lt; " ]" &amp;lt;&amp;lt; std::endl;
&amp;nbsp; return hr;
 }
 
 hr = ipXMLSerializer-&amp;gt;ReadObject(ipXMLReader, ?????, ?????, ?????);
 if(FAILED(hr))
 {
&amp;nbsp; std::cerr &amp;lt;&amp;lt; "[ERROR]: Cannot deserialize XML Transformation file [ " &amp;lt;&amp;lt; W2A(transformationFile) &amp;lt;&amp;lt; " ]" &amp;lt;&amp;lt; std::endl;
&amp;nbsp; return hr;
 }
}
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any combination of parameters or attempts always results in an error. Does anyone know?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Apr 2010 08:21:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unserialization-of-an-arcobject-in-c/m-p/202195#M5265</guid>
      <dc:creator>FrankPerks</dc:creator>
      <dc:date>2010-04-07T08:21:28Z</dc:date>
    </item>
    <item>
      <title>Unserialization of an arcobject in C++?</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/unserialization-of-an-arcobject-in-c/m-p/202196#M5266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Okay i figured it out. I'll share it just in case someone else ever needs to use it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
HRESULT GeoTransformer::GetGeodataXFormFromFile(__in const ATL::CComBSTR&amp;amp; transformationFile)
{
 USES_CONVERSION;
 IXMLStreamPtr ipXMLStream(CLSID_XMLStream);
 IXMLSerializerPtr ipXMLSerializer(CLSID_XMLSerializer);
 ipXMLStream-&amp;gt;LoadFromFile(transformationFile);
 IXMLReaderPtr ipXMLReader(CLSID_XMLReader);
 hr = ipXMLReader-&amp;gt;ReadFrom(static_cast&amp;lt;IStreamPtr&amp;gt;(ipXMLStream));
 if(FAILED(hr))
 {
&amp;nbsp; std::cerr &amp;lt;&amp;lt; "[ERROR]: Cannot read XML transformation file [ " &amp;lt;&amp;lt; W2A(transformationFile) &amp;lt;&amp;lt; " ]" &amp;lt;&amp;lt; std::endl;
&amp;nbsp; return hr;
 }
 
 LPUNKNOWN ipUnknown;
 
 hr = ipXMLSerializer-&amp;gt;ReadObject(ipXMLReader, NULL, NULL, &amp;amp;ipUnknown);
 if(FAILED(hr))
 {
&amp;nbsp; std::cerr &amp;lt;&amp;lt; "[ERROR]: Cannot deserialize XML Transformation file [ " &amp;lt;&amp;lt; W2A(transformationFile) &amp;lt;&amp;lt; " ]" &amp;lt;&amp;lt; std::endl;
&amp;nbsp; return hr;
 }

 m_ipPolynomialFormX = static_cast&amp;lt;IPolynomialXformPtr&amp;gt;(ipUnknown);
 
 return S_OK;
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But yeah no mention of how to do this anywhere on EDN. :mad:&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 10:02:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/unserialization-of-an-arcobject-in-c/m-p/202196#M5266</guid>
      <dc:creator>FrankPerks</dc:creator>
      <dc:date>2021-12-11T10:02:33Z</dc:date>
    </item>
  </channel>
</rss>

