I have a huge XML file with the following structure:
<root>
<a>
<b>
<c>24</c>
<d>26</d>
</b>
<e>1</e>
<f>1</f>
</a>
...
</root>
The element 'a' is several 100 000 times in the document. I want to remove some elements with tag 'a' and found the following questions: this and that
They use XMLModifier for this task, but I can not create a XMLModifier with VTDNavHuge.
My code so far:
VTDGenHuge vg = new VTDGenHuge();
VTDNavHuge vnh = null;
if (vg.parseFile("example.xml",true,VTDGenHuge.MEM_MAPPED))
vnh = vg.getNav();
XMLModifier xm = new XMLModifier(vnh); // can't create the XMLModifier with VTDNavHuge
// I would remove one element with the following code
vnh.toElement(VTDNav.FIRST_CHILD); // get to Node a
long l = vnh.getContentFragment();
xm.remove(l);
I hope somebody can help me with this.