[erlang-questions] Edoc href problem with '&'

Richard Carlsson richardc@REDACTED
Tue Nov 11 13:47:44 CET 2008

Ali Yakout wrote:
> Hi,
> I'm trying to place a link in my overview.edoc that contains the '&' character
> the overview.edoc contains something like
> href="http://mysite.com/url?docno=&objectId=09004cff82bf1356&action=current&format=pdf"
> $ gmake doc
>     overview.edoc: at line 8: error in XML parser: {fatal,
>                              {error_scanning_entity_ref,
>                                  {file,file_name_unknown},
>                                  {line,11},
>                                  {col,109}}}.
>     edoc: error in doclet 'edoc_doclet': {'EXIT',error}.

This is normal - you cannot use & characters in the XHTML text except as
part of an entity reference.

> I tried to replace the '&' with the xml code \&
> href=http://mysite.com/url?docno=\&objectId=09004cff82bf1356\&action=current\&format=pdf

It should be written without a backslash: just & or & (and the
href string needs double-quotes around it).

> The edoc then succeeds but the link is unusable :(
> It appears in the html like
> http://mysite.com/url?docno=\&objectId=09004cff82bf1356\&action=current\&format=pdf
> <http://mysite.com/url?docno=\&objectId=09004cff82bf1356\&action=current\&format=pdf>

It is unusable because of the \ characters.

When I write the link like this in overview.edoc:

I get the following (identical) text in the generated HTML:


which the browser interprets (or should interpret) as


and everything works fine.

See for example this blog for more information:

(Since edoc parses your xhtml and later exports it to a new file, there
is no choice involved - you must escape your ampersands, even in URLs.)


More information about the erlang-questions mailing list