EldoS | Feel safer!

Software components for data protection, secure storage and transfer

problem with some special characters in xml file

Posted: 06/26/2013 10:08:02
by Popeye  (Basic support level)
Joined: 10/22/2010
Posts: 10

I'm using Secureblackbox version 10.0.233. and Delphi2010
I'm trying to read xml file with TElXMLDOMDocument. i have a problem with some special characters.

Here is my code.

procedure TForm1.Button1Click(Sender: TObject);
  F: TFileStream;
  FXMLDocument: TElXMLDOMDocument;
   N: TElXMLDOMNode;
   s : String;
  FXMLDocument := TElXMLDOMDocument.Create;

  F := TFileStream.Create('c:\test.xml', fmOpenRead or fmShareDenyWrite);
  FXMLDocument.LoadFromStream(F, 'iso-8859-9');
  N := FXMLDocument.DocumentElement.FindNode('RECEIVER_NAME');
  n := n.FirstChild;
  while N.NodeType <> ntText do
   begin n := n.NextSibling;

  s := n.NodeValue;



it's display the value of node like this "ÇÖÐÜÞIçöðüþý"
but in the test.xml file node value is "ÇÖĞÜŞIçöğüşı".

What is my mistake.

You can find test.xml as attachment.

Thanks for help.

[ Download ]
Posted: 06/26/2013 13:18:21
by Dmytro Bogatskyy (Team)

Thank you for contacting us.

This issue is caused by incorrect alias name in "ISO-8859-9" encoding that prevents from registering this encoding in the global charset list. And so a component falls back to the default "ISO-8859-1" encoding instead of "ISO-8859-9". This issue should be fixed for the next build.

N := FXMLDocument.DocumentElement.FindNode('RECEIVER_NAME');
n := n.FirstChild;
while N.NodeType <> ntText do
begin n := n.NextSibling;

s := n.NodeValue;

You can use TElXMLDOMElement.TextContent property or SBXMLUtils.GetTextFromXMLElement method to get a text. For example:
N := FXMLDocument.DocumentElement.FindNode('RECEIVER_NAME');
if N is TElXMLDOMElement then
  s := TElXMLDOMElement(N).TextContent;



Topic viewed 411 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!