1

I am trying to upload an XML file and am getting the "MaxCharacterFromEntitiesError"- I then set the number to 1024 but error still persists - what am I missing?

Screenshot below showing the "MaxCharacterFromEntitiesError" followed by "Root Element Missing" :-

enter image description here

Root Element Missing Error:-

enter image description here

Have followed links below but to no avail:-

DTD prohibited in xml document exception

XmlException: The input document has exceeded a limit set by MaxCharactersFromEntities

Have added the xml file in VS as suggested but it Parses fine and no errors are shown.

Have changed the MaxCharacterFromEntities with different values (0, 1024, 9999999999) but same "Root Element Missing" error persists...

Thanks

Ram
  • 527
  • 1
  • 10
  • 26
  • Try following : XmlReaderSettings settings = new XmlReaderSettings(); settings.DtdProcessing = DtdProcessing.Ignore; XmlReader reader = XmlReader.Create(FILENAME, settings); – jdweng Feb 17 '20 at 14:55
  • @jdweng - tried but same error persists – Ram Feb 17 '20 at 14:57
  • You are still gett DTD prohibited? or just 2nd exception? – jdweng Feb 17 '20 at 15:18
  • @jdweng - both MaxError then RootElementMissing – Ram Feb 17 '20 at 15:21
  • You need to get the RooElementMissing fixed first. The MaxError I think will automatically get fixed. The must start as the first character in the file with no spaces and nothing proceeding the ident node. – jdweng Feb 17 '20 at 15:31
  • @jdweng - it is formatted correctly and as a you have stated - it seems the file is too large to load - has more than 150,000 lines.... – Ram Feb 17 '20 at 15:41
  • XmlReader should be able to handle the large file. I think your xml is incomplete. Try following to validate xml. From menu Project : Add New Item : Xml File. Then paste xml into view. Error will show up in Error List like compiler errors. – jdweng Feb 17 '20 at 15:59
  • Does the file actually use external entities? These days parsers often limit the expansion of external entities because of security concerns; it's probably configurable. – Michael Kay Feb 17 '20 at 18:19
  • See updated comments – Ram Feb 18 '20 at 08:29

0 Answers0