XStream生成的XML中带class属性,去掉class属性

xiaoxiao2025-08-02  27

使用XStream将对象转化成XML时遇到一个问题:

xml元素上带class属性。如:

解决办法:

XStream xStream = new XStream(); xStream.autodetectAnnotations(true); xStream.aliasSystemAttribute(null, "class"); // 去掉 class 属性 xStream.toXML(obj)
转载请注明原文地址: https://www.6miu.com/read-5034175.html

最新回复(0)