fpdoc error with XML parsing

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

fpdoc error with XML parsing

Graeme Geldenhuys-6
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, [hidden email]
(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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc error with XML parsing

wkitty42
On 07/02/2018 04:11 PM, Graeme Geldenhuys wrote:
> 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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc error with XML parsing

Graeme Geldenhuys-6
On 07/02/18 21:28, [hidden email] wrote:
> 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, [hidden email]
(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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc error with XML parsing

George Bakhtadze-2
"--" in comments is not allowed by XML standard.
As a workaround it may be replaced by it's UTF-8 equivalent "&#x002D;".
https://stackoverflow.com/questions/10842131/xml-comments-and
 
03.07.2018, 02:08, "Graeme Geldenhuys" <[hidden email]>:
> On 07/02/18 21:28, [hidden email] wrote:
>>  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.
...

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc error with XML parsing

wkitty42
In reply to this post by Graeme Geldenhuys-6
On 07/02/2018 07:07 PM, 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.*
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: fpdoc error with XML parsing

Bart-48
On Tue, Jul 3, 2018 at 6:52 PM,  <[hidden email]> wrote:

>> 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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal