Discussion:
[fpc-pascal] fpdoc error with XML parsing
Graeme Geldenhuys
2018-07-02 20:11:23 UTC
Permalink
Hi,

What is illegal about this fpdoc XML project file? fpdoc from FPC 3.1.1
keeps giving an exception error reading the XML document. The issue it
has is with the XML Comment I have on lines 2-5 (ignore the line
wrapping caused by my email client). If I remove that comment, then the
XML is read, parsed and the documentation is generated without problem.
But I fail to see what the problem is - the xml syntax looks fine to me.

====================================
<?xml version="1.0" encoding="utf-8"?>
<!--
Run using:
fpdoc --macro=FPCDIR=/data/devel/fpc-3.1.1/src
--sproject=rtl-project.xml
-->
<docproject>
<options>
<option name="ostarget" value="FreeBSD"/>
<option name="cputarget" value="x86_64"/>
...snip...>
====================================

Here is the actual error:

$> /data/devel/fpc-3.1.1/x86_64-freebsd/bin/fpdoc
--macro=FPCDIR=/data/devel/fpc-3.0.4/src --project=rtl-project.xml
FPDoc - Free Pascal Documentation Tool
Version 3.1.1 [2017/11/20]
(c) 2000 - 2003 Areca Systems GmbH / Sebastian Guenther, ***@freepascal.org
(c) 2005 - 2012 various FPC contributors

Exception at 000000000052F81A: EXMLReadError:
In 'stream:' (line 4 pos 13): Expected ">".

$>



Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key: http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.
w***@windstream.net
2018-07-02 20:28:43 UTC
Permalink
What is illegal about this fpdoc XML project file? fpdoc from FPC 3.1.1 keeps
giving an exception error reading the XML document. The issue it has is with
the XML Comment I have on lines 2-5 (ignore the line wrapping caused by my
email client). If I remove that comment, then the XML is read, parsed and the
documentation is generated without problem. But I fail to see what the
problem is - the xml syntax looks fine to me.
can fpdoc process comments spanning multiple lines?
what happens if you comment each line individually?
--
NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list unless*
*a signed and pre-paid contract is in effect with us.*
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepasca
Graeme Geldenhuys
2018-07-02 23:07:35 UTC
Permalink
Post by w***@windstream.net
can fpdoc process comments spanning multiple lines?
Yes it can. That same XML file contains multi-line comments too, and
those don't give issues.

eg:
============================================
...snip...
<option name="emit-notes" value="false"/>
<option name="hide-protected" value="true"/>
<!--
<option name="footer-date" value="yyyy-mm-dd"/>
<option name="format" value="html"/>
-->
<option name="format" value="ipf"/>
</options>
...snip...
============================================
Post by w***@windstream.net
what happens if you comment each line individually?
I tried this, it made no difference. fpdoc still choked.. Again, ignore
the line wrapping caused by my email client. The comments are all in one
line each.

==============================================
<?xml version="1.0" encoding="utf-8"?>
<!-- Run using:-->
<!-- fpdoc --macro=FPCDIR=/data/devel/fpc-3.1.1/src
--sproject=rtl-project.xml-->
<docproject>
<options>
<option name="ostarget" value="FreeBSD"/>
<option name="cputarget" value="x86_64"/>
<option name="hide-protected" value="true"/>
...snip...

============================================


$> /data/devel/fpc-3.1.1/x86_64-freebsd/bin/fpdoc
--macro=FPCDIR=/data/devel/fpc-3.0.4/src --project=rtl-project.xml
FPDoc - Free Pascal Documentation Tool
Version 3.1.1 [2017/11/20]
(c) 2000 - 2003 Areca Systems GmbH / Sebastian Guenther, ***@freepascal.org
(c) 2005 - 2012 various FPC contributors

Exception at 000000000052F81A: EXMLReadError:
In 'stream:' (line 3 pos 17): Expected ">".

$>


From that error message it doesn't seem to like the "--macro" part
inside the xml comment. It seems fpdoc wants to process that "--" as the
end of the comment.

As a test I replaced the two "--" parts in the comment on line 3 with a
single "-" each - just to test. Magically fpdoc now processes the XML
file without issues.

Using Mozilla Firefox (the web browser) and opening the original XML
file, it too fails with a validation error. So I guess "--" is not
allowed inside a xml comment block. Another reason to dislike XML. ;-)



Regards,
Graeme
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key: http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo
w***@windstream.net
2018-07-03 16:52:47 UTC
Permalink
From that error message it doesn't seem to like the "--macro" part inside the
xml comment. It seems fpdoc wants to process that "--" as the end of the
comment.
this was where i was headed... if the multi-line comments work properly, perhaps
it is the "--" being misinterpreted...
As a test I replaced the two "--" parts in the comment on line 3 with a
single "-" each - just to test. Magically fpdoc now processes the XML file
without issues.
it seems to me that the end of the comment should be being hunted as "-->"
instead of just "--"... i don't know the code, though...
Using Mozilla Firefox (the web browser) and opening the original XML file, it
too fails with a validation error. So I guess "--" is not allowed inside a
xml comment block. Another reason to dislike XML. ;-)
that's interesting... perhaps there's some form of escaping "--" in comments??
--
NOTE: No off-list assistance is given without prior approval.
*Please keep mailing list traffic on the list unless*
*a signed and pre-paid contract is in effect with us.*
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.fre
Bart
2018-07-03 21:56:14 UTC
Permalink
So I guess "--" is not allowed inside a
xml comment block. Another reason to dislike XML. ;-)
W3C XML validator says it's invalid XML: " invalid comment
declaration: found name start character outside comment but inside
comment declaration" and it points at the "m" (from macro).

Bart
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/list
George Bakhtadze
2018-07-03 08:45:27 UTC
Permalink
_______________________________________________
fpc-pascal maillist - fpc-***@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Loading...