I am new to XML and have a very sketchy knowledge of C. I am writing a C program in which I need to read strings (each on a separate line) in a text file, match that string with a value enclosed in a specific tag inside an XML file, and based upon that match, get a value from inside another tag in the same XML file, and finally write that value to a new tag in a new XML file.

Can anyone please help me?

Thanks.

I am new to XML and have a very sketchy knowledge of C. I am writing a C program in which I need to read strings (each on a separate line) in a text file, match that string with a value enclosed in a specific tag inside an XML file, and based upon that match, get a value from inside another tag in the same XML file, and finally write that value to a new tag in a new XML file.

Well, being new to both probably puts you in a spot. You could write your own parser if the XML file will always and forevermore be canned and simple, and that might be easiest.

But I might also recommend looking into a third party library such as libXML if you are starting something that will grow and be adapted over time. This is what I chose when I needed to do XML parsing "for real".

Perhaps post an example of the XML file and the data to be extracted.

Some idea of simple parsing are here to give you some idea if you are not familiar with parsing text:
http://www.daniweb.com/code/snippet216535.html
http://www.daniweb.com/code/snippet216569.html
http://www.daniweb.com/code/snippet216682.html
http://www.daniweb.com/code/snippet216681.html

commented: thorough +5
commented: Excellent! +6
Member Avatar for JenniLei

Luckily XML files are relatively easy to read and all you do is map from the tags in the xml docs. My advice in addition to Daves is to look at IXMLDOMDocument structure.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.