Here you can find the source of isValidURI(final String namespace)
Parameter | Description |
---|---|
namespace | the string being checked |
public static boolean isValidURI(final String namespace)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 SAP AG.//from ww w .ja va2 s . c om * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Emil Simeonov - initial API and implementation. * Dimitar Donchev - initial API and implementation. * Dimitar Tenev - initial API and implementation. * Nevena Manova - initial API and implementation. * Georgi Konstantinov - initial API and implementation. * Keshav Veerapaneni - initial API and implementation. *******************************************************************************/ import java.net.URISyntaxException; public class Main { /** * Determine if the supplied name is a valid URI. * * @param namespace * the string being checked * @return true if the supplied name is indeed a valid URI, or false * otherwise */ public static boolean isValidURI(final String namespace) { if (namespace == null || namespace.length() == 0) return false; try { new java.net.URI(namespace); } catch (final URISyntaxException e) { return false; } return true; } }