I have the following html code:

<name>Username</name>
<kills>1</kills>
<ach_count>3</ach_count>

And on and on.....

I am looking for a code that extracts the value from <tag></tag> and puts them into variable.

I don't want to use HTML Agility Pack, don't ask why.Also XML is not an option for me.

I hope you understand what i am looking for. If you have further question, ask.

Recommended Answers

All 2 Replies

You can use jQuery for pulling data. It's fairly simple.

Here's an example using your code.

http://jsfiddle.net/yZPve/

name = $("name").text();
kills = $("kills").text();
ach_count = $("ach_count").text();

alert(name);
alert(kills);
alert(ach_count);

The alerts are just to show that the data is being pulled.

If you've never used jQuery before, you need to download the jQuery library or include them from the google hosted server into the head tags of your page. Here's the libraries that you can include from Google.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>

Hope this helps.

I looking for the code for vb.net

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.