w3c的dom
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
  DocumentBuilder builder;
   try    {
   builder  =  factory.newDocumentBuilder();
   Document doc  =  builder.parse( new  ByteArrayInputStream(str.getBytes())); 
  }   catch  (ParserConfigurationException e)   {
    //  TODO Auto-generated catch block 
    e.printStackTrace();
  }   catch  (SAXException e)   {
    //  TODO Auto-generated catch block 
    e.printStackTrace();
  }   catch  (IOException e)   {
    //  TODO Auto-generated catch block 
    e.printStackTrace();
  } 


dom4j
SAXReader saxReader = new SAXReader();
        Document document;
        try {
            document = saxReader.read(new ByteArrayInputStream(str.getBytes()));
            Element incomingForm = document.getRootElement();
        } catch (DocumentException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
评论
发表评论

您还没有登录,请登录后发表评论

小嘴看世界
搜索本博客
我的相册
F9d2dd1b-26f5-3fa8-8934-863e273e9e39-thumb
传说中的奶牛
共 14 张
存档
最新评论