XML½âÎö·½·¨½²½â
XMLÏÖÔÚÒѾ³ÉΪһÖÖͨÓõÄÊý¾Ý½»»»¸ñʽ,ËüµÄƽ̨ÎÞ¹ØÐÔ,ÓïÑÔÎÞ¹ØÐÔ,ϵͳÎÞ¹ØÐÔ,¸øÊý¾Ý¼¯³ÉÓë½»»¥´øÀ´Á˼«´óµÄ·½±ã¡£¶ÔÓÚXML±¾ÉíµÄÓ﷨֪ʶÓë¼¼Êõϸ½Ú,ÐèÒªÔĶÁÏà¹ØµÄ¼¼ÊõÎÄÏ×,ÕâÀïÃæ°üÀ¨µÄÄÚÈÝÓÐDOM(Document Object Model),DTD(Document Type Definition),SAX(Simple API for XML),XSD(Xml Schema Definition),XSLT(Extensible Stylesheet Language Transformations),¾ßÌå¿É²ÎÔÄw3c¹Ù·½ÍøÕ¾Îĵµhttp://www.w3.org»ñÈ¡¸ü¶àÐÅÏ¢¡£
XMLÔÚ²»Í¬µÄÓïÑÔÀï½âÎö·½Ê½¶¼ÊÇÒ»ÑùµÄ,Ö»²»¹ýʵÏÖµÄÓï·¨²»Í¬¶øÒÑ¡£»ù±¾µÄ½âÎö·½Ê½ÓÐÁ½ÖÖ,Ò»ÖÖ½ÐSAX£¬ÁíÒ»ÖÖ½ÐDOM¡£SAXÊÇ»ùÓÚʼþÁ÷µÄ½âÎö,DOMÊÇ»ùÓÚXMLÎĵµÊ÷½á¹¹µÄ½âÎö¡£¼ÙÉèÎÒÃÇXMLµÄÄÚÈݺͽṹÈçÏÂ:
<?xml version="1.0" encoding="UTF-8"?>
<employees>
<employee>
<name>ddviplinux</name>
<sex>m</sex>
<age>30</age>
</employee>
</employees>
±¾ÎÄʹÓÃJAVAÓïÑÔÀ´ÊµÏÖDOMÓëSAXµÄXMLÎĵµÉú³ÉÓë½âÎö¡£
Ê×Ïȶ¨ÒåÒ»¸ö²Ù×÷XMLÎĵµµÄ½Ó¿ÚXmlDocument Ëü¶¨ÒåÁËXMLÎĵµµÄ½¨Á¢Óë½âÎöµÄ½Ó¿Ú¡£
package com.alisoft.facepay.framework.bean;
/**
*
* @author hongliang.dinghl
* ¶¨ÒåXMLÎĵµ½¨Á¢Óë½âÎöµÄ½Ó¿Ú
*/
public interface XmlDocument {
/**
* ½¨Á¢XMLÎĵµ
* @param fileName Îļþȫ·¾¶Ãû³Æ
*/
public void createXml(String fileName);
/**
* ½âÎöXMLÎĵµ
* @param fileName Îļþȫ·¾¶Ãû³Æ
*/
public void parserXml(String fileName);
}
1.DOMÉú³ÉºÍ½âÎöXMLÎĵµ
Ϊ XML ÎĵµµÄÒѽâÎö°æ±¾¶¨ÒåÁËÒ»×é½Ó¿Ú¡£½âÎöÆ÷¶ÁÈëÕû¸öÎĵµ£¬È»ºó¹¹½¨Ò»¸öפÁôÄÚ´æµÄÊ÷½á¹¹£¬È»ºó´úÂë¾Í¿ÉÒÔʹÓà DOM ½Ó¿ÚÀ´²Ù×÷Õâ¸öÊ÷½á¹¹¡£Óŵ㣺Õû¸öÎĵµÊ÷ÔÚÄÚ´æÖУ¬±ãÓÚ²Ù×÷£»Ö§³Öɾ³ý¡¢Ð޸ġ¢ÖØÐÂÅÅÁеȶàÖÖ¹¦ÄÜ£»È±µã£º½«Õû¸öÎĵµµ÷ÈëÄڴ棨°üÀ¨ÎÞÓõĽڵ㣩£¬ÀË·Ñʱ¼äºÍ¿Õ¼ä£»Ê¹Óó¡ºÏ£ºÒ»µ©½âÎöÁËÎĵµ»¹Ðè¶à´Î·ÃÎÊÕâЩÊý¾Ý£»Ó²¼þ×ÊÔ´³ä×㣨ÄÚ´æ¡¢CPU£©¡£
package com.alisoft.facepay.framework.bean;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.
Ïà¹ØÎĵµ£º
ΪUrlRewriteµÄ¶à¸öXMLÅäÖÃÎļþµÄ¼ÓÔØÌṩģºýÆ¥Åä
@for&ever 2009-11-27
֮ǰдÁËһƪÎÄÕ£¬¡¶ÐÞ¸ÄUrlRewriterʹÆäÓɵ¥ÅäÖÃÎļþµ½Ö§³Ö¶àÅäÖÃÎļþ¡·£¬ÍøÖ·http://blog.csdn.net/forandever/archive/2009/08/07/4423808.aspx £¬¶Ô UrlRewriteµÄ´úÂë½øÐÐÁ˼òµ¥Ð޸ģ¬
ÎÄÕÂÖеÄÄܹ»Ö§³Ö¶à¸öÅäÖ ......
ÔÚÕë¶ÔXMLÎĵµµÄÓ¦Óñà³Ì½Ó¿ÚÖУ¬×îÖ÷ÒªµÄÓÐW3CÖƶ¨µÄDOM(Document Object Method£¬Îĵµ¶ÔÏóÄ£ÐÍ)ºÍÓÉDavid MegginsonÁìµ¼µÄSAX(SimpleAPI for XML£¬ÓÃÓÚXMLµÄ¼òµ¥API)[19]¡£
SAXºÍDOMÔÚʵÏÖ¹ý³ÌÖУ¬·Ö±ð²àÖØÓÚ²»Í¬µÄ·½ÃæÒÔÂú×㲻ͬµÄÓ¦ÓÃÐèÇó¡£DOMΪ¿ª·¢»ùÓÚXMLµÄÓ¦ÓÃϵͳÌṩÁ˱ãÀû¡£Ëüͨ¹ýÒ»ÖÖËæ»ú·ÃÎÊ»úÖÆ£¬Ê¹µÃÓ¦ÓÃ³Ì ......
XML±»Éè¼ÆÓÃÀ´ÃèÊöÊý¾Ý£¬Æä½¹µãÊÇÊý¾ÝµÄÄÚÈÝ¡£
HTML±»Éè¼ÆÓÃÀ´ÏÔʾÊý¾Ý£¬Æä½¹µãÊÇÊý¾ÝµÄÍâ¹Û¡£
Ó¦¸ÃÕÆÎյĻù´¡ÖªÊ¶£º
ÔÚÄú¼ÌÐøѧϰ֮ǰ£¬ÐèÒª¶ÔÒÔÏÂ֪ʶÓлù±¾µÄÁ˽⣺
HTML / XHTML
JavaScript or VBScript
ʲôÊÇXML?
XMLÖ¸¿ÉÀ©Õ¹±ê¼ÇÓïÑÔ£¨EXtensible Markup Language£©
XMLÊÇÒ»Ö ......