0

my code gives me error : "'.', hexadecimal value 0x00, is an invalid character. Line 2, position 1."

    string FileName = "20110606 100419 ServerForShop 1.xml";
    string root = Server.MapPath("~/Include/Xml Files/Patch/");       

    var custs = from c in XElement.Load(root + FileName).Elements("Update")
            select c;

I want to read and execute command a big xml file it is about 350MB how I can read it ? here is my xml file structure :

<?xml version="1.0" encoding="utf-8"?>
<Update>
  <Object Name="Good">
    <Insert Table="Good">
      <Field Name="GoodCode" Value="1" Type="Integer" />
      <Field Name="GoodUserCode" Value="" Type="String" />
      .
      .
      .
    </Insert>
  </Object>
  </Update>
kamiar3001
  • 2,646
  • 4
  • 42
  • 78
  • 4
    It sounds like your XML file is actually invalid - it may be encoded in UTF-16, despite its *claim* to be in UTF-8. – Jon Skeet Jun 06 '11 at 13:50
  • 3
    You cannot **execute** an XML file.... XML is data - not executable code.... – marc_s Jun 06 '11 at 13:58
  • use a hexdump program and see if http://stackoverflow.com/users/22656/jon-skeet is correct – jcomeau_ictx Jun 06 '11 at 13:59
  • @marc_s: If your XML encodes processing instructions, you can execute it -- just like any other text-based programming language. – Gabe Jun 06 '11 at 14:05
  • @Gabe: OK, but that seems like a rather rare edge-case - not the average typical XML usage.... – marc_s Jun 06 '11 at 14:11

1 Answers1

1

I would recommend looking here for some samples http://support.microsoft.com/kb/307548 and perhaps here How does one parse XML files?

Community
  • 1
  • 1
Bueller
  • 2,336
  • 17
  • 11