Interpret all relative file paths in XML as relative to the XML file location #326

Closed
artemp opened this Issue Oct 11, 2011 · 5 comments

Projects

None yet

1 participant

@artemp
Owner
artemp commented Oct 11, 2011

This will allow easier bundling of data with XML mapfiles.

Currently any relative paths found in the XML file for datasources or symbols are interpreted relative to the script process loading the XML (which is often variable or unpredictable).

The attached patch switches this behavior to ensure that relative path be relative to the XML location, while providing an optional level parameter for optionally maintaining the earlier behavior by setting it to "false":

{{{

}}}

Therefore the new behavior introduced by the patch will be in effect if 'paths_from_xml="true"' or if this option is not provided.

Tests are included with the patch based on the new testing framework Beau has added. Just run them with

{{{
$ nosetests
}}}

  • you should get no errors from the 'good_maps' folder of tests. (currently trunk - r1110 - has 5 python_tests failures).

This ticket is a replacement for #147

Owner
artemp commented Oct 11, 2011

[migurski] I agree, this behavior would be vastly preferable.

Owner
artemp commented Oct 11, 2011

[mishok13] This feature would be extremely nice to have.

Owner
artemp commented Oct 11, 2011

[springmeyer] great, thanks for the feedback.

applied in r1124

Owner
artemp commented Oct 11, 2011

[springmeyer] Need to look into handling this within each xml parser as it appears (duh) that libxml may offer built in support for this that will allow this to work when loading xml from a string as well (see #440):

http://xmlsoft.org/html/libxml-parser.html#xmlCtxtReadFd
http://xmlsoft.org/html/libxml-parser.html#xmlCtxtReadMemory

Owner
artemp commented Oct 11, 2011

[springmeyer] nope, appears only that libxml2 offers a way to set the 'url' (aka base_path) from reading from a string.

@artemp artemp closed this Oct 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment