i am actually trying to convert the bytes stream Xsd file into Xsd Schema but was unable to do it through the below code
Stream streamXsdd = new MemoryStream(File.ReadAllBytes(path + "\\input.xsd"));
XmlSchema xsdDoc = new XmlSchema();
xsdDoc.Write(streamXsdd); OR Read(streamXsdd,validationeventhandler);
// i thought the above are used for conversion but they are not.
XmlSchemaSet tempSchemaDocs = new XmlSchemaSet();
tempSchemaDocs.Add(xsdDoc);
but above does not convert it. Is there any other way to do it?
The docs suggest you would want to use XmlSchema.Read
.
However this is a static method on XmlSchema
so your code would change to be more like
Stream streamXsdd = new MemoryStream(File.ReadAllBytes(path + "\\input.xsd"));
XmlSchema xsdDoc = XmlSchema.Read(streamXsddd, validationeventhandler);
XmlSchemaSet tempSchemaDocs = new XmlSchemaSet();
tempSchemaDocs.Add(xsdDoc);
Could it be that your Read
wasn't working because you were effectively discarding the result, as it returns a new instance, rather than populating an existing one?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.