Click here to Skip to main content
16,011,508 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm trying to read xml file it shows exception on xdoc.Load.

XmlDocument xdoc = new XmlDocument();
xdoc.Load(@"J:\PA Feed\PAHRFEED\c20120714yor.xml");

XML
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<!DOCTYPE HorseRacingCard SYSTEM "HorseRacingCard.dtd">
<HorseRacingCard>
  <Meeting status="Dormant" id="49003" country="England" course="York" date="20120714">


    <Race trifecta="No" id="412990" date="20120714" time="1355+0100" raceType="Flat" trackType="Turf" handicap="Yes" class="3" showcase="No">
  </Race>
  </Meeting>
</HorseRacingCard>
Posted
Updated 17-Jul-12 20:11pm
v2
Comments
Sergey Alexandrovich Kryukov 18-Jul-12 2:11am    
Who knows why don't you have this file? Well, provide it...
--SA

1 solution

A "Valid" XML document is a "Well Formed" XML document, which also conforms to the rules of a Document Type Definition (DTD). The purpose of a DTD is to define the structure of an XML document. It defines the structure with a list of legal elements.

Details can be read here:
http://www.w3schools.com/xml/xml_dtd.asp[^]
http://en.wikipedia.org/wiki/Document_Type_Definition[^]

It looks like you have your own DTD defined for the XML's that you are using. While loading, those DTD's are expected to be present to validate the XML.
Either provide it or remove the DTD reference (full DOCTYPE tag) from your XML.
 
Share this answer
 
Comments
deepgalley 18-Jul-12 3:36am    
thank you when i remove dtd comment it ill work
Sandeep Mewara 18-Jul-12 4:55am    
Welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900