[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

FileHelpers

Posted on 2010-01-06
3
Medium Priority
?
459 Views
Last Modified: 2012-05-08
I have recently come across FileHelpers. I have tried to read tutorials on it but still havent got the concept of it.I am trying to use it to read/write xml file.
public class Orders
{
<FieldQuoted(""""c, QuoteMode.OptionalForRead, MultilineMode.AllowForRead)> _
        Public String CustomerID;
}

FileHelperEngine engine = new FileHelperEngine(typeof(Orders));
/// to Read use:
Orders[] res = (Orders[]) engine.ReadFile("input.txt");
foreach (Orders order in res)
 {
    Console.WriteLine(order.CustomerID + " - " +
                      order.OrderDate.ToString("dd/MM/yy"));
 }

When I say order.CustomerID, does it get the value of CustomerID element in the xml file? How  does it do ir, when I havent specified the element name or location anywhere? What I am I missing ?
0
Comment
Question by:Angel02
  • 2
3 Comments
 
LVL 41

Accepted Solution

by:
graye earned 2000 total points
ID: 26203613
I presume you've looked at http://filehelpers.sourceforge.net
One of the significant features is the ability to parse a CSV file (or other types of text files) directly into class instances.   So, instead of parsing each line in a file, one at a time, you just use the FileHelperEngine to do it all for you.
If the input.txt file is already a fully-formed XML file, then there are probably better ways to quickly import the contents of the file into a DataSet (or DataTable).   If so, then please advise
0
 

Author Comment

by:Angel02
ID: 26204003
Yeah you are right. I was in fact missing something.
I got to know from the lead developer of filehelpers that it cannot be used to read xml files !
I had assumed so and thats why it did not make sense. Filehelpers are used to read delimited or fixed length files. They can be in csv format or text files with data separated by any delimiter.

0
 

Author Closing Comment

by:Angel02
ID: 31673630
Yeah you are right. I was in fact missing something.
I got to know from the lead developer of filehelpers that it cannot be used to read xml files !
I had assumed so and thats why it did not make sense. Filehelpers are used to read delimited or fixed length files. They can be in csv format or text files with data separated by any delimiter.
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question