{"action":"created","issue":{"url":"https://api.github.com/repos/yunkot/pxl/issues/2","labels_url":"https://api.github.com/repos/yunkot/pxl/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/yunkot/pxl/issues/2/comments","events_url":"https://api.github.com/repos/yunkot/pxl/issues/2/events","html_url":"https://github.com/yunkot/pxl/issues/2","id":110803790,"number":2,"title":"Elements that have only text get lost","user":{"login":"michael-ring","id":6280531,"avatar_url":"https://avatars.githubusercontent.com/u/6280531?v=3","gravatar_id":"","url":"https://api.github.com/users/michael-ring","html_url":"https://github.com/michael-ring","followers_url":"https://api.github.com/users/michael-ring/followers","following_url":"https://api.github.com/users/michael-ring/following{/other_user}","gists_url":"https://api.github.com/users/michael-ring/gists{/gist_id}","starred_url":"https://api.github.com/users/michael-ring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael-ring/subscriptions","organizations_url":"https://api.github.com/users/michael-ring/orgs","repos_url":"https://api.github.com/users/michael-ring/repos","events_url":"https://api.github.com/users/michael-ring/events{/privacy}","received_events_url":"https://api.github.com/users/michael-ring/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"yunkot","id":14065837,"avatar_url":"https://avatars.githubusercontent.com/u/14065837?v=3","gravatar_id":"","url":"https://api.github.com/users/yunkot","html_url":"https://github.com/yunkot","followers_url":"https://api.github.com/users/yunkot/followers","following_url":"https://api.github.com/users/yunkot/following{/other_user}","gists_url":"https://api.github.com/users/yunkot/gists{/gist_id}","starred_url":"https://api.github.com/users/yunkot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yunkot/subscriptions","organizations_url":"https://api.github.com/users/yunkot/orgs","repos_url":"https://api.github.com/users/yunkot/repos","events_url":"https://api.github.com/users/yunkot/events{/privacy}","received_events_url":"https://api.github.com/users/yunkot/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2015-10-10T16:32:18Z","updated_at":"2015-10-11T19:21:49Z","closed_at":null,"body":"XML Data like this:\r\n\r\n```\r\n  <name>SAM-E_DFP</name>\r\n   <description>Atmel SAME70 Series Device Support</description>\r\n\r\nends up as:\r\n  <name />\r\n   <description />\r\n```\r\n\r\nwhen I save parsed xml to a new file.\r\n\r\nReason is that this case is not handled at all in the code when parsing the xml\r\n\r\nI've created a patch that works at least for my test-data:\r\n\r\n```\r\ndiff --git a/Source/PXL.XML.pas b/Source/PXL.XML.pas\r\nindex 1e7587e..9e0ae0f 100644\r\n--- a/Source/PXL.XML.pas\r\n+++ b/Source/PXL.XML.pas\r\n@@ -47,6 +47,7 @@ type\r\n   private\r\n     {$IFDEF AUTOREFCOUNT}[weak]{$ENDIF} FParent: TXMLNode;\r\n     FName: StdString;\r\n+    FText: StdString;\r\n\r\n     FieldItems: array of TFieldItem;\r\n     FieldItemCount: Integer;\r\n@@ -111,6 +112,7 @@ type\r\n\r\n     property Parent: TXMLNode read FParent;\r\n     property Name: StdString read FName;\r\n+    property Text: StdString read FText;\r\n\r\n     property FieldCount: Integer read GetFieldCount;\r\n     property Field[const Index: Integer]: PFieldItem read GetField;\r\n@@ -167,6 +169,7 @@ begin\r\n   Increment_PXL_ClassInstances;\r\n\r\n   FName := AName;\r\n+  FText := '';\r\n   FParent := AParent;\r\n end;\r\n\r\n@@ -628,7 +631,10 @@ begin\r\n     Result := Result + AddSpaces(Spacing) + '</' + FName + '>'#13#10;\r\n   end\r\n   else\r\n-    Result := Result + ' />'#13#10;\r\n+    if FText <> '' then\r\n+      Result := Result + '>' + FText + '</'+FName+'>'#13#10\r\n+    else\r\n+      Result := Result + ' />'#13#10;\r\n end;\r\n\r\n function TXMLNode.GenerateSourceCode: StdString;\r\n@@ -851,6 +859,7 @@ end;\r\n function ParseXMLNode(const Root: TXMLNode; const Text: StdString; var TextPos: Integer): TXMLNode;\r\n var\r\n   NodeName: StdString;\r\n+  OldTextPos : Integer;\r\n begin\r\n   // Process node name.\r\n   NodeName := ScanForName(Text, TextPos);\r\n@@ -879,6 +888,8 @@ begin\r\n     // Full end of node.\r\n     if HasTextPortion(Text, TextPos, '/>') then\r\n     begin\r\n+      if OldTextPos <> 0 then\r\n+        Result.FText := copy(Text,OldTextPos,TextPos-OldTextPos);\r\n       Inc(TextPos, 2);\r\n       Exit;\r\n     end;\r\n@@ -887,6 +898,9 @@ begin\r\n     if Text[TextPos] = '>' then\r\n     begin\r\n       Inc(TextPos);\r\n+      Result.FText := '';\r\n+      // Save the Position of a possible pure Text in the Tag\r\n+      OldTextPos := TextPos;\r\n       Break;\r\n     end;\r\n\r\n@@ -894,6 +908,8 @@ begin\r\n     if IsNameCharacter(Text[TextPos]) then\r\n     begin\r\n       ParseXMLField(Result, Text, TextPos);\r\n+      // Make sure that Attributes do not set a TextPosition\r\n+      OldTextPos := 0;\r\n       Continue;\r\n     end;\r\n\r\n@@ -936,8 +952,10 @@ begin\r\n     // End of node \"</NODE>\"\r\n     if HasTextPortion(Text, TextPos, '</') then\r\n     begin\r\n+      // Fill Text Property when Element has no Children and does not consist of only Attributes\r\n+      if (OldTextPos <> 0) then\r\n+        Result.FText := copy(Text,OldTextPos,TextPos-OldTextPos);\r\n       Inc(TextPos, 2);\r\n-\r\n       NodeName := ScanForName(Text, TextPos);\r\n       if not SameText(NodeName, Result.Name) then\r\n       begin\r\n@@ -960,8 +978,9 @@ begin\r\n     if Text[TextPos] = '<' then\r\n     begin\r\n       Inc(TextPos);\r\n-\r\n       ParseXMLNode(Result, Text, TextPos);\r\n+      // Element has a Child node so it cannot have a valid text attribute\r\n+      OldTextPos := 0;\r\n       Continue;\r\n     end;\r\n\r\n```\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/yunkot/pxl/issues/comments/147237411","html_url":"https://github.com/yunkot/pxl/issues/2#issuecomment-147237411","issue_url":"https://api.github.com/repos/yunkot/pxl/issues/2","id":147237411,"user":{"login":"yunkot","id":14065837,"avatar_url":"https://avatars.githubusercontent.com/u/14065837?v=3","gravatar_id":"","url":"https://api.github.com/users/yunkot","html_url":"https://github.com/yunkot","followers_url":"https://api.github.com/users/yunkot/followers","following_url":"https://api.github.com/users/yunkot/following{/other_user}","gists_url":"https://api.github.com/users/yunkot/gists{/gist_id}","starred_url":"https://api.github.com/users/yunkot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yunkot/subscriptions","organizations_url":"https://api.github.com/users/yunkot/orgs","repos_url":"https://api.github.com/users/yunkot/repos","events_url":"https://api.github.com/users/yunkot/events{/privacy}","received_events_url":"https://api.github.com/users/yunkot/received_events","type":"User","site_admin":false},"created_at":"2015-10-11T19:21:49Z","updated_at":"2015-10-11T19:21:49Z","body":"That's very interesting, I would like to try participate in such experiments myself. This is getting off-topic, however, please let me know if there is any pending discussion on this elsewhere or how to make FPC work with one of these boards (and which ones are supported, to purchase one)."}}