Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

xml parsing

Posted on 2011-09-13
2
Medium Priority
?
339 Views
Last Modified: 2016-09-30
Hi

I have a string which has the xml content as shown in the code section below...

using libxml2, can you please help me understand how i can extract the values in the url tag and the text tag?

what header files do i need to include?
how do i initialize the xml parser?

my choice  of xml parsers is libxml2 or xerces

i am reading the documentaion, but find it confusing



<ds count="1">
<listing rank="1">
<url>
http://yy.com/ovS7oGf_LJsQjFhhYtClHSt1Q8GNUzc2QwrVO7s2EHmoxg3qVJnhlUg8Rv3F0TdX3qXpT1xTaPPuOoVxXD7CCZRbdlKeVdVbqkq4UL4fMsy3Ukvx6MgOn3mTvP5LzZvmbgjq3B8mAwR9tbhqWmxLYSTo4JageN316hWsKitvHUGK8_R4-QUxbRcAX1sf2rmC3mY6jVUCUzSTGaItyHtT3b83_Qvul8wECZjcz1rdwhfW7z1PqO4ZLkO8n-Oj9JNcdVayDts8dDofdA_bQ
</url>
<text>
Mob Sch Any 1_4
</text>
<site>Mob_Sch_Any_1_4</site>
<description>Mob Sch Any 1_4
</description>
</listing>
</ds>

Open in new window

0
Comment
Question by:Vlearns
2 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 1000 total points
ID: 36534462
Have a look at this sample code :

        http://xmlsoft.org/examples/index.html#xpath1.c

Sure, it's quite a bit of code, but that's needed for properly parsing XML :)
0
 
LVL 35

Assisted Solution

by:sarabande
sarabande earned 1000 total points
ID: 36536049
at the same site infinit08 has suggested you'll find the tree1.c which has less code.

http://xmlsoft.org/examples/tree1.c

you might succeed by changing the function print_element_names to your purpose.

Sara
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…

927 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