DOM 操作【eos BL】

 /**
  * 節點爲空就X
  *
  * @param doc
  *            type: Document, DOM;
  * @param param
  *            type: BizContext;
  * @return: int ,運算邏輯返回值,如果失敗返回0,成功返回1
  * @throws Exception
  *             <p> ** bizlet 的顯示名稱 **
  * @bizlet_displayName BL_ObjectTrim
  * @bizlet_param passing="in_out" type="EOSEntity" value="/" name="" desc=""
  */
 public static int BL_ObjectTrim(Document doc, BizContext param)
   throws Exception {
  Node param0 = (Node) param.getParaObjectAt(0);
  NodeList nodes = param0.getChildNodes();
  int returnCode = 0;
  for (int i = 0; i < nodes.getLength(); i++) {
   Node currentNode = nodes.item(i);
//   String nodeValue = XmlUtil.getNodeValue(currentNode);
   String nodeValue =(String) currentNode.getFirstChild().getNodeValue();
   
   System.out.println( nodeValue + "~~~~~~~~~~~~~~~~~");
   
   if (nodeValue.trim().length() == 0) {
    param0.removeChild(currentNode);
    returnCode++;
   }
  }
  System.out.println("共X掉"+returnCode + "~~~~~~~~~~~~~~~~~");
  return returnCode;
 }

}

 

發佈了45 篇原創文章 · 獲贊 26 · 訪問量 16萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章