I'm using .net 1.1
Now I have tried with the code:
System.Text.ASCIIEncoding encoder=new System.Text.ASCIIEncoding();
byte bytes=encoder.GetBytes(p_strXmlFrag); //Here its giving error
MemoryStream ms=new MemoryStream(bytes);
XmlWriter writer=XmlWriter.Create(ms); //Here it could not find create method
ms.Position=0;
XmlTextReader.xmlFile=new XmlTextReader(ms);
----
----
----
----
------------------------------------------------------------------------------------------------------------------------------------------------------------------
I'm also pasting the total method code to make it clear:
public static bool Validate(string p_strMmlFrag, out string p_strErr)
{
p_strErr=string.Empty;
//starting of if statement
if m_xsc==null)
{
m_xsc=new XmlSchemaCollection();
try
{
string path=AppDomain.CurrentDomain.BaseDirectory+m_strSchema;
if (!File.Exists(path))
{
path=AppDomain.CurrentDoamin.BaseDirectory+"/bin"+m_strSchema;
}
XmlTextReader xmlFile=new XmlTextReader(path);
m_ifSchema=XmlSchema.Read(xmlFile, new ValidationEventHandler (ValidationCallBack));
//Error rises in the above line as the destination file path (stored in path variable), I have just created (the file) and it's definitely empty. I tried the above mentioned solution but it's giving error!!!!!!!!
m_xsc.Add(m_ifSchema);
}
// ending of if statement
catch
{
-----
}
-------
------
-------
------
private const string m_strSchema="StructureLinkage.xsd"
private static XmlSchemaCollection=m_xsc;
private static XmlSchema m_ifSchema;
// For the first time only m_xsc in null and after that it does not need to enter into above block of code once m_xsc is instantiated.
}