Having the redundant ns declarations bloats the file and slows parsing. I do
not know if it bloats/slows transmission of a similar hierarchy such as an
array of objects converted with XmlSerializer in the following web service:
[WebMethod]
MyStruct[] foo() {
MyStruct[] bar = new MyStruct[5];
for (int i = 0; i < 5 ++i) {
bar[i] = new MyStruct();
}
return bar;
}
Does each MyStruct in bar have its own namespace declaration in transit as
below, or does each MyStruct inherit the namespace declaration of
ArrayOfMyStruct?
<ArrayOfMyStruct xmlns="http://yadayada">
<MyStruct xmlns="http://yadayada">
...
</MyStruct>
<MyStruct xmlns="http://yadayada">
...
</MyStruct>
...
</ArrayOfMyStruct>
I am just trying to optimize my program for transmission/space/UI-latency
and XML handling is often a major offender. Having an Xml web-service that
transmits twice as much information as is necessary to yield the same effect
is silly, annoying, and detracts from a product that consumes it.
Greg
> > If I have an XmlDocument with a deep hierarchy of nodes, with a
> > documentElement having an attribute xmlns="http://someurl.com" and all
[quoted text clipped - 12 lines]
>
> John
John Saunders - 19 Mar 2007 18:02 GMT
> Having the redundant ns declarations bloats the file and slows parsing. I
> do
[quoted text clipped - 31 lines]
> effect
> is silly, annoying, and detracts from a product that consumes it.
Thanks for the reply, Greg.
My only addition is to ask by how much does it detract from the program that
consumes it? Have you measured the performance loss versus the cost of
fixing the problem?
Also, have you measured just how bad the problem is? Is the file really
twice as large?
Thanks,
John