Forum guidelines
b h
Reading and writing XML files
Posted By b h on 08 Nov 2007

I am new to compact framework and trying to take code from a C# forms app I have to read and write XML files.  I will primarily be using these for init values (read) and values to load into an Oracle database (write).  Some of the code I have in C# forms does not compile, I guess because it is not supported in the compact framework.  Does anyone have any examples of code that will actually work in the compact framework that will read and write XML to and from files?



Re: Reading and writing XML files
Posted By Arun Kumar on 08 Nov 2007  
Hi Friend,
    In C# it is not much complicated to read and write to the xml file...Could U please post ur code snippet ..So that, I may able to tell you what was the problem happend


b h
  • 0
  • 0
Re: Reading and writing XML files
Posted By b h on 02 Jan 2008  

Here is the XML code I have in a normal C# project.  But it will not compile in Compact Framework.  Thanks


StreamReader stream = new StreamReader("InitFile.xml");

XmlTextReader reader = new XmlTextReader(stream);

XmlSchemaCollection schemaColl = new XmlSchemaCollection();

schemaColl.Add(null, "InitFileSchema.xsd");

XmlValidatingReader valReader = new XmlValidatingReader(reader);

valReader.ValidationType = ValidationType.Schema;


valReader.ValidationEventHandler += new ValidationEventHandler(valHandler);

while (valReader.Read())


// Load DB Values

if (valReader.LocalName.Equals("DBType"))

C# Corner Annual Conference 2016


Spire.Doc - Free .NET Word API
Use Spire.Doc to create, read, write, print, and convert word documents to OpenXML, RTF, TXT, XPS, EPUB, EMF, HTML, Image and PDF.