<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
The "ToString()" is not implemented, and thus returns "MgByteReader",
which you cannot use as an XML document.<br>
<br>
The MgByteReader is very volatile and fragile, when you try to debug it
with VS.<br>
Any attempt to pass the byte reader to a function (as a parameter) will
clear the stream.<br>
You cannot read more than 8kb out of the stream in a single Read()
operation, making it a royal pain to use the MgByteReader.<br>
<br>
I have seen others using an MgByteSink, but I have yet to try that.<br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth, GEOGRAF A/S
</pre>
<br>
<br>
Campbell, Keith A skrev:
<blockquote
 cite="mid:2D5D8AC034A54041A6B2AE1C9148CC3106B224E1@SGBBMA2102.wsatkins.com"
 type="cite">
  <meta http-equiv="Content-Type" content="text/html; ">
  <meta name="Generator" content="MS Exchange Server version 6.5.7638.1">
  <title>ByteReader Problem</title>
<!-- Converted from text/rtf format -->
  <p><font face="Arial" size="2">I am trying to alter a map definition
through the API and cannot get the contents of the MgByteReader in
string format. Here's the code:-</font></p>
  <p><font face="Courier New" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font
 color="#2b91af" face="Courier New" size="2">String</font><font
 face="Courier New" size="2"> mapDefinition = </font><font
 color="#a31515" face="Courier New" size="2">"Library://My
Folder/Maps/My Map.MapDefinition"</font><font face="Courier New"
 size="2">;</font>
  <br>
  <font face="Courier New" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font
 color="#2b91af" face="Courier New" size="2">MgResourceIdentifier</font><font
 face="Courier New" size="2"> MapResID = </font><font color="#0000ff"
 face="Courier New" size="2">new</font><font face="Courier New" size="2">
  </font><font color="#2b91af" face="Courier New" size="2">MgResourceIdentifier</font><font
 face="Courier New" size="2">(mapDefinition);</font>
  </p>
  <p><font face="Courier New" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font
 color="#2b91af" face="Courier New" size="2">MgByteReader</font><font
 face="Courier New" size="2"> mapByteRdr =
res.GetResourceContent(MapResID);//res is instantiated Resource Service.</font>
  </p>
  <p><font face="Courier New" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font><font
 color="#2b91af" face="Courier New" size="2">XmlDocument</font><font
 face="Courier New" size="2"> doc = </font><font color="#0000ff"
 face="Courier New" size="2">new</font><font face="Courier New" size="2">
  </font><font color="#2b91af" face="Courier New" size="2">XmlDocument</font><font
 face="Courier New" size="2">();</font>
  <br>
  <font face="Courier New" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </font>
  <br>
  <font face="Courier New" size="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
doc.LoadXml(mapByteRdr.ToString());</font>
  </p>
  <p><font face="Arial" size="2">LoadXML fails with an error ' Root
element is missing'. I can copy the contents of</font> <font
 face="Arial" size="2">mapByteRdr from Visual Studio at runtime and it
contains properly formatted XML for the map definition. If I use the
ToFile() method, the resultant file is empty. I cannot see why these
two methods do not return the xml string in the reader. Any help is
welcome.</font></p>
  <p><font face="Arial" size="2">Cheers,</font>
  </p>
  <p><font face="Arial" size="2">Keith</font>
  </p>
  <br>
  <br>
  <center><font face="Arial, Helvetica, sans-serif" size="2"><b>This
email and any attached files are confidential and copyright protected.
If you are not the addressee, any dissemination of this communication
is strictly prohibited. Unless otherwise expressly agreed in writing,
nothing stated in this communication shall be legally binding.</b></font>
  <p><font face="Arial, Helvetica, sans-serif" size="2">The ultimate
parent company of the Atkins Group is WS Atkins plc. Registered in
England No. 1885586. Registered Office Woodcote Grove, Ashley Road,
Epsom, Surrey KT18 5BW.</font> </p>
  <p><font color="green" face="Webdings" size="5">P</font> <font
 color="green" face="Arial, Helvetica, sans-serif" size="2"><b>Consider
the environment. Please don't print this e-mail unless you really need
to.</b></font> </p>
  </center>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
  </pre>
</blockquote>
</body>
</html>