Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File read

Status
Not open for further replies.

mayu03

Programmer
Oct 3, 2003
91
US
I am just learning XML...
I have a flat file (text.txt) not xml file.
What should I do to transfer that file into xml file?
 
If your textfile is an unstructured text (a letter or a novel) it doesn't make sense to convert it to xml.
If it is structured in some way, like a CSV-file, you might do some string-manupilations to get the pieces to put in different nodes. You could glue them together appending strings:
xmlstring = &quot;<root><name>&quot; + FirstPart + &quot;</name><name>&quot; + SecondPart + &quot;</name></root>&quot;
With a bit of luck, you can even use a replace-function (replace &quot;;&quot; with &quot;</field><field>&quot;, replace newline with &quot;</field></record><record><field>&quot; or something like that.
But anyway, I'd advise to use (for example) MSXML.DOMDocument. Check the help that goes with it for instructions: it isn't difficult, and much safer then appending the strings yourself (one typo and your xml is invalid).

 
CAN YOU GIVE ME SOME SITES WHERE I CAN READ MORE ABOUT MSXML.DOMDocument?
THANKS
 
Or look at the &quot;Partners&quot; box to your left. TopXML is good.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top