However…
if you have multi-levels in the XML…where the tags are indented…several levels…
using string replace is not a good option…
I have to replace the following with ><
<
<
<
<
…
when we use the documentToXMLString…
it basically adds a lot of white space and doubles the string size it generates.
The find string above does not show up correctly…
< with 1 space char
< with 2 space char
< with 3 space char
etc.
Hi ,
If we want to get rid of new lines and spaces here is what I have tried and it worked.I guess there is no inbuilt machenism to remove extra lines and spaces .you just need to play with some services.
Thanks,
Amol.
Since your concern was for the size of the XML string, and thus presumably about the memory consumed by the string, you will want to consider that any manipulation of the XML string will result in at least double the memory usage.
In the past I’ve implemented a way to control the documentToXMLString formatting but alas I know longer have the information. That would be the way to go if you really want to change the format.
But I would advise this–leave it as is. There is likely very little benefit to gain in removing the whitespace between end/begin element tags. Unless the XML you’re generating is huge (say 500MB+) then you’re probably better off just accepting the existing format.