Davy,

On Sat, 2006-04-08 at 11:04 +0200, Davy Toch wrote:
> Question : isn't there a way in XXE to force XInclude/parse="text"
> sections not being resolved, even when the file it points to exists?
> This way, the person editing the DocBook document wouldn't need to
> perform 1) or 2).

The trick I use to get around this is to create a "proxy" file
containing all the parse="text" includes, and the xinclude elements from
this file normally. So:

1. Include sourcefile.c in proxyfile.xml with parse="text". Probably
wrap the include in a <programlisting> that you equip with an id
attribute so you can include the programlisting smoothly.

2. Include the <programlisting> from proxyfile.xml in your real
document.xml.

This way the included contents of sourcefile.c won't be expanded in
document.xml - only if you open proxyfile.xml will XXE expand the
source.

For further convenience I've written a little utility that will generate
the proxyfile.xml by: reading a directory of source files, including
each file in a <programlisting> and setting the id attribute to the
filename of the included source. If the source gets updated, all I have
to do is to run the util to generate a new proxyfile.xml and I'm all
set.

Hope this provides some inspiration.

/claus

-- 
Technical Communicator
Web: http://techwriter.dk/
Phone: (+45) 262 000 94
Email: claus at techwriter.dk


Reply via email to