Browse Source

* Escape '>' characters in attribute values, resolves #19831

git-svn-id: trunk@18032 -
sergei 14 years ago
parent
commit
7e102d12ca
1 changed files with 7 additions and 1 deletions
  1. 7 1
      packages/fcl-xml/src/xmlwrite.pp

+ 7 - 1
packages/fcl-xml/src/xmlwrite.pp

@@ -130,7 +130,7 @@ end;
   ---------------------------------------------------------------------}
 
 const
-  AttrSpecialChars = ['<', '"', '&', #9, #10, #13];
+  AttrSpecialChars = ['<', '>', '"', '&', #9, #10, #13];
   TextSpecialChars = ['<', '>', '&', #10, #13];
   CDSectSpecialChars = [']'];
   LineEndingChars = [#13, #10];
@@ -312,6 +312,12 @@ begin
     '"': Sender.wrtStr(QuotStr);
     '&': Sender.wrtStr(AmpStr);
     '<': Sender.wrtStr(ltStr);
+    // This is *only* to interoperate with broken parsers out there,
+    // Delphi ClientDataset parser being one of them.
+    '>': if not Sender.FCanonical then
+           Sender.wrtStr(gtStr)
+         else
+           Sender.wrtChr('>');
     // Escape whitespace using CharRefs to be consistent with W3 spec § 3.3.3
     #9: Sender.wrtStr('&#x9;');
     #10: Sender.wrtStr('&#xA;');