Skip to content

Commit

Permalink
Merge pull request #11251 from keymanapp/fix/developer/11228-no-xmlns…
Browse files Browse the repository at this point in the history
…-for-child-elements

fix(developer): prevent xmlns for LDML keyboard template child elements
  • Loading branch information
mcdurdin authored Apr 22, 2024
2 parents a8f5f56 + 787d5f5 commit 630ce3a
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ function TLDMLKeyboardProjectTemplate.GetKeyboardFilename: string;
end;

const
XMLNS = 'https://schemas.unicode.org/cldr/45/keyboard3';
TemplateXML: string =
'<?xml version="1.0" encoding="UTF-8"?>'#13#10+
// We won't inject the DOCTYPE because of pathing challenges, CLDR-15505
// '<!DOCTYPE keyboard3 SYSTEM "ldmlKeyboard3.dtd">'#13#10+
'<keyboard3 xmlns="https://schemas.unicode.org/cldr/45/keyboard3">'#13#10+
'<keyboard3 xmlns="'+XMLNS+'">'#13#10+
' <keys>'#13#10+
' <import base="cldr" path="45/keys-Zyyy-punctuation.xml"/>'#13#10+
' <import base="cldr" path="45/keys-Zyyy-currency.xml"/> '#13#10+
Expand Down Expand Up @@ -134,21 +135,22 @@ procedure TLDMLKeyboardProjectTemplate.WriteLDML;

doc.DocumentElement := root;

node := doc.CreateElement('info', '');
node := doc.CreateElement('info', XMLNS);
node.Attributes['author'] := Author;
node.Attributes['name'] := Name;
root.ChildNodes.Insert(0, node);

node := doc.CreateElement('version', '');
node := doc.CreateElement('version', XMLNS);
node.Attributes['number'] := Version;
root.ChildNodes.Insert(1, node);

if tags <> '' then
begin
node := doc.CreateElement('locales', '');
node := doc.CreateElement('locales', XMLNS);
while tags <> '' do
begin
tag := StrToken(tags, ' ');
// note: no XMLNS needed here
node.AddChild('locale').Attributes['id'] := tag;
end;
root.ChildNodes.Insert(2, node);
Expand Down

0 comments on commit 630ce3a

Please sign in to comment.