How do I replace old (XML) information with new one?

Q:
I can see that PDFNet can append XML information, but can it replace
the old XML
information?
---
A:

Using PDFNet SDK you can read, write, and edit XML information.

To edit XML information (or other PDF objects) you can replace the old
XML stream with a new one. For example:

// In C++
// Note: StdFile and FilterReader reside in pdftron::Filters
namespace.
// Obj resides in pdftron::SDF namespace.
StdFile embed_file("mystream.xml", StdFile::e_read_mode);
FilterReader mystm(embed_file);
Obj* new_stm = pdfdoc.CreateIndirectStream(doc, mystm);

Obj* old_stm = ...

// Replace the old stream with a new one:

pdfdoc.GetSDFDoc()->Swap(old_stm->GetObjNum(), new_stm->GetObjNum());

// Using C#:

// Note: StdFile and FilterReader reside in pdftron.Filters namespace.
// Obj resides in pdftron.SDF namespace.

// Create a new stream ...
Obj new_stm = pdfdoc.CreateIndirectStream(doc, mystm);
Obj old_stm = ...

// Replace the old stream with a new one:
pdfdoc.GetSDFDoc().Swap(old_stm.GetObjNum(), new_stm.GetObjNum());