プルパーサー(org.xmlpull.v1.XmlPullParser
)を使用して大きなXMLドキュメントを解析しています。特定のノードに到達したら、そのノードとそのすべての子をテキストのチャンクとして取得し(または、子だけでも問題ありません)、文字列として保存します。これを達成するための効率的な方法は何でしょうか?(本質的に)より良いものはありbuffer.append('<').append(xpp.getName()).append('>')
ますか?
これが例です
<root id="root">
<node>
<grab-all-inside>
<!-- bunch of nodes, attributes etc. that needs to be saved as text -->
</grab-all-inside>
</node>
<node>
<grab-all-inside>
<!-- bunch of nodes, attributes etc. that needs to be saved as text -->
</grab-all-inside>
</node>
<node>
<grab-all-inside>
<!-- bunch of nodes, attributes etc. that needs to be saved as text -->
</grab-all-inside>
</node>
</root>
PS他のパーサーや手法を使用したほうがよいと思われる場合は、提案を受け付けています。補足として、これらのテキストチャンクは、ある時点で抽出および解析されることを前提として、dbにシリアル化されます。