XML URL Decode

Encoded XML URL
Sample
Decoded XML

XML URL Decode Tool Manual

If you have encoded XML data in a URL-compatible format, the XML URL Decode tool can help you decode your XML data back to its original format. This tool is free, online, and requires no system or software dependencies. In this manual, we'll introduce the features of the tool, explain how to use it, and provide code examples in Python, C, PHP, and Java.

Features

The XML URL Decode tool has the following features:

  • Online and free, no system and software dependencies
  • Can Clear,Can Copy,Have Sample
  • Data security, local computing

Tool Introduction

The XML URL Decode tool allows you to decode your encoded XML data back to its original format. Simply input your encoded XML data, click the "Decode" button, and the tool will convert your encoded XML data back to its original format. You can also encode your XML data into a URL-compatible format by clicking the "Encode" button.

How to Use

To use the XML URL Decode tool, follow these steps:

  1. Input your encoded XML data into the input box. You can also use the sample data provided.
  2. Click the "Decode" button to convert your encoded XML data back to its original format.
  3. If you need to encode the XML data into a URL-compatible format, click the "Encode" button.
  4. You can copy the encoded or decoded data by clicking the "Copy" button or using the standard copy command (CTRL+C or CMD+C).

Code Examples

Here are some code examples in Python, C, PHP and Java that show how to use the XML URL Decode tool.

Python

import urllib.parse

encoded_data = '%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20%3F%3E%0A%3CInsuranceCompanies%3E%0A%09%3CTop_Insurance_Companies%3E%0A%09%09%3CName%3EBerkshire%20Hathaway%20(%20BRK.A)%3C%2FName%3E%0A%09%09%3CMarket_Capitalization%3E%24655%20billion%3C%2FMarket_Capitalization%3E%0A%09%3C%2FTop_Insurance_Companies%3E%0A%3C%2FInsuranceCompanies%3E%0A'
decoded_data = urllib.parse.unquote(encoded_data)
print(decoded_data)

C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

char *xml_urldecode(char *str);

int main()
{
    char encoded_data[] = "%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20%3F%3E%0A%3CInsuranceCompanies%3E%0A%09%3CTop_Insurance_Companies%3E%0A%09%09%3CName%3EBerkshire%20Hathaway%20(%20BRK.A)%3C%2FName%3E%0A%09%09%3CMarket_Capitalization%3E%24655%20billion%3C%2FMarket_Capitalization%3E%0A%09%3C%2FTop_Insurance_Companies%3E%0A%3C%2FInsuranceCompanies%3E%0A";
    char *decoded_data = xml_urldecode(encoded_data);
    printf("%s", decoded_data);
    free(decoded_data);
    return 0;
}

char *xml_urldecode(char *str)
{
    size_t len = strlen(str);
    char *new_str = malloc(len + 1);
    char *pstr = str;
    char *pnew = new_str;
    int val;
    while (*pstr)
    {
        if (*pstr == '%')
        {
            if (sscanf(pstr + 1, "%02x", &val) != 1)
            {
                val = '?';
            }
            *pnew++ = val;
            pstr += 3;
        }
        else if (*pstr == '+')
        {
            *pnew++ = ' ';
            pstr++;
        }
        else
        {
            *pnew++ = *pstr++;
        }
    }
    *pnew = '\0';
    return new_str;
}

PHP

$encoded_data = '%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20%3F%3E%0A%3CInsuranceCompanies%3E%0A%09%3CTop_Insurance_Companies%3E%0A%09%09%3CName%3EBerkshire%20Hathaway%20(%20BRK.A)%3C%2FName%3E%0A%09%09%3CMarket_Capitalization%3E%24655%20billion%3C%2FMarket_Capitalization%3E%0A%09%3C%2FTop_Insurance_Companies%3E%0A%3C%2FInsuranceCompanies%3E%0A';
$decoded_data = urldecode($encoded_data);
echo $decoded_data;

Java

import java.net.URLDecoder;
import java.io.UnsupportedEncodingException;

public class XmlUrlDecode {
    public static void main(String[] args) throws UnsupportedEncodingException {
        String encoded_data = "%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20%3F%3E%0A%3CInsuranceCompanies%3E%0A%09%3CTop_Insurance_Companies%3E%0A%09%09%3CName%3EBerkshire%20Hathaway%20(%20BRK.A)%3C%2FName%3E%0A%09%09%3CMarket_Capitalization%3E%24655%20billion%3C%2FMarket_Capitalization%3E%0A%09%3C%2FTop_Insurance_Companies%3E%0A%3C%2FInsuranceCompanies%3E%0A";
        String decoded_data = URLDecoder.decode(encoded_data, "UTF-8");
        System.out.println(decoded_data);
    }
}

Conclusion

The XML URL Decode tool is a simple and convenient way to decode your encoded XML data back to its original format. It's online, free, and requires no system or software dependencies. You can use it to recover your encoded XML data with confidence, knowing that your data is secure and easy to encode if necessary.

Frequently Asked Questions (FAQ)

Meet our more Tools