Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

(4).¶ÁÈ¡XMLÎļþ

//¶ÁÈ¡XMLÎļþ
//1¡¢LoadfromFile×°ÈëXMLÎļþ
//2¡¢Ö¸¶¨Â·¾¶£¬¼¤»î¶ÁÈ¡
//3¡¢´ÓÄÚ´æÁ÷¶ÁÈ¡
//4¡¢´ÓÍøÂçÉÏÖ±½Ó»ñÈ¡
//1¡¢LoadfromFile×°ÈëXMLÎļþ
procedure TForm1.Button1Click(Sender: TObject);
begin
XMLDocument1.LoadfromFile('c:\temp\test.xml');
// XMLDocument1.Active := True;
Memo1.Lines := XMLDocument1.XML;
end;
//2¡¢Ö¸¶¨Â·¾¶£¬¼¤»î¶ÁÈ¡
procedure TForm1.Button9Click(Sender: TObject);
begin
XMLDocument1.FileName := 'c:\temp\test.xml';
XMLDocument1.Active := True;
ShowMessage(FormatXMLData(XMLDocument1.XML.Text));
end;
//3¡¢´ÓÄÚ´æÁ÷¶ÁÈ¡
procedure TForm1.Button2Click(Sender: TObject);
var
ms: TMemoryStream;
begin
ms := TMemoryStream.Create;
ms.LoadfromFile('c:\temp\test.xml');
XMLDocument1.LoadfromStream(ms);
Memo1.Lines := XMLDocument1.XML;
ms.Free;
end;
//4¡¢´ÓÍøÂçÉÏÖ±½Ó»ñÈ¡
procedure TForm1.Button10Click(Sender: TObject);
begin
XMLDocument1.LoadfromFile('http://www.************8/*.xml');
ShowMessage(FormatXMLData(XMLDocument1.XML.Text));
end;


Ïà¹ØÎĵµ£º

[¼¼Êõѧϰ]XML DTD ÈëÃÅ


XML DTD ÈëÃÅ(2009-12-14 09:08:49)
±êÇ©£ºÔÓ̸ 
 
 
     DTDʵ¼ÊÉÏ¿ÉÒÔ¿´×÷Ò»¸ö»ò¶à¸öXMLÎļþµÄÄ£°å£¬ÕâЩXMLÎļþÖеÄÔªËØ¡¢ÔªËصÄÊôÐÔ¡¢ÔªËصÄÅÅÁз½Ê½/˳Ðò¡¢ÔªËØÄܹ»°üº¬µÄÄÚÈݵȣ¬¶¼±ØÐë·ûºÏDTDÖеĶ¨Òå¡£XMLÎļþÖеÄÔªËØ£¬¼´ÎÒÃÇËù´´½¨µÄ±ê¼Ç£¬ÊǸù¾ÝÎÒÃÇÓ ......

¸ñʽ»¯XML£ºÊä³öÓÐËõ½øЧ¹ûµÄXML×Ö·û´®

1. Ò»°ãÇé¿öÏÂʹÓÃÒÔÏ´úÂë¼´¿É½«XML×Ö·û´®ÖØиñʽ»¯£º
        private string FormatXml(string source)
        {
            StringBuilder  ......

xml¶ÁÈ¡ÓëдÈë

xmlÎļþ
£¼?xml version="1.0" encoding="GB2312"?£¾
£¼RESULT£¾
£¼VALUE£¾
¡¡¡¡ £¼NO£¾A1234£¼/NO£¾
¡¡¡¡ £¼ADDR£¾ËÄ´¨Ê¡XXÏØXXÕòXX·X¶ÎXXºÅ£¼/ADDR£¾
£¼/VALUE£¾
£¼VALUE£¾
¡¡¡¡ £¼NO£¾B1234£¼/NO£¾
¡¡ ¡¡£¼ADDR£¾ËÄ´¨Ê¡XXÊÐXXÏçXX´åXX×飼/ADDR£¾
£¼/VALUE£¾
£¼/RESULT£¾
ÐèҪʲô°ü×Ô¼ºµ½ÍøÉÏ ......

ÓÃSAXReader½âÎöxmlÎĵµ

     ʹÓÃSAXReaderÐèÒªµ¼Èëdom4j-full.jar°ü¡£
     dom4jÊÇÒ»¸öJavaµÄXML API£¬ÀàËÆÓÚjdom£¬ÓÃÀ´¶ÁдXMLÎļþµÄ¡£dom4jÊÇÒ»¸ö·Ç³£·Ç³£ÓÅÐãµÄJava XML API£¬¾ßÓÐÐÔÄÜÓÅÒì¡¢¹¦ÄÜÇ¿´óºÍ¼«¶ËÒ×ÓÃʹÓõÄÌص㣬ͬʱËüÒ²ÊÇÒ»¸ö¿ª·ÅÔ´´úÂëµÄÈí¼þ£¬¿ÉÒÔÔÚSourceForgeÉÏÕÒµ½Ëü¡£
 &n ......

SAXReaderµÄÖ÷ÒªÓ÷¨£¨XML£©


java ´úÂë
package com.dc.framework.taglib;   
import java.io.FileInputStream;   
import java.io.FileNotFoundException;   
import java.util.HashMap;   
import java.util.Iterator;   
import java.util.List; &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ