How to extract variables from between html tags?
-
Suppose something like this: [code] <span class="gugugug">1</span> <span class="krakaka">enchanted</span><span class="gagaga">chocolate bar</span> <span class="gugugug">2</span> <span class="krakaka">very remarkable</span><span class="gagaga">flavored cookies</span> <span class="gugugug">3</span> <span class="krakaka">fascinating</span><span class="gagaga">strawberries</span> (...) <span class="gugugug">254</span> <span class="krakaka">amazing</span><span class="gagaga">pineapples</span> (...) [/code] And it goes on. I need to extract the numbers and words between the <span> and </span> tags ("1", "enchanted", "chocolate bar", "2", "very remarkable", and so on) and put it in a bidimensional array. But what piece of code do I need in order to extract from between the tags? I'm imagining it's something easy, but I'm completely new, whereas you guys are extremely good, so please help. :)
-
Suppose something like this: [code] <span class="gugugug">1</span> <span class="krakaka">enchanted</span><span class="gagaga">chocolate bar</span> <span class="gugugug">2</span> <span class="krakaka">very remarkable</span><span class="gagaga">flavored cookies</span> <span class="gugugug">3</span> <span class="krakaka">fascinating</span><span class="gagaga">strawberries</span> (...) <span class="gugugug">254</span> <span class="krakaka">amazing</span><span class="gagaga">pineapples</span> (...) [/code] And it goes on. I need to extract the numbers and words between the <span> and </span> tags ("1", "enchanted", "chocolate bar", "2", "very remarkable", and so on) and put it in a bidimensional array. But what piece of code do I need in order to extract from between the tags? I'm imagining it's something easy, but I'm completely new, whereas you guys are extremely good, so please help. :)
Have you checked out MSXML? It will parse the xml and let you deal with through an object model.
-
Have you checked out MSXML? It will parse the xml and let you deal with through an object model.
I do not know what language you are using, but since it is posted under C/C++/MFC tab, I assume that it is....Pardon me, I just came here through a google search so I found the post under C/C++/MFC tab. Now as said by the previous reply u got, you can use MSXML. Or if you have an option of using .NET (C# or VB.NET), then you can just make use of HTMLDocument, HTMLElement, HTMLElementCollection classes, and get the tags and the info inside them. Then use .NET interop to bring them to native C++. Or you can just use /clr option that VC++ compiler provides u and write managed code in C++ application as well...Other than that, I am also waiting for a good method or previous code that has been posted on the net to do it. I had hoped to find some information about this on MSDN, but in vain. Eventually, I hope something in this regards is posted some where... Bhushan
-
I do not know what language you are using, but since it is posted under C/C++/MFC tab, I assume that it is....Pardon me, I just came here through a google search so I found the post under C/C++/MFC tab. Now as said by the previous reply u got, you can use MSXML. Or if you have an option of using .NET (C# or VB.NET), then you can just make use of HTMLDocument, HTMLElement, HTMLElementCollection classes, and get the tags and the info inside them. Then use .NET interop to bring them to native C++. Or you can just use /clr option that VC++ compiler provides u and write managed code in C++ application as well...Other than that, I am also waiting for a good method or previous code that has been posted on the net to do it. I had hoped to find some information about this on MSDN, but in vain. Eventually, I hope something in this regards is posted some where... Bhushan
In this message board the correct assumption is native C/C++. There are seperate message boards for .net, C#, and managed C++. So the best answer is MSXML and there are plenty of examples available by googling MSXML Examples.
-
Have you checked out MSXML? It will parse the xml and let you deal with through an object model.