Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

HOW I CAN SHOW THE UTF-8 character using IXMLDocument component

Avatar of IbrahimSA
IbrahimSA asked on
Delphi
3 Comments1 Solution461 ViewsLast Modified:
hi all

i use the following code for parsing XML .... it works, however, it doesn't show the UTF-8 characters >>>instead it shows '????'


is there any way to show these UTF-8 Characters?

thank a lot
unit Unit1;
 
interface
 
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Menus, ComCtrls, ExtCtrls,
  XMLDoc, XMLIntf;
 
type
  TForm1 = class(TForm)
    Button3: TButton;
    Memo1: TMemo;
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure PrintNode(ANode: IXMLNode);
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
 
procedure TForm1.PrintNode(ANode: IXMLNode);
var cnt: Integer;
begin
  if ANode.NodeType = ntElement then begin
    Memo1.Lines.Add(ANode.NodeName);
    if ANode.IsTextElement then
      Memo1.Lines.Add(#9 + ANode.Text);
    for cnt := 0 to ANode.AttributeNodes.Count - 1 do
      Memo1.Lines.Add(ANode.AttributeNodes.Nodes[cnt].NodeName+'='+ VarToStr(ANode.AttributeNodes.Nodes[cnt].NodeValue));
    for cnt := 0 to ANode.ChildNodes.Count - 1 do
      PrintNode(ANode.ChildNodes.Nodes[cnt]);
  end;
end;
 
procedure TForm1.Button3Click(Sender: TObject);
var doc: IXMLDocument;
    cnt: Integer;
    node: IXMLNode;
begin
  doc := LoadXMLDocument('aa1.xml');
  for cnt := 0 to doc.ChildNodes.Count - 1 do begin
    node := doc.ChildNodes.Nodes[cnt];
    PrintNode(node);
  end;
 
end;
 
end.
ASKER CERTIFIED SOLUTION
Avatar of db2trade
db2trade

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answers