⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.pas

📁 delphi 中用于 css 样式表的解析的类
💻 PAS
字号:
unit Unit1;

// (C) 2005 MYTHcode.org

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls, ToolWin, SubUtils, XMLParser;

type
  TForm1 = class(TForm)
    ToolBar1: TToolBar;
    ToolButton1: TToolButton;
    OpenDialog1: TOpenDialog;
    TreeView1: TTreeView;
    procedure ToolButton1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.ToolButton1Click(Sender: TObject);
var
  Parser: TXMLParser;
  ParentNode: TTreeNode;
begin
 if OpenDialog1.Execute then
 begin
   Parser:=TXMLParser.Create(File_(OpenDialog1.FileName));
   try
     ParentNode:=nil;
     with Parser, TreeView1.Items do
     while Next do
     case TagType of
       ttBeginTag: ParentNode:=AddChild(ParentNode, StepCode);
       ttEndTag: if ParentNode<>nil then ParentNode:=ParentNode.Parent;
       else AddChild(ParentNode, StepCode);
     end;
   finally
     Parser.Free;
   end;
 end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -