kinferkan / discuz-ucenter-api-for-java

Automatically exported from code.google.com/p/discuz-ucenter-api-for-java
0 stars 0 forks source link

jar file with bad directory structure #2

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1.Current jar file contain the 'class/com/fivestars/...'
shold be 'com/fivestars/...'

2.When I build with maven, there warning :  "Sun proprietary api" 

recommedate replace the "XMLHelper.java" with code below:

//-------------------------------------------------
package com.fivestars.interfaces.bbs.util;

import java.io.IOException;
import java.util.LinkedList;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;

/**
 * ================================================
 * Discuz! Ucenter API for JAVA
 * ================================================
 * XML工具类,处理UC Client接收到返回结果。
 * UC Client会收到UC Server返回的XML结果
 * 该类将XML中的数据提取成一个List按顺序读取即可。
 * 
 * 更多信息:http://code.google.com/p/discuz-ucenter-api-for-java/
 * 作者:梁平 (no_ten@163.com) 
 * 创建时间:2009-2-20
 */
public class XMLHelper {

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

        LinkedList<String> result = new LinkedList<String>();
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           DocumentBuilder parser = null;

        //DOMParser parser = new DOMParser();
        try {           
            parser = factory.newDocumentBuilder();

            Document doc =  parser.parse(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).getTextContent());
            }
        } catch (SAXException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ParserConfigurationException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        return result;
    }
}

Original issue reported on code.google.com by wanxiang.xing@gmail.com on 9 Oct 2009 at 4:57

GoogleCodeExporter commented 9 years ago

Original comment by wanxiang.xing@gmail.com on 9 Oct 2009 at 5:00

GoogleCodeExporter commented 9 years ago
Document doc =  parser.parse(new InputSource(new StringReader(input)));

Original comment by wanxiang.xing@gmail.com on 9 Oct 2009 at 5:21

GoogleCodeExporter commented 9 years ago
result.add(nl.item(i).getChildNodes().item(0).toString());

Original comment by wanxiang.xing@gmail.com on 10 Oct 2009 at 12:25

GoogleCodeExporter commented 9 years ago

Original comment by wanxiang.xing@gmail.com on 10 Oct 2009 at 12:28

Attachments: