public void updateXMLbyId(String id, UpLoadFile pat) {
    String xmlStr = xml2String();
    Document document = null;
    try {
      document = DocumentHelper.parseText(xmlStr);
    } catch (DocumentException e) {
      // TODO 自动生成的 catch 块
      e.printStackTrace();
    }
    Element rootElement = document.getRootElement();
    String rootStrV = rootElement.getStringValue();
    String rootStrT = rootElement.getText();
    List<Element> elements = rootElement.elements("file");

    for (Element ele : elements) {
      Element ide = ele.element("id");
      if (id.equalsIgnoreCase(ide.getTextTrim())) {
        Element nameElement = ele.element("name");
        Element crcElement = ele.element("crc");
        Element urlElement = ele.element("url");
        Element pathElement = ele.element("path");
        Element isUpElement = ele.element("isUpFastFDS");

        nameElement.setText(pat.getName());
        crcElement.setText(pat.getCrc());
        urlElement.setText(pat.getUrl());
        pathElement.setText(pat.getPath());
        isUpElement.setText(pat.getIsUpFastFDS());
      }
    }

    writeXML(file, document);
  }
 /**
  * @Title: toFileNode @Description: TODO(这里用一句话描述这个方法的作用)
  *
  * @param @param pat
  * @param @param root 参数说明
  * @return void 返回类型
  * @throws
  */
 public static void toFileNode(UpLoadFile pat, Element root) {
   Element ele = root.addElement("file");
   ele.addElement("id").addText(pat.getId());
   ele.addElement("name").addText(pat.getName());
   ele.addElement("crc").addText(pat.getCrc());
   ele.addElement("url").addText(pat.getUrl());
   ele.addElement("path").addText(pat.getPath());
   ele.addElement("isUpFastFDS").addText(pat.getIsUpFastFDS());
 }