title: xml load error DTD must be defined before the document root element
body: <p>I am trying to load an xml file but getting the following error.</p>
  
  <blockquote>
    <p>DTD must be defined before the document root element.</p>
  </blockquote>
  
  <p>the xml file is generated by others, i found that there are html elements in the xml file. How do i delete the html in the xml file using c#?</p>
  
  <p>Updated:</p>
  
  <p>Hi, I sorry that i cannot show to full xml file due to company p&amp;c. But below are the html part that i mention.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;loanreservation&gt;
  &lt;loanid&gt;&lt;/loanid&gt;
  &lt;status&gt;WEB_REQUEST&lt;/status&gt;
  &lt;requesterid&gt;abc&lt;/requesterid&gt;
  &lt;borrowerid&gt;abc&lt;/borrowerid&gt;
  &lt;borrowerorgid&gt;abc&lt;/borrowerorgid&gt;
  &lt;borrowerlocid&gt;abcborrowerlocid&gt;
  &lt;authcontactid&gt;&lt;/authcontactid&gt;
  &lt;escalationcontactid&gt;&lt;/escalationcontactid&gt;
  &lt;specialinstructions&gt;specialinstructions&gt;
  &lt;internalnotes&gt;&lt;/internalnotes&gt;
  &lt;usestartdate&gt;2018-09-03&lt;/usestartdate&gt;
  &lt;useenddate&gt;2018-09-17&lt;/useenddate&gt;
  &lt;mustshipdate&gt;2018-08-30&lt;/mustshipdate&gt;
  &lt;mustreceivedate&gt;2018-10-01&lt;/mustreceivedate&gt;
  &lt;checkoutdate&gt;&lt;/checkoutdate&gt;
  &lt;checkindate&gt;&lt;/checkindate&gt;
  &lt;intendeduse&gt;&lt;/intendeduse&gt;
  &lt;reason&gt;&lt;/reason&gt;
  &lt;shiptolocid&gt;abc&lt;/shiptolocid&gt;
  &lt;shipaddress1&gt;&lt;/shipaddress1&gt;
  &lt;shipaddress2&gt;&lt;/shipaddress2&gt;
  &lt;shipaddress3&gt;&lt;/shipaddress3&gt;
  &lt;shipaddress4&gt;&lt;/shipaddress4&gt;
  &lt;shippostalcode&gt;&lt;/shippostalcode&gt;
  &lt;shipcity&gt;&lt;/shipcity&gt;
  &lt;shipstate&gt;&lt;/shipstate&gt;
  &lt;shipprovince&gt;&lt;/shipprovince&gt;
  &lt;shipcountry&gt;&lt;/shipcountry&gt;
  &lt;shiptocontactid&gt;&lt;/shiptocontactid&gt;
  &lt;shiptocontactphone&gt;&lt;/shiptocontactphone&gt;
  &lt;shiptocontactfax&gt;&lt;/shiptocontactfax&gt;
  &lt;shiptocontactemail&gt;&lt;/shiptocontactemail&gt;
  &lt;returnpickuplocid&gt;&lt;/returnpickuplocid&gt;
  &lt;returnpickupcontactid&gt;&lt;/returnpickupcontactid&gt;
  &lt;returnpickupcontactphone&gt;&lt;/returnpickupcontactphone&gt;
  &lt;returnpickupcontactfx&gt;&lt;/returnpickupcontactfx&gt;
  &lt;returnpickupcontactemail&gt;&lt;/returnpickupcontactemail&gt;
  &lt;returnpickuplocation&gt;&lt;/returnpickuplocation&gt;
  &lt;returnpickupaddress1&gt;&lt;/returnpickupaddress1&gt;
  &lt;returnpickupaddress2&gt;&lt;/returnpickupaddress2&gt;
  &lt;returnpickupaddress3&gt;&lt;/returnpickupaddress3&gt;
  &lt;returnpickupaddress4&gt;&lt;/returnpickupaddress4&gt;
  &lt;returnpickuppostalcode&gt;&lt;/returnpickuppostalcode&gt;
  &lt;returnpickupcity&gt;&lt;/returnpickupcity&gt;
  &lt;returnpickupstate&gt;&lt;/returnpickupstate&gt;
  &lt;returnpickupprovince&gt;&lt;/returnpickupprovince&gt;
  &lt;returnpickupcountry&gt;&lt;/returnpickupcountry&gt;
  &lt;loanorgpoolid&gt;&lt;/loanorgpoolid&gt;
  &lt;contactloginid&gt;&lt;/contactloginid&gt;
  &lt;lastupdate&gt;&lt;/lastupdate&gt;
  &lt;createdate&gt;&lt;/createdate&gt;
  &lt;approvalcontactid&gt;&lt;/approvalcontactid&gt;
  &lt;approveddate&gt;&lt;/approveddate&gt;
  &lt;shippingwaybill&gt;&lt;/shippingwaybill&gt;
  &lt;shippingcarrier&gt;&lt;/shippingcarrier&gt;
  &lt;shippingnoofboxes&gt;&lt;/shippingnoofboxes&gt;
  &lt;shippingtotalweight&gt;&lt;/shippingtotalweight&gt;
  &lt;returnwaybill&gt;&lt;/returnwaybill&gt;
  &lt;returncarrier&gt;&lt;/returncarrier&gt;
  &lt;returnnoofboxes&gt;&lt;/returnnoofboxes&gt;
  &lt;returntotalweight&gt;&lt;/returntotalweight&gt;
  &lt;reservationitems&gt;
  &lt;item&gt;
  &lt;loanid&gt;&lt;/loanid&gt;
  &lt;equipno&gt;&lt;/equipno&gt;
  &lt;assetno&gt;&lt;/assetno&gt;
  &lt;manufacturer&gt;&lt;/manufacturer&gt;
  &lt;manufmodelno&gt;&lt;/manufmodelno&gt;
  &lt;serialno&gt;&lt;/serialno&gt;
  &lt;options&gt;&lt;/options&gt;
  &lt;chassisno&gt;&lt;/chassisno&gt;
  &lt;slotno&gt;&lt;/slotno&gt;
  &lt;configid&gt;&lt;/configid&gt;
  &lt;/item&gt;
  &lt;/reservationitems&gt;
  &lt;accessories&gt;
  &lt;item&gt;&lt;/item&gt;
  &lt;/accessories&gt;
  &lt;/loanreservation&gt;
  
      &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
      &lt;html style="height: 100%"&gt;
      &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
      &lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&gt;
      &lt;title&gt;&lt;/title&gt;
      &lt;link rel="stylesheet" type="text/css" href="../css/base-font.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="../css/style.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="../css/template.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="../css/dashboard.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="../css/tabs.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="../css/webforms.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="../css/im.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="../css/ice_infoline.css"&gt;
      &lt;link rel="stylesheet" type="text/css" href="../css/internal_portal.css"&gt;
      &lt;script language="JavaScript" src="../scripts/dhtml-base.js"&gt;&lt;/script&gt;
      &lt;script language="JavaScript" src="../scripts/common.js"&gt;&lt;/script&gt;
      &lt;script language="JavaScript" src="../scripts/jquery-min.js"&gt;&lt;/script&gt;
      &lt;script language="JavaScript" src="../public/locale-script.aspx"&gt;&lt;/script&gt;
      &lt;script language="JavaScript" src="../scripts/template.js"&gt;&lt;/script&gt;
      &lt;script language="JavaScript" src="../scripts/dhtml-menus.js"&gt;&lt;/script&gt;
      &lt;script language="JavaScript" src="../scripts/report-definition.js"&gt;&lt;/script&gt;
      &lt;script language="JavaScript" src="../webfx/scripts/webforms-ui.js"&gt;&lt;/script&gt;
      &lt;script src="../webfx/scripts/webforms.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
  
  
      &lt;body style="height: 100%;"&gt;
      &lt;div style="position: fixed; top: 0px; width:60px; height: 100%; background-color: #555555;"&gt;&lt;/div&gt;
      &lt;div style="margin-left:0px; height: 100%"&gt;
      &lt;div style="display: table; height: 100%; width: 100%"&gt;
      &lt;div style="display: table-row; width=100%"&gt;
      &lt;div style="border-bottom:6px #e90029 solid; margin-bottom: 10px;  "&gt;
      &lt;div class="bodycontainer"&gt;
      &lt;a style="display: inline-block;" href="http://www.keysight.com"&gt;&lt;img src="../acom-lf/keysight-logo.png"&gt;&lt;/a&gt;
      &lt;span style="display: inline-block; color: #555555; font-size: 20pt; font-weight: bold; vertical-align: top; padding-top: 20px; margin-left: 30px" &gt;Infoline&lt;/span&gt;
      &lt;/div&gt;  
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;div style="display: table-row; width=100%; height: 100%"&gt;
      &lt;div class="bodycontainer" style=" "&gt;
      &lt;h1&gt;System maintenance&lt;/h1&gt;
  
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;div style="display: table-row; width=100%"&gt;
      &lt;div style="color: #909090; background-color: black; padding: 8px; padding-left:50px; margin-top: 20px; font-size: 9pt;" class="bodycontainerhf"&gt; 
      &lt;/script&gt;&lt;/strong&gt; 
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;/div&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  </code></pre>
  
  <p>For the coding part, i'm just doing as below:</p>
  
  <p>xmlDoc.Load(Server.MapPath("./Request/") + FileUpload1.FileName);
  What I'm doing is just loading the xml file.</p>