Java has a set of classes that will enable you to parse the value of tags in between. These two methods are helper methods that I use in order to get the value of the tag. This is good for first level tags only. If you need to parse xml tags that have depths of more than one level, these methods will not work. This code will only work once you have access to the tag node.

The first method requires you to have reference to the Node object. The String parameter is the tag name itself and it is case sensitive. Changing the equals() to equalsIgnoreCase() will not work either. It is just the way it is. Once you have the node object, you can get the value of the tag by using the second method. You can use both of them right away in one line.

Related Posts Plugin for WordPress, Blogger...