<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR></HEAD>
<BODY text=#000000 bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=138072715-31082007><FONT face=Arial
color=#0000ff size=2>Thanks Kenneth.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=138072715-31082007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=138072715-31082007><FONT face=Arial
color=#0000ff size=2>This does explain what I'm seeing.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=138072715-31082007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=138072715-31082007><FONT face=Arial
color=#0000ff size=2>I have tried MgByteSink, but am having the same problem
with it.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=138072715-31082007><FONT face=Arial
color=#0000ff size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=138072715-31082007><FONT face=Arial
color=#0000ff size=2>Keith</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> mapguide-users-bounces@lists.osgeo.org
[mailto:mapguide-users-bounces@lists.osgeo.org] <B>On Behalf Of </B>Kenneth,
GEOGRAF A/S<BR><B>Sent:</B> 31 August 2007 12:44<BR><B>To:</B> MapGuide Users
Mail List<BR><B>Subject:</B> Re: [mapguide-users] ByteReader
Problem<BR></FONT><BR></DIV>
<DIV></DIV>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" defanghtml_cols="72">Regards, Kenneth, GEOGRAF A/S
</PRE><BR><BR>Campbell, Keith A skrev:
<BLOCKQUOTE
cite=mid:2D5D8AC034A54041A6B2AE1C9148CC3106B224E1@SGBBMA2102.wsatkins.com
type="cite">
<META content="MS Exchange Server version 6.5.7638.1" name=Generator><!-- 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>
</FONT><FONT face="Courier New" color=#2b91af size=2>String</FONT><FONT
face="Courier New" size=2> mapDefinition = </FONT><FONT face="Courier New"
color=#a31515 size=2>"Library://My Folder/Maps/My
Map.MapDefinition"</FONT><FONT face="Courier New" size=2>;</FONT> <BR><FONT
face="Courier New"
size=2>
</FONT><FONT face="Courier New" color=#2b91af
size=2>MgResourceIdentifier</FONT><FONT face="Courier New" size=2> MapResID =
</FONT><FONT face="Courier New" color=#0000ff size=2>new</FONT><FONT
face="Courier New" size=2> </FONT><FONT face="Courier New" color=#2b91af
size=2>MgResourceIdentifier</FONT><FONT face="Courier New"
size=2>(mapDefinition);</FONT> </P>
<P><FONT face="Courier New"
size=2>
</FONT><FONT face="Courier New" color=#2b91af 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>
</FONT><FONT face="Courier New" color=#2b91af size=2>XmlDocument</FONT><FONT
face="Courier New" size=2> doc = </FONT><FONT face="Courier New" color=#0000ff
size=2>new</FONT><FONT face="Courier New" size=2> </FONT><FONT
face="Courier New" color=#2b91af size=2>XmlDocument</FONT><FONT
face="Courier New" size=2>();</FONT> <BR><FONT face="Courier New"
size=2>
</FONT><BR><FONT face="Courier New"
size=2>
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 face=Webdings color=green size=5>P</FONT> <FONT
face="Arial, Helvetica, sans-serif" color=green 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 width="90%" SIZE=4>
_______________________________________________
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><BR><BR><FONT style="BACKGROUND-COLOR: #ffffff">
<P align=center><FONT style="BACKGROUND-COLOR: #ffffff">This message has been
scanned for viruses by </FONT><A
href="http://bluepages.wsatkins.co.uk/?6875772"><FONT
style="BACKGROUND-COLOR: #ffffff"
color=#000000>MailControl</FONT></A></P></FONT></BODY></HTML>