Solved

xml parsing

Posted on 2011-09-13
2
335 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

623 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