Solved

xml parsing

Posted on 2011-09-13
2
334 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Accepted Solution

by:
Infinity08 earned 250 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 34

Assisted Solution

by:sarabande
sarabande earned 250 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

759 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