|
|
@ -5,8 +5,11 @@ import com.thoughtworks.xstream.XStream; |
|
|
import com.thoughtworks.xstream.io.naming.NoNameCoder; |
|
|
import com.thoughtworks.xstream.io.naming.NoNameCoder; |
|
|
import com.thoughtworks.xstream.io.xml.Xpp3Driver; |
|
|
import com.thoughtworks.xstream.io.xml.Xpp3Driver; |
|
|
import com.thoughtworks.xstream.security.AnyTypePermission; |
|
|
import com.thoughtworks.xstream.security.AnyTypePermission; |
|
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
|
public class DownXml2Json { |
|
|
public class DownXml2Json { |
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(DownXml2Json.class); |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 默认为对上级的客户端的别名 |
|
|
* 默认为对上级的客户端的别名 |
|
|
@ -189,6 +192,8 @@ public class DownXml2Json { |
|
|
//设备告警数据 |
|
|
//设备告警数据 |
|
|
public String AlarmControlXml2Json(String xml) { |
|
|
public String AlarmControlXml2Json(String xml) { |
|
|
XStream xStream = new XStream(new Xpp3Driver(new NoNameCoder())); |
|
|
XStream xStream = new XStream(new Xpp3Driver(new NoNameCoder())); |
|
|
|
|
|
//xStream.alias(alias, AlarmControl.class); |
|
|
|
|
|
logger.info("[XML] AlarmControlXml2Json alias: {}", alias); |
|
|
xStream.alias(alias, AlarmControl.class); |
|
|
xStream.alias(alias, AlarmControl.class); |
|
|
xStream.autodetectAnnotations(true); |
|
|
xStream.autodetectAnnotations(true); |
|
|
xStream.ignoreUnknownElements(); |
|
|
xStream.ignoreUnknownElements(); |
|
|
|