public final static Map<String, String> analysisPatientRegistryAddRequestMessage(String message) {
Map<String, String> mapValue = new HashMap<String, String>();
if (StringUtils.isEmpty(message)) {
return mapValue;
}
//将xml文件解析成Document对象
Document doc=DocumentHelper.parseText(message);
//获取xml文档的根标签
Element root=doc.getRootElement();\
//获取根标签下的第一个id标签
Element id=root.element("id");
//获取extension属性值
Attribute id_extension=id.attribute("extension");
String id_val=id_extension.getStringValue();
mapValue.put("_id",id_val);
//获取creationTime=root.element("creationTime”);
Element creationTime=Root.element("creationTime");
Attribute cv=creationTime.attribute("value");
String cv_value=getStringValue("value");
//获取根标签下的第一个controlActProcess标签
Element controlActProcess = root.element("controlActProcess");
//获取controlActProcess标签下的第一个subject标签
Element subject = controlActProcess.element("subject");
Element registrationRequest = subject.element("registrationRequest");
Element subject1 = registrationRequest.element("subject1");
Element patient = subject1.element("patient");
// sourceId
Element sourceId = patient.element("id");
if (sourceId != null) {
Attribute sourceId_extension = sourceId.attribute("extension");
String se_value = sourceId_extension.getStringValue();
mapValue.put("SOURCE_ID", se_value);
}
}
xml文件解析
最新推荐文章于 2023-09-20 14:58:48 发布