This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
Re: [docbook-apps] <programlisting> escape sequences and error: detected an error in element
- From: "Bob Stayton" <bobs at sagehill dot net>
- To: "Sheldon Plankton" <sheldonplankton at yahoo dot com>, Camille Bégnis <camille at neodoc dot biz>, <docbook-apps at lists dot oasis-open dot org>
- Date: Fri, 10 Sep 2004 10:38:44 -0700
- Subject: Re: [docbook-apps] <programlisting> escape sequences and error: detected an error in element
- References: <20040910165657.98525.qmail@web53503.mail.yahoo.com>
You could keep the content as an external code listing. See the section on
"External code files" in:
http://www.sagehill.net/docbookxsl/ProgramListings.html
Bob Stayton
Sagehill Enterprises
DocBook Consulting
bobs@sagehill.net
----- Original Message -----
From: "Sheldon Plankton" <sheldonplankton@yahoo.com>
To: "Sheldon Plankton" <sheldonplankton@yahoo.com>; "Camille Bégnis"
<camille@neodoc.biz>; <docbook-apps@lists.oasis-open.org>
Sent: Friday, September 10, 2004 9:56 AM
Subject: Re: [docbook-apps] <programlisting> escape sequences and error:
detected an error in element
> I took out the spaces in the CDATA tag like so ...
> <?xml version="1.0"?>
> <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML
> V4.1.2//EN"
> "/usr/share/sgml/docbook/xml-dtd-4.2-1.0-17/docbookx.dtd">
> <article>
> <articleinfo>
> <title>Example</title>
> </articleinfo>
> <sect1> <title>Example</title> <para>
> <![CDATA[
> WhichEncryptCipher () {
> #######################
> ENC_PROG_CIPHER=`cat /etc/recovery/EncryptedWith`
> if [ -z "${ENC_PROG_CIPHER}" ]; then
> ENC_PROG_PASSWD=""
> ENC_PROG="cat"
> else
> print "^[[1;33mEnter your encryption
> password^[[36m\n"
> stty -echo < `tty`
> read passwd < `tty`
> stty echo < `tty`
> #ENC_PROG_PASSWD="-pass pass:${passwd}"
> touch /tmp/.key
> chmod 600 /tmp/.key
> echo ${passwd} < /tmp/.key
> ENC_PROG_PASSWD="-kfile /tmp/.key"
> ENC_PROG="openssl"
> fi
> ]]>
> </para>
> </sect1>
> </article>
>
> and I get a different error ...
>
> xsltproc -o example.html ../notes.xsl example.xml
> example.xml:17: error: CData section not finished
>
> WhichEncryptCipher () {
> #######################
> E
> print "Enter your encryption password\n"
> ^
> example.xml:17: error: detected an error in element
> content
> print "Enter your encryption password\n"
> ^
> example.xml:17: error: Premature end of data in tag
> para
> print "Enter your encryption password\n"
> ^
> example.xml:17: error: detected an error in element
> content
> print "Enter your encryption password\n"
> ^
> example.xml:17: error: Premature end of data in tag
> sect1
> print "Enter your encryption password\n"
> ^
> example.xml:17: error: detected an error in element
> content
> print "Enter your encryption password\n"
> ^
> example.xml:17: error: Premature end of data in tag
> article
> print "Enter your encryption password\n"
> ^
> example.xml:17: error: Extra content at the end of the
> document
> print "Enter your encryption password\n"
> ^
> unable to parse example.xml
>
> ?????????
> --- Sheldon Plankton <sheldonplankton@yahoo.com>
> wrote:
>
> > Thanks. Maybe I don't understand what I should do? I
> > tried changing my example.xml to this ...
> >
> > <?xml version="1.0"?>
> > <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML
> > V4.1.2//EN"
> >
> "/usr/share/sgml/docbook/xml-dtd-4.2-1.0-17/docbookx.dtd">
> > <article>
> > <articleinfo>
> > <title>Example</title>
> > </articleinfo>
> > <sect1> <title>Example</title> <para>
> > <![ CDATA [
> >
> >
> >
> >
> >
> > WhichEncryptCipher () {
> > #######################
> > ENC_PROG_CIPHER=`cat /etc/recovery/EncryptedWith`
> > if [ -z "${ENC_PROG_CIPHER}" ]; then
> > ENC_PROG_PASSWD=""
> > ENC_PROG="cat"
> > else
> > print "^[[1;33mEnter your encryption
> > password^[[36m\n"
> > stty -echo < `tty`
> > read passwd < `tty`
> > stty echo < `tty`
> > #ENC_PROG_PASSWD="-pass pass:${passwd}"
> > touch /tmp/.key
> > chmod 600 /tmp/.key
> > echo ${passwd} < /tmp/.key
> > ENC_PROG_PASSWD="-kfile /tmp/.key"
> > ENC_PROG="openssl"
> > fi
> > }
> > ]]>
> > </para>
> > </sect1>
> > </article>
> >
> > And I get the this error ...
> >
> > xsltproc -o example.html ../notes.xsl example.xml
> > example.xml:9: error: xmlParseStartTag: invalid
> > element name
> > <![ CDATA [
> > ^
> >
> > How should I be using CDATA?
> >
> > Thanks
> >
> >
> > --- Camille Bégnis <camille@neodoc.biz> wrote:
> >
> > > On Friday 10 September 2004 00:29, Sheldon
> > Plankton
> > > wrote:
> > > > Hi,
> > > >
> > > > I am having problems with <programlisting>
> > docbook
> > > tag
> > > > I think. I want to list a shell script that
> > makes
> > > use
> > > > of escape sequences to do fancy color stuff on
> > the
> > > > terminal. Yes I know that's a bad idea ... but
> > > it
> > > > ain't my script I just need to document it :)
> > >
> > > Did you try enclosing your listing in a CDATA
> > > section?
> > >
> > > > Here's is a short example of what I am doing
> > ....
> > > >
> > > >
> > > >
> > > > bash-2.05b$ xsltproc -o example.html
> > ../notes.xsl
> > > > example.xml
> > > > example.xml:18: error: detected an error in
> > > element
> > > > content
> > > > print "Enter your encryption password\n"
> > > > ^
> > > > example.xml:18: error: Premature end of data in
> > > tag
> > > > programlisting
> > > > print "Enter your encryption password\n"
> > > > ^
> > > > example.xml:18: error: detected an error in
> > > element
> > > > content
> > > > print "Enter your encryption password\n"
> > > > ^
> > > > example.xml:18: error: Premature end of data in
> > > tag
> > > > para
> > > > print "Enter your encryption password\n"
> > > > ^
> > > > example.xml:18: error: detected an error in
> > > element
> > > > content
> > > > print "Enter your encryption password\n"
> > > > ^
> > > > example.xml:18: error: Premature end of data in
> > > tag
> > > > sect1
> > > > print "Enter your encryption password\n"
> > > > ^
> > > > example.xml:18: error: detected an error in
> > > element
> > > > content
> > > > print "Enter your encryption password\n"
> > > > ^
> > > > example.xml:18: error: Premature end of data in
> > > tag
> > > > article
> > > > print "Enter your encryption password\n"
> > > > ^
> > > > example.xml:18: error: Extra content at the end
> > of
> > > the
> > > > document
> > > > print "Enter your encryption password\n"
> > > > ^
> > > > unable to parse example.xml
> > > >
> > > > Here's what I have in example.xml ...
> > > >
> > > > <?xml version="1.0"?>
> > > > <!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook
> > > XML
> > > > V4.1.2//EN"
> > > >
> > >
> >
> "/usr/share/sgml/docbook/xml-dtd-4.2-1.0-17/docbookx.dtd">
> > > > <article>
> > > > <articleinfo>
> > > > <title>Example</title>
> > > > </articleinfo>
> > > > <sect1> <title>Example</title> <para>
> > > > <programlisting>
> > > >
> > > >
> > > >
> > > >
> > > > WhichEncryptCipher () {
> > > > #######################
> > > > ENC_PROG_CIPHER=`cat
> > /etc/recovery/EncryptedWith`
> > > > if [ -z "${ENC_PROG_CIPHER}" ]; then
> > > > ENC_PROG_PASSWD=""
> > > > ENC_PROG="cat"
> > > > else
> > > > print "^[[1;33mEnter your encryption
> > > > password^[[36m\n"
> > > > stty -echo < `tty`
> > > > read passwd < `tty`
> > > > stty echo < `tty`
> > > > #ENC_PROG_PASSWD="-pass pass:${passwd}"
> > > > touch /tmp/.key
> > > > chmod 600 /tmp/.key
> > > > echo ${passwd} > /tmp/.key
> > > > ENC_PROG_PASSWD="-kfile /tmp/.key"
> > > > ENC_PROG="openssl"
> > > > fi
> > > > }
> > > > #-----<--------->-------
> > > > </programlisting>
> > > > </para>
> > > > </sect1>
> > > > </article>
> > > > bash-2.05b$
> > > >
> > > > Also the < are mine shouldn;t the
> > > programlisting
> > > > tag be able to deal with <'s ???
> > > >
> > > > Thanks
> > > > Sheldon :)
> > > >
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Yahoo! Mail - 50x more storage than other
> > > providers!
> > > > http://promotions.yahoo.com/new_mail
> > >
> > > --
> > > Camille Bégnis
> > > NeoDoc Co-Founder
> > > http://neodoc.biz
> > >
> >
> === message truncated ===
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>