I'm trying to load an xml file which schema comes as a string:
using (MemoryStream memStream = GenerateStreamFromString(XsdSchemas.the_schema_string))
{
// tried this one too => using TextReader txtReader = new StreamReader(memStream);
using XmlTextReader xmlReader = new(memStream);
settings.Schemas.Add(THE_NAMESPACE_S, xmlReader);
}
private static MemoryStream GenerateStreamFromString(string value)
{
if (string.IsNullOrWhiteSpace(value))
throw new ArgumentNullException("value");
MemoryStream memStream = new(Encoding.UTF8.GetBytes(value));
memStream.Position = 0; // just in case
return memStream;
}
But I can't get it to work. The debug shows xmlReader as "None". I have no idea what that means.