-1

I'm writing a program where into a string I've the code of an HTML page. Now, I need to get the text between the <article> tag. My html page contain more than one article tag, so I need to get the text of the different article tags

An example of the article tag is:

<article class="item" data-recipe="119726">
        <a class="loopimg pvideo" href="http://www.cookaround.com/ricetta/pasta-frolla-4.html" title="Leggi: Pasta frolla"><img src="http://cdn.cook.stbm.it/thumbnails/ricette/119/119726/hd400x225.jpg" alt="Leggi: Pasta frolla" /></a>
        <h3><a href="http://www.cookaround.com/ricetta/pasta-frolla-4.html" title="Leggi: Pasta frolla">Pasta frolla</a></h3>
        <ul><li>Difficoltà <span>bassa</span></li><li class="costo">Costo <span>basso</span></li><li>Realizzazione <span>10 min</span></li></ul>
    </article>

So, I need to get the title="Leggi: Pasta frolla" of every article tag where the title is different for each tag.

How can I do this using c++?

Silvia B
  • 45
  • 3
  • 10

1 Answers1

0

I would recommend to use Boost, a very powerful library.

Maybe you have a look at this question Parsing XML Attributes with Boost, which should address your problem.

Community
  • 1
  • 1
Cr3at0rX
  • 36
  • 7
  • How can I add **Boost** in Visual Studio 2015? @Cr3at0rX – Silvia B Apr 04 '16 at 14:21
  • A quick search on google gave me this [link](https://www.youtube.com/watch?v=GOhHMS4I9Zw) – Cr3at0rX Apr 04 '16 at 14:23
  • but If don't have a *xml* file but a string containing the html code? However thanks to the link @Cr3at0rX – Silvia B Apr 04 '16 at 14:29
  • Just use the search function. http://stackoverflow.com/questions/5289086/how-to-feed-boost-propertytree-with-a-string-not-a-file – Cr3at0rX Apr 04 '16 at 14:31
  • I tried to use it but... if I read the string which contain the whole html code I show this error: `expected =` what is the problem? @Cr3at0rX – Silvia B Apr 04 '16 at 15:44