有没有办法忽略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)