Re: [xml] updating namespace prefix of QName



On 29/08/19 14:31 -0700, Eric Eberhard wrote:
In these weird cases - and I have a few - if you have the
performance for your task, just load it as is (or as you created)
then write to disk.

I don't have any trick for the problem original poster raised,
but whenever possible, I'd recommend against any "disk grounded"
round-trips.

Have a small C program change it.  Reload it.  Tacky but always
works.  Simple too.

Assuming the whole logic leveraging libxml2 can share the same
program, it can be turned into:

- dump to buffer (e.g. xmlDocDumpFormatMemory)
- do something with buffer (e.g. string replacement)
- read buffer back (e.g. xmlReadDoc)
- continue as if the original DOM was used
  (forget about using previously stored references to the original
  DOM for any identity checking purposes, amongst other Don'ts...)

Slightly less performance which if that matters is a bad idea.
I have found that on new machines performance is not an issue.

-- 
Jan (Poki)

Attachment: pgp_m691fJdOj.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]