1

I have a huge XML file of 9 GB where i need to add a node:

XML File like:

<ABC>
  <DEF>
    <GHI>
      <AB>"ab"</AB>
       <CD>"cd"</CD>
       <EF>"ef"</EF> --NEED TO ADD
    </GHI>
  </DEF>
</ABC>
<PQR>
</PQR>

This is fixed that need too add in only ABC tag . XDocument will need so much resources any help is appreciated

2
  • possible duplicate of Add new node to xml tree Commented Feb 8, 2012 at 11:37
  • 2
    @sani - No, the 9GB constraint means it is very much not a duplicate of that question. The answer there is not usable here. Commented Feb 8, 2012 at 11:40

2 Answers 2

2

Have a look here at how to stream in an XML document to avoid loading it in one go, then simply match on the element(s) you desire and add what you need in.

Sign up to request clarification or add additional context in comments.

1 Comment

Interesting, I didn't know about XStreamingElement.
0

Use XmlReader/XmlWriter, XmlTextReader/XmlTextWriter (see here). These are fast, forward only reader/writers, that do not load the whole xml in one go so should cope with large files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.