ʹÓÃJDOM½âÎöXML£¨×ªÔØ£¬¼òµ¥ÓÖÏêϸ£©
ʹÓÃJDOM½âÎöXML£¨×ªÔØ£¬¼òµ¥ÓÖÏêϸ£©
http://www.blogjava.net/haha/archive/2006/09/01/67153.html
Ò»¡¢Ç°ÑÔ
JDOMÊÇBreet MclaughlinºÍJason HunterÁ½´óJava¸ßÊֵĴ´×÷³É¹û£¬2000Äê³õ£¬JDOM×÷Ϊһ¸ö¿ª·ÅÔ´´úÂëÏîÄ¿Õýʽ¿ªÊ¼Ñз¢¡£JDOMÊÇÒ»ÖÖ½âÎöXMLµÄJava¹¤¾ß°ü¡£
DOMÊʺÏÓÚµ±½ñÁ÷Ðеĸ÷ÖÖÓïÑÔ£¬°üÀ¨Java,JavaScripte,VB,VBScript£¬Perl,C,C++µÈ¡£ËüÁËΪHTMLºÍXMLÎĵµÌṩÁËÒ»¸ö¿ÉÓ¦ÓÃÓÚ²»Í¬Æ½Ì¨µÄ±à³Ì½Ó¿Ú¡£W3C DOMµÄ×îÐÂÐÅÏ¢¿É´Óhttp://www.w3.org/TR2001/WD-DOM-Lever-3-Core-20010913²éÔÄ¡£Î¢ÈíÔÚhttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmconxmldomuserguide.aspÉÏÒ²ÓÐDOMµÄÏêϸ¼¼ÊõÐÅÏ¢¡£
DOMµÄÉè¼ÆΪÁËÊÊÓÃÓÚ²»Í¬µÄÓïÑÔ£¬Ëü±£ÁôÁ˲»Í¬ÓïÑÔÖзdz£ÏàËƵÄAPI¡£µ«ÊÇËü²¢²»ÊʺÏÓÚJava±à³ÌÕßµÄÏ°¹ß¡£¶øJDOM×÷ΪһÖÖÇáÁ¿¼¶API±»Öƶ¨£¬Ëü×îºËÐĵÄÒªÇóÊÇÒÔJavaΪÖÐÐÄ£¬Ö»ÊʺÏÓÚJavaÓïÑÔ£¬Ëü×ñÑDOMµÄ½Ó¿ÚÖ÷Òª¹æÔò£¬³ýÈ¥ÁËDOMÖÐΪÁ˼æÈݸ÷ÓïÑÔ¶øÓëJavaÏ°¹ßµÄ²»Í¬¡£
¶þ¡¢Ê¹ÓÃJDOMµÄÇ°ÌáÌõ¼þ
ÐëÒªÓÐSAX¡¢DOM½âÎöÆ÷µÄÀàÎļþ£¬JDOMÖ»ÊÇÒ»ÖÖÊʺÏJava³ÌÐòÔ±À´Ê¹ÓõÄJava XML½âÎöÆ÷£¬Ä¿Ç°Á÷ÐеÄJava XML½âÎöÆ÷»¹ÓУºApache Xerces Java¡¢JAXP¡£
Xerces Java½âÎöÆ÷ÊÇÍêÈ«ÓÃJava±àдµÄXML½âÎöÆ÷£¬×îа汾ÊÇ2.5£¬ËüÖ§³ÖÒÔϱê×¼ºÍAPI£º
£¨1£© XML1.0¹æ·¶£¨µÚ¶þ°æ±¾£©
£¨2£© XMLÃüÃû¿Õ¼ä¹æ·¶
£¨3£© DOM2ºËÐıê×¼¹æ·¶
£¨4£© SAX2ºËÐÄÀ©Õ¹
£¨5£© JAXP1.2 £ºÊÇSunÌṩµÄʹÓÃJava´¦ÀíXMLµÄ½Ó¿ÚAPI¡£
£¨6£© XML Schema½á¹¹ºÍÊý¾ÝÀàÐͱê×¼
»¹ÓÐ×îºÃµÄÊÇËü¿ª·ÅÔ´´úÂ룬ÎÒÃÇ¿ÉÒÔÔÚhttp://xml.apache.org/dist/xerces-j/ ´¦È¥ÏÂÔØ¡£ÏÂÔØÎļþXerces-J-bin.2.5.0.zip¡£
½âѹÏÂÔØÎļþ£¬µÃµ½ËĸöѹËõ°ü¼Óµ½ÏîÄ¿µÄ·¾¶ÖУ¨Æäʵ²»ÒªÈ«¼Ó£¬µ«²»ÊìµÄÇé¿öÏ¿¼ÂÇÕâô×ö£©¡£
JDOMµÄ¶þ½øÖÆ°æ±¾ÏÂÔØ£ºhttp://www.jdom.org/downloads/index.html
°Ñ½âѹºóµÄjdom.jarÎļþ¼Óµ½ÏîÄ¿µÄÀà·¾¶ÖУ¬ÁíÍâ±ãÓÚµ÷ÊÔ£¬»¹ÒªÏÂÔØËüµÄÔ´´úÂë¡£
Èý¡¢Ê¹ÓÃJDOM½âÎöXML
ºÃÁË£¬ÏÖÔÚ¸ÃÊÇÕýÌâÁË¡£ÏÂÃæͨ¹ýÒ»¸ö¼òµ¥µÄÀý×Ó˵Ã÷Ò»ÏÂÔõôÓÃJDOMÕâÒ»ÊʺÏJava³ÌÐòԱϰ¹ßµÄ¹¤¾ß°üÀ´½âÎöXMLÎĵµ¡£
ΪÁ˼òµ¥£¬ÎÒÓÃÁËÈçÏÂXML×÷ΪҪ½âÎöµÄXMLÎļþ£º
<?xml version="1.0" encoding="gb
Ïà¹ØÎĵµ£º
declare @x xml
set @x='
<ROOT>
<SM>
<SMID>88</SMID>
<SMCD>A5</SMCD>
<SMNM>ÁõÑó</SMNM>
<NDS>
<ND>
<SF>3</SF>
<NDID>88</NDID>
<NDCD>A5< ......
ת×Ô£ºhttp://www.cnblogs.com/sadier/articles/99875.html
ÎÄÕÂÕýÎÄ
Ç°¶Îʱ¼ä£¬ÓÉÓÚ¹¤×÷µÄÐèÒª£¬ÀûÓõ½ÁËXML£¬ËùÒÔ¶ÔÆä½øÐÐÁËһЩ¼òµ¥µÄÑо¿¡£ÔÚ´ËÔ¸°ÑһЩÐĵÃд³öÀ´£¬Óë¸÷λ·ÖÏí£¬²»¶ÔµÄµØ·½»¹Íû¶à¶à°üº¡£
1.ʲôÊÇ XML?
Ê×ÏÈ£¬ÎÒÏë¸÷λӦ¸Ã¶¼ÒѾ´ó¸ÅÖªµÀʲôÊÇXMLÁË¡£Èç¹û£¬Äã¶Ôʲà ......
<!--
/* Font Definitions */
@font-face
{font-family:ËÎÌå;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:PMingLiU;
panos ......
¹ØÓÚ.apk Îļþ½âѹºó·´±àÒë·½·¨£º£Û½ölayout packageϵÄxml Îļþ£Ý
ʹÓÃAXMLPrinter½«Æäת»»Îª¿É¶ÁµÄxmlÎļþ£º
ÃüÁîÈçÏ£º
java -jar AXMLPrinter2.jar main.xml > new_main.xml
AXMLPrinter2.jar¹¤¾ßÏÂÔصØÖ·£ºhttp://code.google.com/p/android4me/downloads/list ......
»¥ÁªÍø·¢Õ¹µÃºÜ¿ì£¬¶¼ÊÇÔ´×ÔÓÚʹÓÃÁ˳¬Îı¾µÄ±í´ï·½Ê½¡£±ÈÈçÄã²é¿´Ò»ÆªÎÄÕ£¬¿´µ½²»¶®µÄ¹Ø¼ü×Ö£¬¾Í¿ÉÒÔͨ¹ýÁ´½ÓÈ¥²é¿´ËüµÄÄÚÈÝ£¬¿´ÍêÖ®ºóÔÙ»ØÀ´½Ó×Å¿´ÔÀ´µÄ¶«Î÷£¬ÕâÑù±È½ÏÊʺÏѧϰµÄ·½Ê½¡£Ê¹ÓÃHTML±ê¼ÇµÄÎı¾£¬Êǽṹ»¯´¢´æµÄ£¬ÕâÑùµÄ±í´ï·½Ê½²Å¿ÉÒÔʵÏÖ³¬¼¶Á¬½Ó¡£ÓÉÓÚHTML¾ßÓг¬Ç¿µÄ±í´ïÄÜÁ¦£¬Ò²¾ÍÔÚ»¥ÁªÍøÉÏÉú´æÏÂÀ´£¬ÄÇ ......