In Microsoft c# Visual Studio I am using XPathNavigator to read and manipulate an XML data set.  The exception that is thrown is very descriptive in pinpointing the problem with the XML file that is read.  There is one text field that exceeds the limit of what is allowed for a string length.  And so, I want to know what that limit is.  Also, I am open to suggestions on how I can programmatically parse out the xml file before hand or during the process.Here is the call stack, in case there is any doubt:       at System.Xml.XmlTextReaderImpl.Throw(Exception e)       at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)       at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)       at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)       at System.Xml.XmlTextReaderImpl.ReadData()       at System.Xml.XmlTextReaderImpl.ParseElementContent()       at System.Xml.XmlTextReaderImpl.Read()       at System.Xml.XPath.XPathDocument.LoadFromReader(XmlReader reader, XmlSpace space)       at System.Xml.XPath.XPathDocument..ctor(String uri, XmlSpace space)       at System.Xml.XPath.XPathDocument..ctor(String uri)       at UseXPathNavigator.BooksXmlNavigator.Main(String[] args) in C:\Users\Xarzu\source\repos\XMLSpecial\XMLSpecial\Program.cs:line 128

It seems to me that the exception is thrown by the file path not the file itself. Try placing the file where it has a shorter path and see if that helps.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.