Re: Convert flat file to XML document

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



On 19 Dec 2005 14:39:51 -0800, "asrs63" <ashoo_sharda@xxxxxxxxxx>
wrote:

>Hi,
>
>I am a newbee and have a comma seperated flat-file and a DTD. I need to
>write a C# program which will read the text file and convert it to a
>XML file as per the the definition in the DTD. I am not able to find
>anything help-ful and don't know how to begin to code.
>
>Can anyone please help me?
>
>Thanks in advance
>
>Ashoo Sharda

How much of a newbie are you? I will assume that you don't know much,
my apologies of I am wrong.

Most newbies make the mistake of trying to write too much at once.
Avoid this by writing a little and then testing it. Only go on when
all the tests work.

Start by writing a smell program to open a file and copy its contents
to the screen. Yes, that simple. It is something you will need to do
as part of your overall program so you might as well start with that.
Test it with different test files to check that it works.

Now add to your program so that it writes a second copy of the
original file to disk, with a new name. Again this is something you
will need to do in your overall program. Test it and check that you
are indeed making a copy of the input file.

Read your C# and XML books so you understand what C# can offer you as
built-in XML handling as part of .NET

Now try a very simple DTD and equivalent CSV file. Read in the DTD
and the CSV file, produce the XML file. Check that the XML file is
what you expect.

As required add extra processing to your program so that you can
process more and more complex DTD/CSV files. After each incremental
improvement test to make sure that your program still works correctly.

If you get stuck then post what you have written so we can have a look
at it. It lets us help you more of we can see your code.

rossum

--

The ultimate truth is that there is no ultimate truth
.



Relevant Pages

  • Re: How to read an XML file in Visual C++ 6
    ... the DTD could be part of the XML file itself ... I'd vote for putting it in the resources. ... It makes no sense to put a remote URL into a file which is going to be used locally. ...
    (microsoft.public.vc.mfc)
  • Serializing from XML with remote DTD
    ... I have an XML file which I am serializing into a class using the ... the XML file has a dtd in it that points to a remote ... mean, it's not trying to validate it, so why ...
    (microsoft.public.dotnet.languages.csharp)
  • How to get Java to read in XML file and parse it against DTD?
    ... When using Java to read in an XML file, ... the XML file to be parsed against the specified DTD. ... I have an existing Java application that allows users to modify values ...
    (comp.lang.java.programmer)
  • Re: Confused About Validation
    ... DTDs have to be included or referred from an XML file. ... setting the validation type to DTD. ... > saying that Doctype is not defined. ... then use it to load / validate the xml files? ...
    (microsoft.public.dotnet.xml)
  • Re: Parsing DTD from XML in Java
    ... Isn't it conveient for you to get this DTD outside your XML file? ...
    (comp.lang.java.programmer)