Java URL Decode xmlDecode(String s)

Here you can find the source of xmlDecode(String s)

Description

Decodes reserved characters in an xml string

License

Open Source License

Parameter

Parameter Description
s the string to decode

Return

the newly decoded string

Declaration

public static String xmlDecode(String s) 

Method Source Code

//package com.java2s;
/*//  w  w  w . jav a 2 s  .  c o m
 * Copyright (c) 2004-2012 The YAWL Foundation. All rights reserved.
 * The YAWL Foundation is a collaboration of individuals and
 * organisations who are committed to improving workflow technology.
 *
 * This file is part of YAWL. YAWL is free software: you can
 * redistribute it and/or modify it under the terms of the GNU Lesser
 * General Public License as published by the Free Software Foundation.
 *
 * YAWL is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
 * Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with YAWL. If not, see <http://www.gnu.org/licenses/>.
 */

import java.io.*;

import java.net.URLDecoder;

public class Main {
    /**
     * Decodes reserved characters in an xml string
     *
     * @param s the string to decode
     * @return the newly decoded string
     */
    public static String xmlDecode(String s) {
        if (s == null)
            return s;
        try {
            return URLDecoder.decode(s, "UTF-8");
        } catch (UnsupportedEncodingException uee) {
            return s;
        }
    }
}

Related

  1. urlDecode(String text)
  2. urlDecodeBytes(String key)
  3. urlDecodeFilename(char[] input)
  4. urlDecodeInplace(StringBuilder input)
  5. urlDecoder(String encoded)