本来是以做数据挖掘的目的进去哪网的,结构却成了系统开发。。。
不过还是比较认真的做了三个月,老师很认同我的工作态度和成果。。。
实习马上就要结束了,总结一下几点之前没有注意过的变成习惯和问题,分享给大家。
同时打个广告:去哪网内审部招JavaWeb开发实习生,时间非常自由,每周一天、周六周日甚至都可以,时间充裕的小伙伴给我留言啊,挣个零花钱,还能长点经验。。。。(保研的、想工作的大四狗最合适不过了。。。)
首先给出XML的结构,鉴于文件涉密,只给出大概结构(每个workflow的内容):
<processes> <process vender="www.joinwork.net" version="2.3.1" type="Node" flowType="workflow"> <node id="start" name="nameStart" type="typeStart"> <actor role="roleStart" condition="1"/> <seeyonPolicy id="id1" name="name1" type="type1"/> </node> <node id="id1" name="name1" type="type1"> <actor role="role1" condition="1"/> <seeyonPolicy id="id2" name="name2" type="type2"/> </node> <node id="end" name="nameEnd" type="typeEnd"> <seeyonPolicy id="id3" name="name3" type="type3"/> </node> <link id="id1" name="" type="11" desc="" from="start" to="id1"/> <link id="id2" name="" type="11" desc="" from="id1" to="end"/> </process> </processes>
项目中导入dom4j-1.6.1.jar:
http://download.csdn.net/detail/mmc2015/9035527
读写代码:
SAXReader saxReader = new SAXReader(); //read each workflow rs = dbConn.getSelectResultSet(sql_workflow, conn_oa); while(rs.next()){ String workflow = rs.getString("workflow");//read current workflow String xmlHeader ="<?xml version=\"1.0\" encoding=\"GB2312\"?>"; String workflowXml = xmlHeader+workflow; InputStream is = new ByteArrayInputStream(workflowXml.getBytes()); Document doc = saxReader.read(is); Element rootEle = doc.getRootElement(); Element processEle = rootEle.element("process"); List<Element> nodeEleList = processEle.elements("node"); for (Element element : nodeEleList) { String nodeId = element.attributeValue("id");//we need String nodeType = element.element("seeyonPolicy").attribute("id").getValue();//we need String nodeName = element.attributeValue("name");//we need String FromNodeID = "";//we need String ToNodeID = "";//we need List<Element> linkEleList = processEle.elements("link"); for (Element element2 : linkEleList) { String fromNodeID = element2.attributeValue("from"); String toNodeID = element2.attributeValue("to"); if(nodeId.equals(toNodeID)){ FromNodeID = fromNodeID; } if(nodeId.equals(fromNodeID)){ ToNodeID = toNodeID; } } } }
String xmlHeader ="<?xml version=\"1.0\" encoding=\"GB2312\"?>";
或
String xmlHeader ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
另外的总结:
去哪网实习总结:递归构建“流程执行顺序”的XML文件(JavaWeb)
去哪网实习总结:已完毕,但是网页上有错误(JavaWeb)
去哪网实习总结:JavaWeb中使用jquery提交表单(JavaWeb)
去哪网实习总结:easyui在JavaWeb中的使用,以datagrid为例(JavaWeb)
去哪网实习总结:java读写excel表格(JavaWeb)
去哪网实习总结:定时发送邮件(JavaWeb)
去哪网实习总结:如何获取Web项目的根目录(JavaWeb)
去哪网实习总结:JavaWeb配置404页面(JavaWeb)
去哪网实习总结:JavaWeb中文传参乱码问题的解决(JavaWeb)