Show quoted text 11 lines
> In an attempt to check the yet undocumented FCL units for use with
> FPDoc and MakeSkel, I got an error in the created skeleton for gmp:
> <element name="operator <(MPFloat, MPFloat): Boolean">
>
> The "<" and ">" chars in operator names should be escaped in the XML
> files.
Last time this was remarked on, there was discussion whether < and >
need to
be escaped inside attribute values. I never got around to checking the XML
specs.
The specs really are a bit weird:
[10] AttValue ::= '"' ([^<&"] | Reference)* '"' |? "'" ([^<&'] | Reference)* "'"
This means that "<" is not allowed inside an attribute value, while ">" seems to be allowed. An "&" has to be escaped because it is used as the escape character in a CharRef ("&#nn;") or EntityRef (e.g. "<").
In each case it's easily fixable.
At least a writer has to escape "<", this should be fixed ASAP.
I'd escape both "<" and ">" in writing XML attributes, to prevent any possible problems. A reader instead should allow for ">" there, conforming to the specs.
DoDi