Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.IOException;

import java.io.StringReader;
import java.util.LinkedList;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import com.sun.org.apache.xerces.internal.parsers.DOMParser;

public class Main {
    public static LinkedList<String> uc_unserialize(String input) {

        LinkedList<String> result = new LinkedList<String>();

        DOMParser parser = new DOMParser();
        try {
            parser.parse(new InputSource(new StringReader(input)));
            Document doc = parser.getDocument();
            NodeList nl = doc.getChildNodes().item(0).getChildNodes();
            int length = nl.getLength();
            for (int i = 0; i < length; i++) {
                if (nl.item(i).getNodeType() == Document.ELEMENT_NODE)
                    result.add(nl.item(i).getFirstChild().getNodeValue());
            }
        } catch (SAXException e) {

        } catch (IOException e) {

        }
        return result;
    }
}