Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-07

fpdoc error with XML parsing

6 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

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, (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

Reply by email

Unknown author
to Graeme Geldenhuys
Graeme Geldenhuys wrote 6 lines
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.*

Reply by email

Graeme Geldenhuys
to Unknown author
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...
============================================

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, (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

Reply by email

Unknown author
to Graeme Geldenhuys: Yes it can. That same XML file contains multi-line comments too, and those don't give…
Graeme Geldenhuys wrote
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.*

Reply by email

Bart
to Unknown author
> 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

Reply by email