Question: Patch: Use Xml Includes When Parsing Xml
0
gravatar for James Casbon
10.2 years ago by
James Casbon370
James Casbon370 wrote:
Hi, I have inlined a patch that allows xinclude statements in xml files. I presume I cannot send attachments to the list? Motivation: I have my own tools I am developing managed in tools/my_tools. I want to version that directory, etc, but want to be able to include new tools without editing the tools_conf.xml in galaxy_dist each time which would not get versioned. Solution: use xinclude to include an xml file that contains tool definitions. Example tool_conf.xml: <toolbox xmlns:xi="&lt;a href=" http:="" www.w3.org="" 2001="" XInclude"="" rel="nofollow">http://www.w3.org/2001/XInclude"> .... <xi:include href="tools/my_tools/tool_conf.xml" parse="xml"/> </toolbox> Patch below, cheers, James ============== diff -r 3b6771227a43 lib/galaxy/util/__init__.py +++ b/lib/galaxy/util/__init__.py Mon Sep 29 15:50:20 2008 +0100 @@ -12,7 +12,7 @@ from galaxy.util.docutils_ext.htmlfrag import Writer as HTMLFragWriter pkg_resources.require( 'elementtree' ) -from elementtree import ElementTree +from elementtree import ElementTree, ElementInclude log = logging.getLogger(__name__) _lock = threading.RLock() @@ -64,6 +64,8 @@ def parse_xml(fname): """Returns an parsed xml tree""" tree = ElementTree.parse(fname) + root = tree.getroot() + ElementInclude.include(root) return tree def xml_to_string(elem): ================
galaxy • 733 views
ADD COMMENTlink written 10.2 years ago by James Casbon370
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 177 users visited in the last hour