Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

xml parsing

Posted on 2011-09-13
2
Medium Priority
?
336 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 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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

715 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