Opened 8 years ago

Closed 8 years ago

#3793 closed defect (fixed)

make VRT detection less fragile

Reported by: sderle Owned by: warmerdam
Priority: normal Milestone: 1.8.0
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

18:55 < Schuyler> why would GDAL refuse to recognize a VRT file that I generated programmatically?
18:56 < Schuyler> xmllint claims that it's clean XML
18:56 < FrankW> Because it is improperly formed, and doesn't start with <VRTRasterDataset>
18:56 < FrankW> err  "<VRTDataset"
18:57 < Schuyler> so VRT isn't really XML?
18:57 < Schuyler> does indentation matter?
18:57 < FrankW> The VRT recognition stuff looks for <VRTDataset to be the first first characters.
18:57 < FrankW>     if( (poOpenInfo->nHeaderBytes > 20 
18:57 < FrankW>          && EQUALN((const char *)poOpenInfo->pabyHeader,"<VRTDataset",11)) )
18:57 < FrankW>         return TRUE;
18:58 < FrankW> So it is a peculiar dependency.;
18:58 < FrankW> you likely have an encoding line first?
18:58 < Schuyler> ahh.
18:58 < Schuyler> I had a blank line first.
18:58 < FrankW> BTW, if you file a ticket I can make the format identification logic less fragile.
18:58 < Schuyler> thank you, Frank, that was it.
18:58 < Schuyler> *nod*
18:58 < Schuyler> how would you go about doing that?
18:59 < FrankW> I'd like just search for <VRTDataset anywhere in the first few hundred characters.

Change History (1)

comment:1 Changed 8 years ago by Even Rouault

Resolution: fixed
Status: newclosed

Fixed in r20944. It can accept <?xml version="1.0"?> prolog for example.

Note: See TracTickets for help on using tickets.