Hi,
use XMLDataObject.getDocument() to access the DOM. After modifying the DOM,
you can update the file like this:

        final FileObject file = getPrimaryFile();
        file.getFileSystem().runAtomicAction(() -> {
            final FileLock l = file.lock();
            try (final OutputStream os = file.getOutputStream(l)) {
                XMLUtil.write(doc, os, "utf-8");
                //Do something to unregister the Saveable
            } finally {
                l.releaseLock();
            }
        });

Hope it helps.
Boris

On Sun, 17 Jan 2021 at 23:13, Will Hartung <willhart...@gmail.com> wrote:

> I have a XMLMultiView from the generic New File Type wizard.
>
> I'm creating the GUI form for the XML file.
>
> How do I keep the XML file up to date after I make changes in the GUI?
>
> Do I need to create a Saveable and put it in the lookup to mark it as
> "dirty", or will that happen automatically when the XML file is updated?
>
> Can I update the XML file only when the tabs are switched vs for every
> change? In that case, I would have to add a Saveable since the XML may not
> have changed yet.
>
> Anyway, how does that workflow all work out?
>
> Regards,
>
> Will Hartung
>
>

-- 
Boris Heithecker


Dr. Boris Heithecker
Lüneburger Str. 30
28870 Ottersberg
Festnetz: +49 4205 315834
Mobil: +49 170 6137015

Reply via email to