Android examples for XML:Namespace
Combined the XML namespace and the local name back together.
/*************************************** * ViPER * * The Video Processing * * Evaluation Resource * * * * Distributed under the GPL license * * Terms available at gnu.org. * * * * Copyright University of Maryland, * * College Park. * ***************************************/ //package com.java2s; import java.io.*; import java.net.*; public class Main { public static void main(String[] argv) throws Exception { String ns = "java2s.com"; String lname = "java2s.com"; System.out.println(unsplit(ns, lname)); }//from www.ja va 2 s. c o m private static final String charset = "UTF-8"; /** * Combined the namespace and the local name back together. * @param ns the namespace uri * @param lname the local name * @return the joined uri */ public static String unsplit(String ns, String lname) { return unsplit(ns, lname, "#"); } /** * Combined the namespace and the local name back together. * @param ns the namespace uri * @param lname the local name * @param joiner the join string, e.g. <code>#</code> * @return the joined uri */ public static String unsplit(String ns, String lname, String joiner) { if (!ns.endsWith(joiner)) { ns += joiner; } try { return ns + URLEncoder.encode(lname, charset); } catch (UnsupportedEncodingException e) { throw new RuntimeException("You don't support " + charset + "?"); } } }