The "ToString()" is not implemented, and thus returns "MgByteReader",
which you cannot use as an XML document.
The MgByteReader is very volatile and fragile, when you try to debug it
with VS.
Any attempt to pass the byte reader to a function (as a parameter) will
clear the stream.
You cannot read more than 8kb out of the stream in a single Read()
operation, making it a royal pain to use the MgByteReader.
I have seen others using an MgByteSink, but I have yet to try that.
Regards, Kenneth, GEOGRAF A/S
Campbell, Keith A skrev:
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:-
String mapDefinition = "Library://My Folder/Maps/My
Map.MapDefinition";
MgResourceIdentifier MapResID = new
MgResourceIdentifier(mapDefinition);
MgByteReader mapByteRdr =
res.GetResourceContent(MapResID);//res is instantiated Resource Service.
XmlDocument doc = new XmlDocument();
doc.LoadXml(mapByteRdr.ToString());
LoadXML fails with an error ' Root element is missing'. I can copy the
contents of 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.
Cheers,
Keith
*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.*
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.
P *Consider the environment. Please don't print this e-mail unless you
really need to.*
------------------------------------------------------------------------
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users