znat
znat

Reputation: 13474

SimpleXML - How to ignore the class attribute when deserializing

I have problem deserializing this:

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

The problem is that Simple uses classattribute ito select the java class to deserialize the xml object with. My question is: How to tell Simple to use class as a standard attribute or at least to ignore it?

Upvotes: 4

Views: 914

Answers (1)

ng.
ng.

Reputation: 7189

Use a different strategy

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

Now, "myClass" is used instead of "class".

Upvotes: 3

Related Questions