4

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.

Community
  • 1
  • 1
stJando
  • 41
  • 1
  • How big is your file? over 2GB? – vtd-xml-author Feb 16 '17 at 20:10
  • Your question moved me to test again, if it's possible to not use the extended version of vtd-xml and now it worked. The file is around 100MB, but will grow in the future, and contains 4.5 mio lines. The first time i tried vtd-xml there was an error regarding to the size of the file and I wondered why. With the extended version it worked. So I decided to use the extended version. So the question is actual not needed anymore, but I'm (and maybe some others are) interested, if there is a way to modifiy a huge file or rather if there is a way planned? Sorry for the possible unnecessary question. – stJando Feb 17 '17 at 07:59
  • I want to make changes to huge files all the time (2GB-8GB). I would be very interested in how to do this. – enahel Nov 23 '17 at 07:58

0 Answers0