I got this error message when I try to read the XMLfile
Unhandled Exception: System.Xml.XmlException: 'xi' is an undeclared namespace. Line 12, position 18.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg, Int32 lineNo, Int32 linePos)
at System.Xml.XmlTextReaderImpl.LookupNamespace(NodeData node)
at System.Xml.XmlTextReaderImpl.ElementNamespaceLookup()
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlTextReader.Read()
Code to read XML:
XmlTextReader reader = new XmlTextReader("file.xml");
while (reader.Read())
{
// Do some work here on the data.
Console.WriteLine(reader.Name);
}
Console.ReadLine();
The xml file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<doh>
<!-- Available Resources-->
<servers>
<xi:include href="file.xml"/>
</servers>