[mapguide-internals] Generating Xml for "Select Features"

Kenneth, GEOGRAF A/S ks at geograf.dk
Tue Jun 26 07:25:55 EDT 2007

When using the "Select Features" from the Http API, the result comes 
back in Xml.
The call chain is:

MgByteSource::MgByteSource(char* data, int len)
ByteSourceMemoryImpl::ByteSourceMemoryImpl(char* data, int len)
MgByte::MgByte(char* data, int len, AllocatorType allocator)

When the size of the Xml to return grows, MgByte throws an exception in 
line 34:
    if (len > MgByte::MaxSize && allocator != MgByte::None)
        throw new MgArgumentOutOfRangeException(L"MgByte.MgByte", 
__LINE__, __WFILE__, NULL, L"", NULL);

This happens because the ByteSourceMemoryImpl does not pass an 
AllocatorType argument, and thus defaults to MgByte::None.
A simple solution would be to fix this error in ByteSourceMemoryImpl, 
but I don't have enough overview to see if this has other implications.

I will happily submit a patch for ByteSourceMemoryImpl, but is that an 
acceptable solution?

I would prefer if the code was changed, so that 
ProxyFeatureReader::ToXml() took a stream as input, and wrote to that 
That would also improve response/perfomance time, as the current 
implementation buffers the entire result, and also uses the std::string 
+ operator, which has a high overhead for large strings.

Is the second solution something that could be accepted as a patch? I 
so, I will happily submit a patch for it.

Regards, Kenneth, GEOGRAF A/S

More information about the mapguide-internals mailing list