Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Extract element.
     *
     * @param xml
     *            the xml
     * @param name
     *            the name
     * @return the string
     */
    public static String extractElement(final String xml, final String name) {
        if (xml.indexOf("<" + name) > 0) {
            return xml.substring(xml.indexOf("<" + name), xml.indexOf("</" + name + ">") + name.length() + 3);
        }
        return "";
    }
}