相关疑难解决方法(0)

JAXB - 忽略元素

有没有办法忽略Jaxb解析中的元素?我有一个大的XML文件,如果我可以忽略其中一个大的复杂元素,那么它可能会更快地解析.

如果甚至根本无法验证元素内容并解析文档的其余部分,即使该元素不正确,也会更好.

例如:这应该只生成Foo.element1和Foo.element2

<foo>
    <element1>I want this</element1>
    <element2>And this</element2>
    <bar>
       <a>ALL of bar should be ignored</a>
       <b>this also should be ignored</b>
       <c>
           <x>a lot of C that take time to process</x>
       </c>
       <c>
            <x>a lot of C that take time to process</x>
       </c>
       <c>
          <x>a lot of C that take time to process</x>
       </c>
      <c>
          <x>a lot of C that take time to process</x>
      </c>
  </bar>
</foo>
Run Code Online (Sandbox Code Playgroud)

java xml jaxb unmarshalling

29
推荐指数
4
解决办法
6万
查看次数

标签 统计

java ×1

jaxb ×1

unmarshalling ×1

xml ×1