如何查看此序列化的xml内容?

时间:2015-02-01 18:50:12

标签: java xml jaxb

当我发送一个我对我的应用程序感兴趣的特定远程查询时,我会撤回一个如下所示的xml文档:

<content>
    <id>694</id>
    <serializedContent>
        rO0ABXoAAAJlCgYIBRAEGABKwgQIABJIb3JnLmRyb29scy5jb3JlLm1hcnNoYWxsaW5nLmltcGwuU2VyaWFsaXphYmxlUGxhY2Vob2xkZXJSZXNvbHZlclN0cmF0ZWd5GvMDrO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAAEdwQAAAAEdAALcXVlcmllZFRhc2t0AAVhZG1pbnQAC1F1ZXJpZWRUYXNrc3IAEWphdmEudXRpbC5IYXNoTWFwBQfawcMWYNEDAAJGAApsb2FkRmFjdG9ySQAJdGhyZXNob2xkeHA/QAAAAAAADHcIAAAAEAAAAAN0AAhUYXNrTmFtZXNyADdjb20uZ29vZ2xlLnByb3RvYnVmLkdlbmVyYXRlZE1lc3NhZ2VMaXRlJFNlcmlhbGl6ZWRGb3JtAAAAAAAAAAACAAJbAAdhc0J5dGVzdAACW0JMABBtZXNzYWdlQ2xhc3NOYW1ldAASTGphdmEvbGFuZy9TdHJpbmc7eHB1cgACW0Ks8xf4BghU4AIAAHhwAAAAEgoIVGFza05hbWUQABoEAAAAAHQAL29yZy5qYnBtLm1hcnNoYWxsaW5nLmltcGwuSkJQTU1lc3NhZ2VzJFZhcmlhYmxldAAHR3JvdXBJZHNxAH4ACHVxAH4ADAAAABEKB0dyb3VwSWQQABoEAAAAAXEAfgAOdAAITm9kZU5hbWVzcQB+AAh1cQB+AAwAAAASCghOb2RlTmFtZRAAGgQAAAACcQB+AA54eFIWCgx2YXJpYWJsZXNNYXAQABoEAAAAAw==
    </serializedContent>
</content>

来自该工具的有关查询的文档:

  

[GET] / task / {taskId} / content
  从给定任务ID识别的任务中获取任务内容   返回带有任务内容的JaxbContent。 URL的taskId组件必须符合以下正则表达式:[0-9] +

我想知道的是:我在“序列化内容”中看到了什么?标签,我该如何反序列化呢?

1 个答案:

答案 0 :(得分:2)

序列化内容最像是base6Binary,如果您自己处理它,可以使用DatatypeConverter类,如下所示:

byte[] binary = DatatypeConverter.parseBase64Binary(string);

如果你想将它映射到JAXB,你可以在课后使用thr:

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Content {

    private int id;

    private byte[] serializedContent;

}