Opened 19 years ago
Closed 19 years ago
#3931 closed enhancement (wontfix)
PATCH: Add <include_file src="includefile.xml"/> functionality to xmlparser
| Reported by: | Owned by: | Isaac Richards | |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.21 |
| Component: | mythtv | Version: | head |
| Severity: | medium | Keywords: | include xml parse |
| Cc: | Ticket locked: | no |
Description
The attached patch adds an <include_src> tag to the xmlparser in libmyth/xmlparse.cpp.
parent_file,xml:
<mythuitheme>
<include_file src="include_file.xml" />
<!-- OR -->
<include_file src="include_file.xml">
Some comment text can go here.
</include_file>
</mythuitheme>
included_file.xml:
<container>
<font name="title" face="Arial">
<color>#ffff00</color>
<dropcolor>#000000</dropcolor>
<size>24</size>
<shadow>3,3</shadow>
<bold>yes</bold>
</font>
<font name="labels" face="Arial">
<color>#ffff00</color>
<dropcolor>#000000</dropcolor>
<size>18</size>
<shadow>3,3</shadow>
<bold>yes</bold>
</font>
</container>
final_document:
<mythuitheme>
<font name="title" face="Arial">
<color>#ffff00</color>
<dropcolor>#000000</dropcolor>
<size>24</size>
<shadow>3,3</shadow>
<bold>yes</bold>
</font>
<font name="labels" face="Arial">
<color>#ffff00</color>
<dropcolor>#000000</dropcolor>
<size>18</size>
<shadow>3,3</shadow>
<bold>yes</bold>
</font>
<!-- OR -->
<font name="title" face="Arial">
<color>#ffff00</color>
<dropcolor>#000000</dropcolor>
<size>24</size>
<shadow>3,3</shadow>
<bold>yes</bold>
</font>
<font name="labels" face="Arial">
<color>#ffff00</color>
<dropcolor>#000000</dropcolor>
<size>18</size>
<shadow>3,3</shadow>
<bold>yes</bold>
</font>
</mythuitheme>
Include file requirements
- The included file must be a well formed xml document, errors will be reported
- All children (of the root element) of the included document will be inserted into the parent document
- A recursion limit protects from circular includes
Include search path
- The included file will be searched for in the standard search path as used for the main xml file
- If either the parent.xml file or any include_file.xml cannot be found in the search path then the file load fails
One possible use would allow a theme developer to only "theme" the desired <window>'s in a plugin without a needing to theme the entire plugin. I believe this will enable a finer grained level of reuse for theme files than the current plugin level.
eg The main mythmusic playback window could be themed but include the default/music-metadata.xml file for the meta data editor.
Attachments (2)
Change History (6)
by , 19 years ago
| Attachment: | mythtv_xml_include_v1.diff added |
|---|
follow-up: 2 comment:1 by , 19 years ago
One possible use would allow a theme developer to only "theme" the desired <window>'s in a plugin without a needing to theme the entire plugin. I believe this will enable a finer grained level of reuse for theme files than the current plugin level.
Are you sure it doesn't already do something like this? I can't be bothered to check now but it certainly used to look in the chosen theme file then if not found fall back to the default theme file.
http://www.gossamer-threads.com/lists/mythtv/dev/123109
A lot of things *have* moved around since that patch though in the UI rewrite.
comment:2 by , 19 years ago
Replying to paulh:
One possible use would allow a theme developer to only "theme" the desired <window>'s in a plugin without a needing to theme the entire plugin. I believe this will enable a finer grained level of reuse for theme files than the current plugin level.
Are you sure it doesn't already do something like this? I can't be bothered to check now but it certainly used to look in the chosen theme file then if not found fall back to the default theme file.
I think you are right Paul, the current version of the patch breaks that I think. I will look at it and fix it up.
by , 19 years ago
| Attachment: | mythtv_xml_include_v2.diff added |
|---|
v2 addresses the issue raised by paulh
comment:3 by , 19 years ago
Having looked at the issue raised by paulh above I have updated the patch.
V1 of the patch definitely broke the <window name="win_name"> search.
comment:4 by , 19 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
Replying to Roo <roo.watt@gmail.com>:
One possible use would allow a theme developer to only "theme" the desired <window>'s in a plugin without a needing to theme the entire plugin. I believe this will enable a finer grained level of reuse for theme files than the current plugin level.
eg The main mythmusic playback window could be themed but include the default/music-metadata.xml file for the meta data editor.
The existing code allows for the above automatically. If a window definition isn't found in a theme then the default one will be used anyway.
If that is all you are trying to do then this patch is redundant and IMHO just complicates theme handling without any great benefit that I can see.

v1 of patch, search path for parent and inluded files