Java¶ÔÏóXMLÐòÁл¯¿ò¼Ü£Simple2.0
Java¶ÔÏóXMLÐòÁл¯¿ò¼Ü£Simple2.0
SimpleÊÇÒ»¸öXMLÐòÁл¯¿ò¼Ü£¬Ò»¸öJava
°æ±¾¿íÈݵÄÐòÁл¯¿ò¼Ü£¬Äܹ»¿ìËÙÔÚJava
ƽ̨ÉÏ¿ª·¢XML¡£Ö§³Öͨ¹ýannotationsÍêÈ«ÅäÖû¯µÄXML½á¹¹£»Ìṩ°æ±¾¹ÜÀí¿ò¼ÜÔÊÐíÏòÇ°ºÍÏòºó¼æÈÝÐòÁл¯£»¸üºÃµÄÐÔÄÜ£¬Ê¹ÓÃÇáÁ¿¼¶StAXÌáÉýXML·´ÐòÁл¯
½ø³Ì£¬±ÈXStreamºÍJAXB¸ü¿ì£»Í¨¹ýnamespace annotationsÌṩÍêÈ«µÄÃüÃû¿Õ¼äÖ§³Ö£»°üÀ¨XMLÄ£°åϵͳ
Ä¿Ç°×îа汾Ϊ 2.0.1. ¹ÙÍøµØÖ·:http://simple.sourceforge.net/home.php
×¢£º²»¹ý±ÊÕßÈÏΪ£¬Èç¹ûÄãʹÓÃJavaSE 6.0£¬Ôò½¨ÒéʹÓÃÆä×Ô´øµÄJAXB
(Java Architecture for XML Binding).ÆäʹÓ÷dz£¼òµ¥£¬Ö§³Öͨ¹ýannotationsÍêÈ«ÅäÖû¯µÄXML½á¹¹¡£¶øÇÒÆäÒ²ÊÇJavaÖеÄÒ»¸ö¹æ·¶ÊµÏÖ£¬ JAX-RS¹æ·¶
¾ÍʹÓÃJAXBÀ´ÊµÏÖ¶ÔÏóµÄÐòÁл¯¹¦ÄÜ¡£
ÏÂÃæÊÇÒ»¸ö¼òµ¥Ê¾Àý:
Ïȶ¨ÒåÒ»¸öExample¶ÔÏó£¬ ÎÒÃÇÖ»ÐèÒª¼òµ¥µÄ¼ÓÉÏAnnoationºó£¬¾Í¿ÉÒÔ½øÐжÔÏóÓëXMLÖ®¼äµÄת»»¡£
@Root
public
class
Example {
@Element
private
String text;
@Attribute
private
int
index;
public
Example() {
super
();
}
public
Example(String text,
int
index) {
this
.text
=
text;
this
.index
=
index;
}
public
String getMessage() {
return
text;
}
public
int
getId() {
return
index;
}
}
½øÐÐXMLÐòÁл¯²Ù×÷:
Serializer serializer
=
new
Persister();
Example example
=
new
Example(
"
Example message
"
,
123
);
File result
=
new
File(
"
example.xml
"
);
serializer.write(example,&
Ïà¹ØÎĵµ£º
javaÏ̳߳صÄÔÀíÓëʵÏÖ
[·ÖÏí]Java Ï̳߳صÄÔÀíÓëʵÏÖ2008-07-18
14:53------------------------------------------------------------------------------------------------
Õ⼸ÌìÖ÷ÒªÊÇ¿ñ¿´Ô´³ÌÐò£¬ÔÚÃÖ²¹ÁËһЩÒÔǰ֪ʶ¿Õ°×µÄͬʱ£¬Ò²Ñ§»áÁ˲»ÉÙеÄ֪ʶ£¨±ÈÈç NIO£©£¬»òÕß³ÆΪм¼Êõ°É ......
<!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:ËÎÌå;
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:"\@SimSun&qu ......
java´ò°ü-exeÎļþ-×îÖÕÒÔsetupÐÎʽ·¢²¼µÄ½â¾öÖ®µÀ
java´ò°ü-exeÎļþ-×îÖÕÒÔsetupÐÎʽ·¢²¼µÄ½â¾öÖ®µÀ
Ê×ÏÈ£¬½«±àÒëºÃµÄ³ÌÐò´ò°ü³ÉjarÎļþ£¬È»ºó×ö³öexe£¬ÕâÑù´úÂë¾Í²»¿É¼ûÁË£»µ«ÊÇexeÎļþÔÚûÓа²×°jreµÄµçÄÔÉϲ»ÄÜÔËÐУ¬Èç¹ûÒªÇó¿Í»§ÔÙÈ¥°²×°jre ÉèÖû·¾³±äÁ¿ ¾Í²»ÑÅÁË¡£ÎÒÃÇÐèÒª½«jre´ò°ü¡£
Õ⼸²½²Ù×÷Í ......
JAVAµÄ¿çƽ̨µÄÌØÐÔÉîÊÜjava³ÌÐòÔ±ÃǵÄϲ°®,µ«ÕýÊÇÓÉÓÚËüΪÁËʵÏÖ¿çƽ̨µÄÄ¿µÄ,ʹµÃËüºÍ±¾µØ»úÆ÷µÄ¸÷ÖÖÄÚ²¿ÁªÏµ±äµÃºÜÉÙ,´ó´óÔ¼ÊøÁËËüµÄ¹¦ÄÜ,±ÈÈçÓëһЩӲ¼þÉ豸ͨÐÅ,ÍùÍùÒª»¨·ÑºÜ´óµÄ¾«Á¦È¥Éè¼ÆÁ÷³Ì±àд´úÂëÈ¥¹ÜÀíÉ豸¶Ë¿Ú,¶øÇÒÓÐһЩÉ豸³§ÉÌÌṩµÄÓ²¼þ½Ó¿ÚÒѾ¾¹ýÒ»¶¨µÄ·â×°ºÍ´¦Àí,²»ÄÜÖ±½ÓʹÓÃjava³ÌÐòͨ¹ý¶Ë¿ÚºÍÉè±¸Í ......