Recent

Author Topic: How to read xliff files  (Read 2095 times)

nikel

  • Full Member
  • ***
  • Posts: 186
How to read xliff files
« on: December 19, 2018, 03:50:59 am »
I'm trying to read an xliff file. Here's my code.

Code: Pascal  [Select][+][-]
  1.   FActionLblCaption:=Doc.GetElementById('actionLblCaption').GetElementsByTagName('source').Item[0].TextContent;
  2.   FFileLblCaption:=Doc.GetElementById('fileLblCaption').GetElementsByTagName('source').Item[0].TextContent;

This gives me an error without clear explanation. How can I fix this?
« Last Edit: December 19, 2018, 04:05:42 am by nikel »

wp

  • Hero Member
  • *****
  • Posts: 11915
Re: How to read xliff files
« Reply #1 on: December 19, 2018, 09:08:31 am »
Please post a sample file. zip it to be accepted by the forum software.

nikel

  • Full Member
  • ***
  • Posts: 186
Re: How to read xliff files
« Reply #2 on: December 23, 2018, 08:23:37 pm »
Hi I fixed it like this:

Code: Pascal  [Select][+][-]
  1.   XMLNodeList:=Doc.FirstChild.ChildNodes[0].ChildNodes[0].ChildNodes;
  2.   for I := 0 to XMLNodeList.Count - 1 do
  3.   begin
  4.     Id:=XMLNodeList[I].Attributes[0].NodeValue;
  5.     Text:=XMLNodeList[I].ChildNodes[LangNum].TextContent;
  6.  
  7.     if (Id='actionLblCaption') then begin FActionLblCaption:=Text end
  8.     else if (Id='fileLblCaption') then begin FFileLblCaption:=Text end

Thanks for the reply.

 

TinyPortal © 2005-2018