3 Replies - 214 Views - Last Post: 29 August 2018 - 07:27 PM

#1 complete   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 117
  • Joined: 12-April 07

What is the “maxCharsCount” limit for XmlTextReaderImpl.Get

Posted 29 August 2018 - 09:27 AM

Hi Forum.

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​

Is This A Good Question/Topic? 0
  • +

Replies To: What is the “maxCharsCount” limit for XmlTextReaderImpl.Get

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15160
  • View blog
  • Posts: 60,694
  • Joined: 12-June 08

Re: What is the “maxCharsCount” limit for XmlTextReaderImpl.Get

Posted 29 August 2018 - 09:31 AM

Please copy/paste the entire exception message.
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6985
  • View blog
  • Posts: 23,747
  • Joined: 05-May 12

Re: What is the “maxCharsCount” limit for XmlTextReaderImpl.Get

Posted 29 August 2018 - 07:10 PM

It is not a constant value. If you look at the reference source, you'll see that it looks to be dependent on the stream size and where the parser thinks the data ends.
Was This Post Helpful? 0
  • +
  • -

#4 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 6985
  • View blog
  • Posts: 23,747
  • Joined: 05-May 12

Re: What is the “maxCharsCount” limit for XmlTextReaderImpl.Get

Posted 29 August 2018 - 07:27 PM

Actually, taking a closer look at your call stack and comparing to the reference source, it looks like the problem is not that of maximum length, but that of an invalid encoding within the XML
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1