This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: I Need to insert C-language code into DocBook XML
- From: "Matt G." <matt_g_ at hotmail dot com>
- To: dbook at centrum dot cz
- Cc: docbook-apps at lists dot oasis-open dot org
- Date: Thu, 14 Mar 2002 05:12:17 +0000
- Subject: DOCBOOK-APPS: Re: I Need to insert C-language code into DocBook XML
- Bcc:
>From: dbook@centrum.cz
>To: docbook-apps@lists.oasis-open.org
>Subject: DOCBOOK-APPS: I Need to insert C-language code into DocBook XML
>Date: Tue, 12 Mar 2002 22:08:39 +0100
>
>I have problem - how to put into DocBook XML content of file with
>C-language code? Problem is, that this content must be placed in external
>file (source.c), no directly in DocBook XML.
I don't see why modifying the C code is such a problem. I would create a
proper external parsed entity, by using sed to replace all the dangerous
characters. Assuming you only have to worry about ampersands and angle
brackets, that would look like:
sed "s/&/\&/g; s/</\</g; s/>/\>/g" source.c > source.c.xml
Then, use source.c.xml, instead of source.c. If you use a makefile to build
your document, you could codify this into a rule, so that it would
automatically get rerun, every time source.c was modified. FSF (The Free
Software Foundation) has very good documentation for GNU Make, on their web
site (fsf.org).
If you use windows, you can get UNIX tools (such as sed and make) via the
free "cygwin" package, available from RedHat (just search for it, on their
site).
Matt Gruenke
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com