`
taotaogo1980
  • 浏览: 84211 次
社区版块
存档分类
最新评论

Simple XML

阅读更多

    <p style="">之前曾写过一blog :<span class="Apple-converted-space">?</span><a style="color: #108ac6; text-decoration: underline;" href="http://sjsky.iteye.com/blog/784434">XStream序列化JAVA对象为XML以及反序列化<span class="Apple-converted-space">?</span></a>(http://sjsky.iteye.com/blog/784434),今天介绍另一个Java Bean&lt;-&gt;XML 之间序列化和反序列化的轻量级工具:Simple</p>
<p style="">官网:<a style="color: #108ac6; text-decoration: underline;" href="http://simple.sourceforge.net/home.php">http://simple.sourceforge.net/home.php</a></p>
<p style="">截止目前最新版本(附近可下载):<a style="color: #108ac6; text-decoration: underline;" href="http://dl.iteye.com/topics/download/d4c3dd79-5369-3c64-a69c-03e5d2b2e17d">simple-xml-2.6.1.jar</a></p>
<p style="">?</p>
<p style=""><span style="color: #0000ff;"><strong style="font-weight: bold;">特点:</strong></span></p>
<ul style="">
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;"><span style="color: #ff0000;">jar lib文件只有360K左右的大小</span></li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;"><span style="color: #ff0000;">它的使用不需要依赖于其他 JAR 文件</span></li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;"><span style="color: #ff0000;">通过注解的方式,灵活方便</span></li>
</ul>
<p style=""><strong style="font-weight: bold;">下面将分节详细介绍Simple的特点和使用方法:</strong></p>
<ul style="">
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">[一]、简单bean的序列化和反序列化</li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">[二]、自定义节点名称?</li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">[三]、嵌套对象</li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">[四]、可选的非强制性的元素或属性</li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">[五]、List&lt;Object&gt;处理</li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">[六]、inline 参数用法</li>
<li style="margin: 0px 0px 0.25em 30px; padding: 0px;">[七]、构造函数的注解处理</li>
</ul>
<p style="">?</p>
<p style=""><span style="color: #ff0000; font-size: medium;">[一]、简单bean的序列化和反序列化</span></p>
<p style="">?</p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">1.java bean</span></p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">package</span><span style="color: black;">?michael.serialization.simplexml;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?java.util.Date;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Attribute;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Element;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Root;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@blog?http://sjsky.iteye.com</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@author?Michael</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?MyTestVo?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?userName;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?wife;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?realName;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?Date?bornDate;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?Double?height;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?toString()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?</span><span class="string" style="color: blue;">"MyTestVo?:?[?userName?=?"</span><span style="color: black;">?+?userName?+?</span><span class="string" style="color: blue;">"?,?wife?=?"</span><span style="color: black;">?+?wife??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????????+?<span class="string" style="color: blue;">"?,?realName?=?"</span><span style="color: black;">?+?realName?+?</span><span class="string" style="color: blue;">"?,?height?=?"</span><span style="color: black;">?+?height??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????????+?<span class="string" style="color: blue;">"?,?bornDate?=?"</span><span style="color: black;">?+?bornDate?+?</span><span class="string" style="color: blue;">"?]"</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="comment" style="color: #008200;">//省略set?get等方法</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????......??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">2.序列化</span></p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">static</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?main(String[]?args)?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">throws</span><span style="color: black;">?Exception?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????String?xmlpath?=?<span class="string" style="color: blue;">"d:/test/michael/simple_testvo.xml"</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????MyTestVo?vo?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?MyTestVo();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????vo.setUserName(<span class="string" style="color: blue;">"michael"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????vo.setRealName(<span class="string" style="color: blue;">"大大"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????vo.setWife(<span class="string" style="color: blue;">"小小"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????vo.setHeight(<span class="number" style="color: #c00000;">173</span><span style="color: black;">.3d);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????vo.setBornDate(<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?Date());??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">try</span><span style="color: black;">?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????Serializer?serializer?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?Persister();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????File?result?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?File(xmlpath);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????serializer.write(vo,?result);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????}?<span class="keyword" style="color: #7f0055; font-weight: bold;">catch</span><span style="color: black;">?(Exception?e)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????e.printStackTrace();??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p style="">??? 序列化成功生成的simple_testvo.xml文件如下:</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Xml代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-xml" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">myTestVo</span><span style="color: black;">?</span><span class="attribute" style="color: red;">wife</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"小小"</span><span style="color: black;">?</span><span class="attribute" style="color: red;">realName</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"大大"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">userName</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">michael</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">userName</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">bornDate</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">2011-09-28?17:39:59.432?CST</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">bornDate</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">height</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">173.3</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">height</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">myTestVo</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
</ol>

<p style="">??<span class="Apple-converted-space">?</span><span style="color: #ff0000;"><span style="color: #000000;">ps:</span><span class="Apple-converted-space">?</span>注解可以把Java的属性序列化时指定为属性或者节点元素</span></p>
<p style="">?</p>
<p style="">???<span class="Apple-converted-space">?</span><span style="color: #0000ff;">3.反序列化</span></p>
<p style="">?</p>
<p style="">??? 把上述生成的XML文件反序列化成Java bean测试代码:</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">static</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?main(String[]?args)?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">throws</span><span style="color: black;">?Exception?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????String?xmlpath?=?<span class="string" style="color: blue;">"d:/test/michael/simple_testvo.xml"</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????????</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????Serializer?serializer?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?Persister();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????File?source?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?File(xmlpath);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">try</span><span style="color: black;">?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????MyTestVo?vo?=?serializer.read(MyTestVo.<span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">,?source);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????System.out.println(vo);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????}?<span class="keyword" style="color: #7f0055; font-weight: bold;">catch</span><span style="color: black;">?(Exception?e)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????e.printStackTrace();??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p style="">?<span class="Apple-converted-space">?</span><span style="color: #ff0000;">如果XML中包括中文字符有可能反序列化时会报错,以utf-8的编码读取XML文件即可,故修改代码如下:</span></p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">????*?@param?args</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">????*?@throws?Exception</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">????*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">static</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?main(String[]?args)?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">throws</span><span style="color: black;">?Exception?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????String?xmlpath?=?<span class="string" style="color: blue;">"d:/test/michael/simple_testvo.xml"</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????Serializer?serializer?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?Persister();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????<span class="keyword" style="color: #7f0055; font-weight: bold;">try</span><span style="color: black;">?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????InputStreamReader?is?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?InputStreamReader(</span><span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?FileInputStream(??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????????????xmlpath),?<span class="string" style="color: blue;">"utf-8"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????PropertyList?parseVo?=?serializer.read(PropertyList.<span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">,?is);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????System.out.println(parseVo);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????}?<span class="keyword" style="color: #7f0055; font-weight: bold;">catch</span><span style="color: black;">?(Exception?e)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????e.printStackTrace();??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???}??</span></li>
</ol>

<p style="">? 运行反序列化,打印Java bean信息如下:</p>
<div class="quote_div" style="">MyTestVo : [ userName = michael , wife = 小小小 , realName = 大大 , height = 173.3 , bornDate = Wed Sep 28 17:39:59 CST 2011 ]<br>

<p><span style="">?</span></p>
<p style=""><span style="color: #ff0000; font-size: medium;">[二]、自定义节点名称</span></p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">1.java bean</span></p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">package</span><span style="color: black;">?michael.serialization.simplexml;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?java.util.Date;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Attribute;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Element;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Root;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@blog?http://sjsky.iteye.com</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@author?Michael</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">(name?=?</span><span class="string" style="color: blue;">"MyTest"</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?MyTestVo?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?userName;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">(name?=?</span><span class="string" style="color: blue;">"MyWife"</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?wife;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?realName;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">(name?=?</span><span class="string" style="color: blue;">"born"</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?Date?bornDate;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?Double?height;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Override</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?toString()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?</span><span class="string" style="color: blue;">"MyTestVo?:?[?userName?=?"</span><span style="color: black;">?+?userName?+?</span><span class="string" style="color: blue;">"?,?wife?=?"</span><span style="color: black;">?+?wife??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????????+?<span class="string" style="color: blue;">"?,?realName?=?"</span><span style="color: black;">?+?realName?+?</span><span class="string" style="color: blue;">"?,?height?=?"</span><span style="color: black;">?+?height??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????????+?<span class="string" style="color: blue;">"?,?bornDate?=?"</span><span style="color: black;">?+?bornDate?+?</span><span class="string" style="color: blue;">"?]"</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="comment" style="color: #008200;">//set?get?......</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p style=""><span style="color: #0000ff;">????? 2.序列化</span></p>
<p style="">?</p>
<p style="">?? 序列化后生成的simple_testvo.xml文件如下:</p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Xml代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-xml" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">MyTest</span><span style="color: black;">?</span><span class="attribute" style="color: red;">MyWife</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"小小"</span><span style="color: black;">?</span><span class="attribute" style="color: red;">realName</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"大大"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">userName</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">michael</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">userName</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">born</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">2011-09-28?21:47:37.455?CST</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">born</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">height</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">173.3</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">height</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">MyTest</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
</ol>

<p style="">?? 可以和之前的序列化XML文件对比下,看看区别在哪里。</p>
<p style="">?</p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">3.反序列化</span></p>
<p style="">?</p>
<p style="">?????? 运行反序列化程序后的打印结果如下:</p>
<div class="quote_div" style="">MyTestVo : [ userName = michael , wife = 小小 , realName = 大大 , height = 173.3 , bornDate = Wed Sep 28 21:47:37 CST 2011 ]
<p><span style="">?</span></p>
<p style=""><span style="color: #ff0000; font-size: medium;">[三]、嵌套对象</span></p>
<p style="">?</p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">1.java bean</span></p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">package</span><span style="color: black;">?michael.serialization.simplexml;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Attribute;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Element;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Root;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@blog?http://sjsky.iteye.com</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@author?Michael</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?ConfigurationVo?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?ServerVo?server;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">int</span><span style="color: black;">?id;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?ServerVo?getServer()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?server;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">int</span><span style="color: black;">?getId()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?id;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setServer(ServerVo?pServer)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????server?=?pServer;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setId(</span><span class="keyword" style="color: #7f0055; font-weight: bold;">int</span><span style="color: black;">?pId)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????id?=?pId;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">package</span><span style="color: black;">?michael.serialization.simplexml;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Attribute;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Element;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Root;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@blog?http://sjsky.iteye.com</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@author?Michael</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?ServerVo?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">int</span><span style="color: black;">?port;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?host;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?SecurityVo?security;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">int</span><span style="color: black;">?getPort()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?port;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?getHost()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?host;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?SecurityVo?getSecurity()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?security;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setPort(</span><span class="keyword" style="color: #7f0055; font-weight: bold;">int</span><span style="color: black;">?pPort)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????port?=?pPort;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setHost(String?pHost)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????host?=?pHost;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setSecurity(SecurityVo?pSecurity)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????security?=?pSecurity;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p><span style="">?</span></p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">package</span><span style="color: black;">?michael.serialization.simplexml;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Attribute;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Element;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Root;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@blog?http://sjsky.iteye.com</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@author?Michael</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?SecurityVo?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">boolean</span><span style="color: black;">?ssl;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?keyStore;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">boolean</span><span style="color: black;">?isSsl()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?ssl;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?getKeyStore()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?keyStore;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setSsl(</span><span class="keyword" style="color: #7f0055; font-weight: bold;">boolean</span><span style="color: black;">?pSsl)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????ssl?=?pSsl;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setKeyStore(String?pKeyStore)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????keyStore?=?pKeyStore;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p><span style="">?</span></p>
<p style=""><span style="color: #0000ff;">????? 2.序列化</span></p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?????*?@param?args</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?????*?@throws?Exception</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?????*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">static</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?main(String[]?args)?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">throws</span><span style="color: black;">?Exception?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????String?xmlpath?=?<span class="string" style="color: blue;">"d:/test/michael/simple_testvo.xml"</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????SecurityVo?security?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?SecurityVo();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????security.setSsl(<span class="keyword" style="color: #7f0055; font-weight: bold;">true</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????security.setKeyStore(<span class="string" style="color: blue;">"Michael"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????ServerVo?server?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?ServerVo();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????server.setHost(<span class="string" style="color: blue;">"sjsky.iteye.com"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????server.setPort(<span class="number" style="color: #c00000;">8088</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????server.setSecurity(security);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????ConfigurationVo?config?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?ConfigurationVo();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????config.setId(<span class="number" style="color: #c00000;">10000</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????config.setServer(server);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????Serializer?serializer?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?Persister();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">try</span><span style="color: black;">?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????File?xmlFile?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?File(xmlpath);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????serializer.write(config,?xmlFile);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????}?<span class="keyword" style="color: #7f0055; font-weight: bold;">catch</span><span style="color: black;">?(Exception?e)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????e.printStackTrace();??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p style="">?? 运行上述方法,序列化生成的XML文件如下:</p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Xml代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-xml" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">configurationVo</span><span style="color: black;">?</span><span class="attribute" style="color: red;">id</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"10000"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">server</span><span style="color: black;">?</span><span class="attribute" style="color: red;">port</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"8088"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">host</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">sjsky.iteye.com</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">host</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">security</span><span style="color: black;">?</span><span class="attribute" style="color: red;">ssl</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"true"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">?????????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">keyStore</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">Michael</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">keyStore</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">security</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">server</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">configurationVo</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
</ol>

<p><span style="">?</span></p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">3.反序列化的方法和之前的一致,自己</span><span class="Apple-converted-space">?</span><span style="color: #0000ff;">可以</span><span class="Apple-converted-space">?</span><span style="color: #0000ff;">测试下结果是否正确。</span></p>
<p style="">?</p>
<p style=""><span style="color: #ff0000; font-size: medium;">[四]、可选的非强制性的元素或属性</span></p>
<p style="">?</p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">1.java bean</span></p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">package</span><span style="color: black;">?michael.serialization.simplexml;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?java.util.Date;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Attribute;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Element;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Root;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@blog?http://sjsky.iteye.com</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@author?Michael</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?MyTestVo?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?userName;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="comment" style="color: #008200;">//?不是每个人都有妻子的?吼吼</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">(required?=?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">false</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?wife;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?realName;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="comment" style="color: #008200;">//?不想泄露年龄噢</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">(required?=?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">false</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?Date?bornDate;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?Double?height;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Override</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?toString()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?</span><span class="string" style="color: blue;">"MyTestVo?:?[?userName?=?"</span><span style="color: black;">?+?userName?+?</span><span class="string" style="color: blue;">"?,?wife?=?"</span><span style="color: black;">?+?wife??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????????+?<span class="string" style="color: blue;">"?,?realName?=?"</span><span style="color: black;">?+?realName?+?</span><span class="string" style="color: blue;">"?,?height?=?"</span><span style="color: black;">?+?height??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????????+?<span class="string" style="color: blue;">"?,?bornDate?=?"</span><span style="color: black;">?+?bornDate?+?</span><span class="string" style="color: blue;">"?]"</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="comment" style="color: #008200;">//省略setter?getter方法</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p style="">?</p>
<p style=""><span style="color: #0000ff;">????? 2.序列化</span></p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">????*?@param?args</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">????*?@throws?Exception</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">????*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">static</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?main(String[]?args)?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">throws</span><span style="color: black;">?Exception?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????String?xmlpath?=?<span class="string" style="color: blue;">"d:/test/michael/simple_testvo.xml"</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????MyTestVo?vo?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?MyTestVo();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????vo.setUserName(<span class="string" style="color: blue;">"michael"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????vo.setRealName(<span class="string" style="color: blue;">"大大"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????vo.setHeight(<span class="number" style="color: #c00000;">173</span><span style="color: black;">.3d);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????Serializer?serializer?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?Persister();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????<span class="keyword" style="color: #7f0055; font-weight: bold;">try</span><span style="color: black;">?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????File?xmlFile?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?File(xmlpath);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????serializer.write(vo,?xmlFile);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????}?<span class="keyword" style="color: #7f0055; font-weight: bold;">catch</span><span style="color: black;">?(Exception?e)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????e.printStackTrace();??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????}??</span></li>
</ol>

<p style="">?? 运行序列化程序后生成的XML文件如下:</p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Xml代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-xml" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">myTestVo</span><span style="color: black;">?</span><span class="attribute" style="color: red;">realName</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"大大"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">userName</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">michael</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">userName</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">height</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">173.3</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">height</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">myTestVo</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
</ol>

<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">3.反序列化</span></p>
<p style="">?</p>
<p style="">???? 运行反序列化程序后打印结果如下:</p>
<p style="">?</p>
<div class="quote_div" style="">MyTestVo : [ userName = michael , wife = null , realName = 大大 , height = 173.3 , bornDate = null ]
<p style="">?</p>
<p style=""><span style="color: #ff0000; font-size: medium;">[五]、List&lt;Object&gt;处理</span></p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">1.java bean</span></p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">package</span><span style="color: black;">?michael.serialization.simplexml;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?java.io.FileInputStream;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?java.io.InputStreamReader;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?java.util.ArrayList;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?java.util.List;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Attribute;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.ElementList;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Root;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Serializer;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.core.Persister;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@blog?http://sjsky.iteye.com</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@author?Michael</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?PropertyList?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@ElementList</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?List&lt;EntryVo&gt;?list;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?name;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?List&lt;EntryVo&gt;?getList()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?list;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?getName()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?name;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setList(List&lt;EntryVo&gt;?pList)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????list?=?pList;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setName(String?pName)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????name?=?pName;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Override</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?toString()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?</span><span class="string" style="color: blue;">"PropertyList?:?[?name?=?"</span><span style="color: black;">?+?name?+?</span><span class="string" style="color: blue;">"?,?EntryVo?list?size?=?"</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????????+?list.size()?+?<span class="string" style="color: blue;">"?]?."</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p><span style="">?</span></p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">package</span><span style="color: black;">?michael.serialization.simplexml;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Attribute;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Element;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Root;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@blog?http://sjsky.iteye.com</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@author?Michael</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?EntryVo?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?name;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?value;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?getName()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?name;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?getValue()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?value;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setName(String?pName)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????name?=?pName;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setValue(String?pValue)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????value?=?pValue;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p><span style="">?</span></p>
<p style=""><span style="color: #0000ff;">????? 2.序列化</span></p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">????*?@param?args</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">????*?@throws?Exception</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">????*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">static</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?main(String[]?args)?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">throws</span><span style="color: black;">?Exception?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????String?xmlpath?=?<span class="string" style="color: blue;">"d:/test/michael/simple_testvo.xml"</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????Serializer?serializer?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?Persister();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????<span class="keyword" style="color: #7f0055; font-weight: bold;">try</span><span style="color: black;">?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????PropertyList?vo?=?initBean();??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????serializer.write(vo,?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?File(xmlpath));??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????}?<span class="keyword" style="color: #7f0055; font-weight: bold;">catch</span><span style="color: black;">?(Exception?e)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????????e.printStackTrace();??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">static</span><span style="color: black;">?PropertyList?initBean()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????PropertyList?vo?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?PropertyList();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????vo.setName(<span class="string" style="color: blue;">"Wife?List"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????List&lt;EntryVo&gt;?subList?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?ArrayList&lt;EntryVo&gt;();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????EntryVo?subvo?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?EntryVo();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo.setName(<span class="string" style="color: blue;">"A"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo.setValue(<span class="string" style="color: blue;">"福晋"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subList.add(subvo);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?EntryVo();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo.setName(<span class="string" style="color: blue;">"B"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo.setValue(<span class="string" style="color: blue;">"侧福晋"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subList.add(subvo);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?EntryVo();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo.setName(<span class="string" style="color: blue;">"C"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo.setValue(<span class="string" style="color: blue;">"小三"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subList.add(subvo);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo?=?<span class="keyword" style="color: #7f0055; font-weight: bold;">new</span><span style="color: black;">?EntryVo();??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo.setName(<span class="string" style="color: blue;">"D"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subvo.setValue(<span class="string" style="color: blue;">"二奶"</span><span style="color: black;">);??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????subList.add(subvo);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????vo.setList(subList);??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?vo;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???}??</span></li>
</ol>

<p><span style="">?</span></p>
<p style="">?运行序列化程序后生成的XML文件如下:</p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Xml代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-xml" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">propertyList</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"Wife?List"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">list</span><span style="color: black;">?</span><span class="attribute" style="color: red;">class</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"java.util.ArrayList"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">entryVo</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"A"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">?????????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">福晋</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">entryVo</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">entryVo</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"B"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">?????????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">侧福晋</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">entryVo</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">entryVo</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"C"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">?????????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">小三</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">entryVo</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">entryVo</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"D"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">?????????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">二奶</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">entryVo</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">list</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">propertyList</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
</ol>

<p style="">?</p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">3.反序列化,运行结果打印对象信息如下:</span></p>
<p style="">?</p>
<div class="quote_div" style="">PropertyList : [ name = Wife List , EntryVo list size = 4 ] .
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">4.修改注解@ElementList的参数</span></p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@ElementList</span><span style="color: black;">(name?=?</span><span class="string" style="color: blue;">"WifeList"</span><span style="color: black;">,?entry?=?</span><span class="string" style="color: blue;">"wife"</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?List&lt;EntryVo&gt;?list;??</span></span></li>
</ol>

<p style="">??? 序列化后生成的XML文件如下:</p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Xml代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-xml" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">propertyList</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"Wife?List"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">WifeList</span><span style="color: black;">?</span><span class="attribute" style="color: red;">class</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"java.util.ArrayList"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">wife</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"A"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">?????????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">福晋</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">wife</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">wife</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"B"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">?????????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">侧福晋</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">wife</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">wife</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"C"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">?????????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">小三</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">wife</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">wife</span><span style="color: black;">?</span><span class="attribute" style="color: red;">name</span><span style="color: black;">=</span><span class="attribute-value" style="color: blue;">"D"</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">?????????<span class="tag" style="color: #006699; font-weight: bold;">&lt;</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">二奶</span><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">value</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">wife</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???<span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">WifeList</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="tag" style="color: #006699; font-weight: bold;">&lt;/</span><span class="tag-name" style="color: #006699; font-weight: bold;">propertyList</span><span class="tag" style="color: #006699; font-weight: bold;">&gt;</span><span style="color: black;">??</span></span></li>
</ol>

<p style="">??? 注意XML文件的变化。</p>
<p style="">?</p>
<p style=""><span style="color: #ff0000; font-size: medium;">[六]、</span><span class="Apple-converted-space">?</span><span style="color: #ff0000;"><span style="font-size: medium;">inline 参数用法</span></span></p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">1.java bean</span></p>
<p style="">?????? 以上节中得bean为基础修改注解如下:</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?PropertyList?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@ElementList</span><span style="color: black;">(name?=?</span><span class="string" style="color: blue;">"WifeList"</span><span style="color: black;">,?entry?=?</span><span class="string" style="color: blue;">"wife"</span><span style="color: black;">,?inline?=?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">true</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?List&lt;EntryVo&gt;?list;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?name;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?List&lt;EntryVo&gt;?getList()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?list;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?getName()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?name;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setList(List&lt;EntryVo&gt;?pList)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????list?=?pList;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setName(String?pName)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????name?=?pName;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Override</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?toString()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?</span><span class="string" style="color: blue;">"PropertyList?:?[?name?=?"</span><span style="color: black;">?+?name?+?</span><span class="string" style="color: blue;">"?,?EntryVo?list?size?=?"</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????????????+?list.size()?+?<span class="string" style="color: blue;">"?]?."</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p><span style="">?</span></p>
<p style=""><span style="color: #0000ff;">????? 2.序列化后生成的XML文件如下:</span></p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span style="color: black;">&lt;propertyList?name=</span><span class="string" style="color: blue;">"Wife?List"</span><span style="color: black;">&gt;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???&lt;wife?name=<span class="string" style="color: blue;">"A"</span><span style="color: black;">&gt;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????&lt;value&gt;福晋&lt;/value&gt;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???&lt;/wife&gt;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???&lt;wife?name=<span class="string" style="color: blue;">"B"</span><span style="color: black;">&gt;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????&lt;value&gt;侧福晋&lt;/value&gt;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???&lt;/wife&gt;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???&lt;wife?name=<span class="string" style="color: blue;">"C"</span><span style="color: black;">&gt;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????&lt;value&gt;小三&lt;/value&gt;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???&lt;/wife&gt;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???&lt;wife?name=<span class="string" style="color: blue;">"D"</span><span style="color: black;">&gt;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??????&lt;value&gt;二奶&lt;/value&gt;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">???&lt;/wife&gt;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">&lt;/propertyList&gt;??</span></li>
</ol>

<p style="">? ? 和上节生成的文件相比,XML结构少了一个层次。</p>
<p style="">?</p>
<p style=""><span style="color: #ff0000; font-size: medium;">[七]、构造函数的注解处理</span></p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">1.java bean</span></p>
<p style="">?</p>
<div class="dp-highlighter" style="">
<div class="bar">
<div class="tools" style="text-align: left; margin: 0px; color: black; font-weight: bold; padding: 3px;">Java代码<span class="Apple-converted-space">?</span><embed quality="high" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" width="14" height="15" src="http://sjsky.iteye.com/javascripts/syntaxhighlighter/clipboard_new.swf"></embed>?<a style="color: #108ac6; text-decoration: underline;" title="收藏这段代码"><img class="star" style="border-width: 0px;" src="http://sjsky.iteye.com/images/icon_star.png" alt="收藏代码"></a>


<ol class="dp-j" style="padding-bottom: 2px; line-height: 1.4em; background-color: #ffffff; margin: 0px 0px 1px; padding-left: 0px; padding-right: 0px; color: #2b91af; font-size: 1em; padding-top: 2px; border: #d1d7dc 1px solid;">
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">package</span><span style="color: black;">?michael.serialization.simplexml;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Attribute;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Element;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Root;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.Serializer;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">import</span><span style="color: black;">?org.simpleframework.xml.core.Persister;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">/**</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@blog?http://sjsky.iteye.com</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*?@author?Michael</span>?</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="comment" style="color: #008200;">?*/</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="annotation" style="color: #646464;">@Root</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;"><span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">class</span><span style="color: black;">?EntryVo?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?EntryVo(</span><span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">(name?=?</span><span class="string" style="color: blue;">"name"</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????String?name,?<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">(name?=?</span><span class="string" style="color: blue;">"value"</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????String?value)?{??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">this</span><span style="color: black;">.name?=?name;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">this</span><span style="color: black;">.value?=?value;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Attribute</span><span style="color: black;">(name?=?</span><span class="string" style="color: blue;">"name"</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?name;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Element</span><span style="color: black;">(name?=?</span><span class="string" style="color: blue;">"value"</span><span style="color: black;">)??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">private</span><span style="color: black;">?String?value;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?getName()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?name;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?getValue()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?value;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setName(String?pName)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????name?=?pName;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?</span><span class="keyword" style="color: #7f0055; font-weight: bold;">void</span><span style="color: black;">?setValue(String?pValue)?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????value?=?pValue;??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="annotation" style="color: #646464;">@Override</span><span style="color: black;">??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????<span class="keyword" style="color: #7f0055; font-weight: bold;">public</span><span style="color: black;">?String?toString()?{??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????????<span class="keyword" style="color: #7f0055; font-weight: bold;">return</span><span style="color: black;">?</span><span class="string" style="color: blue;">"EntryVo?:?[?name?=?"</span><span style="color: black;">?+?name?+?</span><span class="string" style="color: blue;">",?value?=?"</span><span style="color: black;">?+?value?+?</span><span class="string" style="color: blue;">"?]."</span><span style="color: black;">;??</span></span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">????}??</span></li>
<li style="border-left: #d1d7dc 1px solid; padding-bottom: 0px; line-height: 18px; background-color: #fafafa; margin: 0px 0px 0px 38px; padding-left: 10px; padding-right: 0px; font-size: 1em; padding-top: 0px;"><span style="color: black;">}??</span></li>
</ol>

<p style="">?</p>
<p style=""><span style="color: #0000ff;">????? 2.序列化</span></p>
<p style="">?</p>
<p style="">????? 生成的XML文件如下:</p>
<div class="quote_div" style="">&lt;entryVo name="blog"&gt;<br>&lt;value&gt;http://sjsky.iteye.com&lt;/value&gt;<br>&lt;/entryVo&gt;
<p><span style="">?</span></p>
<p style="">?????<span class="Apple-converted-space">?</span><span style="color: #0000ff;">3.反序列化</span></p>
<p style="">?</p>
<p style="">????? 反序列化生成的bean的信息打印如下:</p>
<p style="">?</p>
<div class="quote_div" style="">EntryVo : [ name = blog, value = http://sjsky.iteye.com ].
<p style="">?</p>
<p style="">ps:<span style="color: #ff0000;">如果java bean有参数的构函数,需要在构造函数的参数前也加上相应的注解,否则在反序列化时会出错。</span></p>
<p style="">?</p>
<p style="">本文就先介绍到这,下次再介绍其他运用事例。</p>
<p style="">?</p>
<p style="">?</p>
<p style="">本文连接:http://sjsky.iteye.com/blog/1182057</p>
<p style="">?</p>
<p style="">?</p>
<p style="">转载请注明来自:Michael's blog @<span class="Apple-converted-space">?</span><a style="color: #108ac6; text-decoration: underline;" href="http://sjsky.iteye.com/" target="_blank">http://sjsky.iteye.com</a><span class="Apple-converted-space">?</span><a style="color: #108ac6; text-decoration: underline;" href="http://sjsky.iteye.com/" target="_blank"></a><br><br>----------------------------- 分 ------------------------------ 隔 ------------------------------ 线 ------------------------------</p>
 
分享到:
评论

相关推荐

    Simple XML Editor

    "Simple XML Editor"是一款基于Java开发的开源软件,专门用于XML文档的编辑和处理。XML(eXtensible Markup Language)是一种标记语言,常用于数据交换、存储和结构化信息的表述。这款编辑器旨在为用户提供一个简洁...

    simple-xml-2.7.1.rar

    《深入理解Simple XML库:解析与应用》 在IT行业中,数据交换和序列化是常见的需求,XML作为标准的数据交换格式,广泛应用于各种系统间的数据交互。然而,XML的复杂性有时会给开发者带来困扰,因此出现了许多简化...

    Simple工具包解析XML文件

    SAX解析xml数据。比较麻烦的是,每份需要解析的xml数据对应的都需要创建相应的DefaultHandler2类,如果App后台接口较多的话,需要创建的解析后台数据的DefaultHandler2类也就...这种情况下建议还是使用simple-xml解析

    simple-xml-safe-2.7.1-API文档-中文版.zip

    赠送jar包:simple-xml-safe-2.7.1.jar; 赠送原API文档:simple-xml-safe-2.7.1-javadoc.jar; 赠送源代码:simple-xml-safe-2.7.1-sources.jar; 赠送Maven依赖信息文件:simple-xml-safe-2.7.1.pom; 包含翻译后...

    simplexml

    描述 "a simple xml dom parser" 暗示这是一个简化版的DOM解析器,它可能具有以下特点: 1. 易于使用:面向非专业XML开发者,提供简单直观的API。 2. 轻量级:相比于完整的DOM解析器,它可能占用更少的资源,适合...

    Simple-XML-PrefixHack:将Hacking前缀为Simple XML Android Framework,现在该库接受具有namepacing的重复元素

    标题“Simple-XML-PrefixHack:将Hacking前缀为Simple XML Android Framework,现在该库接受具有namepacing的重复元素”暗示了一个针对Simple XML库的改进或扩展,解决了处理XML命名空间中重复元素的问题。...

    simple-xml jar包

    **简单XML库(Simple-XML)详解** 在Java开发中,XML作为一种标准的数据交换格式,被广泛用于存储和传输数据。然而,XML的解析和序列化通常需要借助于专门的库来实现,其中Simple-XML就是一个高效且易于使用的库。...

    GSA Simple XML Parser-开源

    **GSA Simple XML Parser** 是一个基于PHP的开源XML解析器,它采用了DOM(Document Object Model)风格的设计,使得开发者能够方便地处理XML文档。在理解这个解析器之前,我们首先需要了解XML(eXtensible Markup ...

    Simple XML Parser-开源

    "Simple XML Parser"正是这样一种专为小型设备设计的开源XML解析器,它专注于XML的子集,不支持实体和名称空间,以简化解析过程并降低内存需求。 开源软件意味着源代码对公众开放,允许用户自由地查看、使用、修改...

    simple-xml-safe-2.7.1.jar

    simple-xml-safe-2.7.1.jar

    Super Simple XML-开源

    开源的“Super Simple XML”库针对XML解析提供了一种轻量级且易于上手的解决方案。它不完全遵循W3C(World Wide Web Consortium)的标准规范,但满足了基础的XML解析需求,特别适合对性能和简洁性有较高要求的项目。...

    Simple XML Configuration Library-开源

    **Simple XML Configuration Library 开源解析库** Simple XML Configuration Library 是一个专为解析简单配置文件而设计的开源XML库。这个库特别关注于易用性和可移植性,使其能够在多种操作系统上运行,包括* nix...

    simple-xml-2.6.2.jar

    simple-xml-2.6.2.jar主要用于模拟报文的类库,有需要的可以下载

    simple-xml-2.7.1

    《深入理解Simple-XML库:解析与应用》 在当今的软件开发中,XML(Extensible Markup Language)作为数据交换和存储的标准格式,扮演着重要的角色。为了方便开发者高效地处理XML,各种解析库应运而生,其中Simple-...

    dsx:Java的原始Damn Simple Xml实现

    dsx(Java的Damn Simple Xml) 该库利用方法链。 它与Java XML Standard API不兼容。 它包含与Microsoft XmlSerializer输入/输出XML格式兼容的序列化程序。 它包含另一个Microsoft兼容的序列化器,其行为类似于...

    Android开发-Retrofit-AndroidStudio(四)simplexml解析XML_免积分

    简单XML库(Simple XML)是Java中一个轻量级、高效的XML序列化和反序列化库,非常适合处理XML格式的数据。 首先,让我们了解Retrofit的基本概念。Retrofit由Square公司开发,它允许开发者通过简单的注解将HTTP操作...

    perl的xml::simple解析文件

    Perl中的XML::Simple模块是Perl社区广泛使用的XML解析器,尤其适合处理小型或结构简单的XML文档。这个模块的名称虽然包含“Simple”,但它实际上提供了一种简洁的接口,用于将XML数据转换为Perl数据结构,反之亦然。...

    libxmldiff - Simple XML Diff Library-开源

    "libxmldiff - Simple XML Diff Library-开源" 指的是一个名为libxmldiff的开源库,它专为XML(eXtensible Markup Language)文件设计,提供了比较XML文档差异的功能。这个库的核心是提供简单的API,使得开发者能够...

    SimpleXML代码

    XML(eXtensible Markup Language)是一种用于标记数据的语言,被广泛应用于数据交换、配置文件、文档存储等领域。在Delphi编程环境中,处理XML文件通常需要用到解析库或控件,而"SimpleXML"可能就是一个这样的组件...

    Simple-xml-2.7.1

    Simple 是一个 Java 框架,用于简化序列化和反序列化 XML 的过程。使用 Simple,开发人员可以简化(名字由此而来)将简单老 Java 对象(POJO)转换成 XML 文档的过程 — 即所谓的序列化(serialization)过程。...

Global site tag (gtag.js) - Google Analytics