XQDoc doesn't handle & in URLs

Bug #944795 reported by Paul J. Lucas on 2012-03-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
High
Sorin Marian Nasoi

Bug Description

If one has a URL within XQDoc documentation that contains a &, e.g.:

: When using the WordNet implementation,
: Zorba supports all of the relationships (and their abbreviations)
: specified by
: <a href="http://www.niso.org/kst/reports/standards?step=2&gid=&project_key=7cc9b583cb5a62e8c15d3099e0bb46bbae9cf38a">ANSI/NISO Z39.19-2005</a>.

the parser complains:

can not parse as XML for xqdoc: loader parsing error: EntityRef: expecting ';'
; raised at /Users/pjl/src/flwor/zorba/repo/feature-ft_module/zorba/src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp:417

Related branches

Changed in zorba:
assignee: William Candillon (wcandillon) → Sorin Marian Nasoi (sorin.marian.nasoi)
Changed in zorba:
status: New → Invalid

Marked the bug as invalid.
All special characters have to be replaced by their corresponding XHTML entities:
In the same way as you:
 - replace < with &lt; or &#60;
 - replace > with &gt; or &#62;
you also have to
- replace & with &amp; or &#38;

In other works the XHTML part you want to include in the XQDoc documentation of a module *have to be* VALID XHTML:
You were trying to add a piece of XHTML similar with this one:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<body>
<a href="http://www.niso.org/kst/reports/standards?step=2&gid=&project_key=7cc9b583cb5a62e8c15d3099e0bb46bbae9cf38a">ANSI/NISO Z39.19-2005</a>
</body>
</html>

which is not valid (see http://validator.w3.org/check)

Instead you should have replaced the & with &amp; or &#38; meaning:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<body>
<a href="http://www.niso.org/kst/reports/standards?step=2&amp;gid=&amp;project_key=7cc9b583cb5a62e8c15d3099e0bb46bbae9cf38a">ANSI/NISO Z39.19-2005</a>
</body>
</html>

Paul J. Lucas (paul-lucas) wrote :

When I include URLs in HTML for a web page, I do NOT have to convert & into &amp; when it is part of a URL. I have to do that only when I want a literal & as part of the text.

Using your argument, I should also have to convert < to &lt; which I clearly should not have to do -- even your correction didn't do it.

My point was to add VALID XHTML parts in XQDoc documentation: this is the only way it works.

<a href="http://www.niso.org/kst/reports/standards?step=2&gid=&project_key=7cc9b583cb5a62e8c15d3099e0bb46bbae9cf38a">ANSI/NISO Z39.19-2005</a>

is not a valid XHTML: check out the W3C XHTML validator.

The CORRECT XHTML is:

<a href="http://www.niso.org/kst/reports/standards?step=2&amp;gid=&amp;project_key=7cc9b583cb5a62e8c15d3099e0bb46bbae9cf38a">ANSI/NISO Z39.19-2005</a>

So YES, according to W3C, YOU DO HAVE TO convert & into &amp;
:) Sorry for this :)

Changed in zorba:
status: Invalid → Fix Committed
Changed in zorba:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers