'--' is an unexpected token. The expected token is '>'.

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi All, i know that this Question has been asked quite a lot in this forum but unfortunately none of them resolved my issue. I have an XML file placed on a server and i send a webrequest to fetch the file and load the the xml file. EVerything
works great on my PC, but suddenly we were having issues at one our customer sites where when the above webrequest is made and the when the load method gets called it is throwing a DTD parser exception which primarily says

<!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4; mso-font-charset:0; mso-generic-font-family:roman; mso-font-pitch:variable; mso-font-signature:-1610611985 1107304683 0 0 415 0;} @font-face {font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4; mso-font-alt:"Times New Roman"; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-520092929 1073786111 9 0 415 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-unhide:no; mso-style-qformat:yes; mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman","serif"; mso-fareast-font-family:Calibri; mso-fareast-theme-font:minor-latin;}
.MsoChpDefault {mso-style-type:export-only; mso-default-props:yes; font-size:10.0pt; mso-ansi-font-size:10.0pt; mso-bidi-font-size:10.0pt;} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.0in 1.0in 1.0in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;}
div.Section1 {page:Section1;} --> <span style="font-size:12pt; font-family:"Times New Roman","serif"
]: Exception Message : -- is an unexpected token. The expected token is >. Line 31, position 3. **Exception Stack Trace : at System.Xml.XmlTextReaderImpl.Throw(Exception e)<br/>
at System.Xml.XmlTextReaderImpl.DtdParserProxy.System.Xml.IDtdParserAdapter.Throw(Exception e)<br/>
at System.Xml.DtdParser.Throw(Int32 curPos, String res, String[] args)<br/>
at System.Xml.DtdParser.ThrowUnexpectedToken(Int32 pos, String expectedToken1, String expectedToken2)<br/>
at System.Xml.DtdParser.ScanClosingTag()<br/>
at System.Xml.DtdParser.GetToken(Boolean needWhiteSpace)<br/>
at System.Xml.DtdParser.ParseEntityDecl()<br/>
at System.Xml.DtdParser.ParseSubset()<br/>
at System.Xml.DtdParser.ParseExternalSubset()<br/>
at System.Xml.DtdParser.ParseInDocumentDtd(Boolean saveInternalSubset)<br/>
at System.Xml.DtdParser.Parse(Boolean saveInternalSubset)<br/>
at System.Xml.XmlTextReaderImpl.DtdParserProxy.Parse(Boolean saveInternalSubset)<br/>
at System.Xml.XmlTextReaderImpl.ParseDoctypeDecl()<br/>
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()<br/>
at System.Xml.XmlTextReaderImpl.Read()<br/>
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)<br/>
at System.Xml.XmlDocument.Load(XmlReader reader)<br/>
at System.Xml.XmlDocument.Load(Stream inStream)<br/>

<span style="font-size:12pt; font-family:"Times New Roman","serif" In previous posts people suggested to check for & in the file &amp; but my XML file has none of those characters, but still the customer has this issue. And it doesnt happen at
our place or at any other customer but with one (it is the same XML file by the way). Any ideas why this would be??
Any help would be greatly appreciated
<span style="font-size:12pt; font-family:"Times New Roman","serif" Sush<br/>


View the full article
 
Back
Top