Please help me with this program to parse a file into an XML file

DjShan

New Member
To parse an input text file and generate a) an XML file and b) an SVG (also XML) file.The input text file (input.txt) contains the description of a number of produce distribution centers and storage centers around the country. Each line describes either a single distribution center (dcenter) or a storage center, each with a number of properties; each property name (code for example) is separated by its value with a =.Example (input.txt)\[code\]dcenter: code=d1, loc=San Jose, x=100, y=100, ctype=ct1dcenter: code=d2, loc=San Ramon, x=300, y=200, ctype=ct2storage: code=s1, locFrom=d1, x=50, y=50, rtype=rt1storage: code=s2, locFrom=d1, x=-50,y=100, rtype=rt1\[/code\]The desired Output of the program:Output 1\[code\]<?xml version="1.0"?><dcenters><dcenter code="d1"><loc> San Jose </loc><x> 100 </x><y> 100 </y><ctype> ct1 </ctype></dcenter><storage code="S1"><locFrom> d1 </locFrom><x> 150 </x><y> 150 </y><rtype> rt1 </rtype></storage><storage code="S2"><locFrom> d1 </locFrom><x> 50 </x><y> 200 </y><rtype> rt1 </rtype></storage>\[/code\]Please help me with the program. I will really appreciate.
 
Top