【问题标题】:SimpleXML - How to ignore the class attribute when deserializingSimpleXML - 反序列化时如何忽略类属性
【发布时间】:2013-05-14 13:17:53
【问题描述】:

我在反序列化这个时遇到问题:

<tutorial name="tutinteractif1"
    context="MPCaptureCtlr"
    type="interactive"
    class="CaptureTutorialLevelDoors">

问题是Simple使用classattribute i来选择java类来反序列化xml对象。我的问题是:如何告诉 Simple 使用 class 作为标准属性或至少忽略它?

【问题讨论】:

标签: java simple-framework


【解决方案1】:

使用不同的策略

Strategy strategy = new TreeStrategy("myClass", "myLength");
Persister persister = new Persister(strategy);

现在,使用“myClass”代替“class”。

【讨论】:

    猜你喜欢
    • 2013-04-07
    • 2017-03-07
    • 1970-01-01
    • 1970-01-01
    • 2016-03-02
    • 2021-12-18
    • 2015-01-12
    • 1970-01-01
    • 2013-07-29
    相关资源
    最近更新 更多