Jump to content
Software FX Community

Problem using .Import method to load xml strings


User (Legacy)

Recommended Posts

In my case, I want to load a stream containing xml

to the chart. If I import the same xml from a file,

it works properly. If I read the xml file into a string

and then try to convert it to a stream and import

the stream, it doesn't work.

Of course, your assemblies are obfuscated.

So, I can't duplicate what your code is doing

when it loads an xml file.

It put a sample together to simulate getting

the same xml string.

This works:

chart1.Import(ChartFX.WebForms.FileFormat.Xml, fileName);

This does not work:

string myxml = "";

string fileName = @"D:\chartsettings.xml";

using(StreamReader sr = new StreamReader(fileName))

{

myxml = sr.ReadToEnd();

}

using (MemoryStream stream = new MemoryStream())

{

using (StreamWriter sw = new StreamWriter(stream))

{

sw.Write(myxml);

stream.Position = 0;

chart1.Import(ChartFX.WebForms.FileFormat.Xml, stream);

}

}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...