This is the mail archive of the
mailing list for the DocBook project.
Re: [docbook] Listing a kickstart XML file within Docbook
- From: Guillaume Cottenceau <gc at mnc dot ch>
- To: Kerry Cox <kerryjcox at gmail dot com>
- Cc: docbook at lists dot oasis-open dot org
- Date: 19 Nov 2004 09:32:48 +0100
- Subject: Re: [docbook] Listing a kickstart XML file within Docbook
- References: <email@example.com>
Kerry Cox <kerryjcox 'at' gmail.com> writes:
> I am attempting to explain to beginning users here at my job how to
> create a kickstart file for use with Red Hat servers. As we use
> Opsware provisioning software, this kickstart XML file has gotten
> rather bulky and I am getting all sorts of errors as I attempt to
> render it under Docbook.
> I have tried <programlisting> and the <![CDATA[ ]]> tags. Regular
> comments do not prohibit the xml tags and Bash scripts within the
> sample XML from causing havoc with Docbook.
> I have also tried <computeroutput> and no success.
> Any suggestions for rendering XML files within Docbook?
If you can filter the source XML files before building the
docbook source file, you may want to "xml escape" them, e.g.
substitute XML special chars with their entity counterparts.
The following is an example of such a function in emacs-lisp. If
you need something automated this is probably not the best way,
("&" . "&") ; keep this one in first position
("<" . "<")
(">" . ">")
("'" . "'")
("\"" . """)
(mapconcat (lambda (entry) (car entry)) xml-escape-translate-map "\\|"))
(defun xml-escape ()
"escape XML special characters"
(let ((save-point (point-marker)))
(if (> (point) (mark)) (exchange-point-and-mark))
(while (re-search-forward xml-escape-search-for (mark) t)
(cdr (assoc (match-string 0) xml-escape-translate-map)) t t))