Here you can find the source of extractLocalName(String uri)
public static String extractLocalName(String uri)
//package com.java2s; //License from project: Open Source License import java.net.URI; public class Main { private static final String GRID = "#"; private static final String SLASH = "/"; private static final String PROTOCOL_DELIMITER = "://"; public static String extractLocalName(String uri) { return extractLocalName(URI.create(uri)); }//from w ww .j av a 2 s . c om public static String extractLocalName(URI uri) { String uriString = uri.toASCIIString().replace(uri.getScheme() + PROTOCOL_DELIMITER + uri.getHost(), ""); int index; if (uriString.contains(GRID)) { index = uriString.indexOf(GRID) + 1; } else if (uriString.contains(SLASH)) { index = uriString.lastIndexOf(SLASH) + 1; } else { return null; } if (uriString.length() > index) { return uriString.substring(index); } else { return null; } } }