简体   繁体   中英

XML delimiters in C#

I am having a XML file to be read line by line. But while I am executing I am getting this error "The class $Classname$ must be marked with the [DelimitedRecord] or [FixedLengthRecord] Attribute." But for an XML file how to set delimiters. In my code I am also executing Flat files and CSV file too. Can anyone help me in this.

From the error message you receive, I suspect that you use the FileHelpers library. This library helps you in parsing CSV-files and others. I don't know whether it also supports Xml. But as Xml is a very widely spread, the .NET Framework provides support for reading and parsing Xml files. Have a look at Linq to Xml ( XDocument ) or the DOM implementation ( XmlDocument ), if you are interested in reading and parsing the content of an Xml file.

If you are only interested in reading the file line by line without parsing/interpreting the contents, a StreamReader or the File.ReadLines method can do the job.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM