OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook] Listing a kickstart XML file within Docbook

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,
though :)

(defvar xml-escape-translate-map
    ("&"  . "&amp;") ; keep this one in first position
    ("<"  . "&lt;")
    (">"  . "&gt;")
    ("'"  . "&apos;")
    ("\"" . "&quot;")

(defvar xml-escape-search-for
  (mapconcat (lambda (entry) (car entry)) xml-escape-translate-map "\\|"))

(defun xml-escape ()
  "escape XML special characters"
  (if (mark)
      (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))
        (goto-char save-point)

Guillaume Cottenceau

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]