Created
April 10, 2012 12:42
Unrecognized field ""
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<main> | |
<com.test.stack name="stack1"> | |
<com.test.stack.slot height="0" id="0" name="slot0" width="0">+/null/this is a long string</com.test.stack.slot> | |
</com.test.stack> | |
</main> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test.stack; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
public class Main { | |
@JsonProperty("com.test.stack") | |
public Stack stack; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test.stack; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText; | |
//@JsonIgnoreProperties(ignoreUnknown = true) //Need to have that I'll get an exception | |
public class Slot { | |
@JsonProperty("name") | |
public String name; | |
@JsonProperty("id") | |
public String id; | |
@JsonProperty("height") | |
public String height; | |
@JsonProperty("width") | |
public String width; | |
@JacksonXmlText | |
public String value; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test.stack; | |
import com.fasterxml.jackson.annotation.JsonProperty; | |
public class Stack { | |
public String name; | |
@JsonProperty("com.test.stack.slot") | |
public Slot slot; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test.stack; | |
import java.io.File; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.fasterxml.jackson.dataformat.xml.XmlMapper; | |
public class TestImporter { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) throws Exception { | |
String filename = "resources/emptyField.xml"; | |
ObjectMapper xmlMapper = new XmlMapper(); | |
//xmlMapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); | |
//xmlMapper.configure(DeserializationFeature.USE_JAVA_ARRAY_FOR_JSON_ARRAY, true); | |
Main pojo = xmlMapper.readValue(new File(filename), Main.class); | |
System.out.println(pojo); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment