Here you can find the source of parseTagValue(String xml, String tag, String endTag)
Parameter | Description |
---|---|
xml | a parameter |
tag | a parameter |
endTag | a parameter |
public static String parseTagValue(String xml, String tag, String endTag)
//package com.java2s; //License from project: Apache License public class Main { /**//from w w w . java 2 s .co m * This method parse the xml tag value. * * @param xml * @param tag * @param endTag * @return */ public static String parseTagValue(String xml, String tag, String endTag) { String val = ""; try { int index1 = xml.indexOf(tag) + tag.length(); int index2 = xml.indexOf(endTag, index1); if (index1 > -1 && index2 > -1) { val = xml.substring(index1, index2); } } catch (Throwable thrown) { val = null; } return val; } }