delphi Éú³Éxml ·½·¨ Óë delphi txtÎļþ²Ù×÷
Procedure TForm1.Button1Click(Sender: TObject);
Var
xmlstr,FileName: String;
f: Textfile;
Begin
xmlStr := '<?xml version="1.0" encoding="gb2312"?>';
xmlstr := xmlstr + '<user><name>ÕÅÈý</name><sex>ÄÐ</sex></user>';
showmessage(xmlstr);
FileName:='a.xml';
If fileExists(FileName) Then DeleteFile(FileName); {¿´ÎļþÊÇ·ñ´æÔÚ,ÔÚ¾Í刪³ý}
AssignFile(F, FileName); {½«ÎļþÃûÓë±äÁ¿ F ¹ØÁª}
ReWrite(F); {´´½¨Ò»¸öеÄÎļþ²¢ÃüÃûΪ ek.txt}
Writeln(F, xmlstr);
Closefile(F); {¹Ø±ÕÎļþ F}
End;
Procedure NewTxt(FileName:String);
Var
F : Textfile;
Begin
if fileExists(FileName) then DeleteFile(FileName); {¿´ÎļþÊÇ·ñ´æÔÚ,ÔÚ¾Í刪³ý}
AssignFile(F, FileName); {½«ÎļþÃûÓë±äÁ¿ F ¹ØÁª}
ReWrite(F); {´´½¨Ò»¸öеÄÎļþ²¢ÃüÃûΪ ek.txt}
Writeln(F, '½«ÄúҪдÈëµÄÎı¾Ð´Èëµ½Ò»¸ö .txt Îļþ');
Closefile(F); {¹Ø±ÕÎļþ F}
End;
Procedure OpenTxt(FileName:String);
Var
F : Textfile;
Begin
AssignFile(F,FileName); {½«ÎļþÃûÓë±äÁ¿ F ¹ØÁª}
Append(F); {ÒԱ༷½Ê½´ò¿ªÎļþ F }
Writeln(F, '½«ÄúҪдÈëµÄÎı¾Ð´Èëµ½Ò»¸ö .txt Îļþ');
Closefile(F); {¹Ø±ÕÎļþ F}
End;
Procedure ReadTxt(FileName:String);
Var
F : Textfile;
str : String;
Begin
AssignFile(F, FileName); {½«ÎļþÃûÓë±äÁ¿ F ¹ØÁª}
Reset(F); {´ò¿ª²¢¶ÁÈ¡Îļþ F }
Readln(F, str);
ShowMessage('ÎļþÓÐ:' +str + 'ÐС£');
Closefile(F); {¹Ø±ÕÎļþ F}
End;
Procedure AppendTxt(Str:String;FileName:String);
Var
F:Textfile;
Begin
AssignFile(F, FileName);
Append(F);
Writeln(F, Str);
Closefile(F);
End;
Ïà¹ØÎĵµ£º
±È½Ï£º
1. DTD
a. ×îÔçµÄXML Contraint
b. ÓÉW3C¶¨Òå
C. ·Ç³£¼òµ¥
2. XML Schema
a. ĿǰӦÓÃ×î¹ãµÄXML Contraint
b. ÓÉW3C¶¨Òå
c. ºÜÁé»î£¬µ«·Ç³£¸´ÔÓ
3. Relax NG
a. ÊǸöÒ°º¢×Ó£¬²»ÊÇÓÉW3C¶¨Òå
b. ·Ç³£·Ç³£¼òµ¥Ö±¹Û
c. ¶ÔÓÚÐèҪƵ·±¶¨ÒåContraintµÄEngineer·Ç³£ºÏÊÊ
Ï໥ת»¯£º
1. XML Document -> DTD ......
ͨ³£ÔÚ²Ù×÷xmlµÄʱºò£¬¶¼ÊÇͨ¹ýinputstream£¨ºÜ¶àÇé¿öÏÂÊÇFileInputStream£©À´¶ÁÈëxml²¢×ªÎªdomµÄ£¬ºÜ¶àÈË»áÓöµ½ÕâÖÖÇé¿öÊý¾Ý²»ÊÇ´ÓÎļþ¶ÁÈëµÄ¶øÊÇ´ÓStringÖÐÈ¡µÃµÄ
ÓÚÊÇ»áʹÓÃ
InputStream in = new ByteArrayInputStream (str.getBytes());À´È¡µÃinputstream £¬µ«ÊÇÕâÖÖInputStreamÖÐÊý¾Ý±»×ª³ÉÁËbyteÊý×飬ËùÒÔתdom ......
ºÅ³ÆxmlhelperµÄÒ»¸öÀà
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XMLÎĵµ²Ù×÷¹ÜÀíÆ÷
/// </summary>
public class XMLHelper
{
public X ......
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
//µ¼ÈëʹÓÃxmlÓ¦ÓÃËùÐèµ ......
¡¡ÔÚSQL ServerÊý¾Ý¿âÖУ¬µ±ÄãÏëʹÓÃÒ»¸öÊý¾Ý£¬¶øÕâ¸öÊý¾Ý²»±£´æÔÚ±íÖУ¬¼ÆËãÁкÜÓÐÓá£ÀýÈ磬ÄãÓÐÒ»ÕÅ±í£¬Ëü°üÀ¨ÁÐdollar amounts, wholesale pricesºÍretail prices¡£Äã¿Ï¶¨²»ÏëÔÚÿ´Î²éѯ±íʱÀ´¼ÆËãÄÇÁ½ÁÐÖ®¼äµÄ²îÖµ£¬ÄãÏ£Íû½«ÆäÖµ±£´æÔÚµÚÈýÁÐÖУ¬ÈÃÆä×Ô¶¯¼ÆËãǰÁ½ÁÐÖ®¼äµÄ²îÖµ¡£¶ø´ËÁоÍÊǼÆËãÁС£
¡¡¡¡ÔÚSQL ServerÖ ......