jcplerm wrote:
jcplerm wrote:
I noticed that whenever an element of an XML document is removed by
means of an XUpdate remove command, blank spaces are left in place of
the removed element.
My application does lots of XUpdate removes and appends on medium sized
XML docs. As I result I will end up with large documents containing lots
of spaces.
For example, assuming this is the original XML doc:
<doc>
<elem1>xxxx</elem1>
<elem2>xxxx</elem2>
</doc>
After removing elem2 and adding elem3 this is how that doc would look
like after exporting it to a flat text file:
<doc>
<elem1>xxxx</elem1>
<elem2>xxxx</elem3>
</doc>
For relatively static documents, it's not a problem.
But even for small docs, if they are extensively through a similar
process, they might grow too large, unnecessarily.
Could this be considered a bug and be properly fixed?
Or is there a straightforward workaround?
If you're manipulating the DOM, have you tried Node.normalize()? It
I guess I would then have to pull the whole document out of the DB
and apply this function, right?
But that's not what I want to do. I simply fetch portions of the
document with XPathQueryService and then update that same
document with XUpdate commands. The goal is to avoid
fetching and massaging the entire document.
All parts of a DOM Document are composed of DOM Nodes -- it's the base
interface. So you can apply it to any portion of a DOM Document, not
just org.w3c.dom.Document. If you can use XUpdate to overwrite portions
of a Document, this should work just fine in manipulating those portions.
Murray
...........................................................................
Murray Altheim http://kmi.open.ac.uk/people/murray/
Knowledge Media Institute
The Open University, Milton Keynes, Bucks, MK7 6AA, UK .
"There's a lot of intelligence out there that you don't
know if it's true or not." -- Anonymous US official
http://news.bbc.co.uk/1/hi/world/middle_east/3014850.stm