锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲欧洲日本国产,亚洲国产夜色在线观看,亚洲产国偷V产偷V自拍色戒 http://www.tkk7.com/hbcui1984/category/15275.htmlzh-cnTue, 27 Feb 2007 18:42:52 GMTTue, 27 Feb 2007 18:42:52 GMT60浣跨敤XStream榪涜POJO鍜寈ml涔嬮棿鐨勮漿鎹?/title><link>http://www.tkk7.com/hbcui1984/articles/71865.html</link><dc:creator>鎵窞姊?/dc:creator><author>鎵窞姊?/author><pubDate>Mon, 25 Sep 2006 15:33:00 GMT</pubDate><guid>http://www.tkk7.com/hbcui1984/articles/71865.html</guid><wfw:comment>http://www.tkk7.com/hbcui1984/comments/71865.html</wfw:comment><comments>http://www.tkk7.com/hbcui1984/articles/71865.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/hbcui1984/comments/commentRss/71865.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/hbcui1984/services/trackbacks/71865.html</trackback:ping><description><![CDATA[     鎽樿: 浣跨敤XStream榪涜POJO鍜寈ml涔嬮棿鐨勮漿鎹? XStream鏄竴涓紑婧愰」鐩紝鍒╃敤瀹冨彲浠ユ柟渚跨殑榪涜java瀵硅薄鍜寈ml涔嬮棿榪涜杞崲錛屼粠鑰屽湪嫻嬭瘯錛屾湇鍔″櫒璁劇疆絳夋柟闈㈡湁寰堝ソ鐨勫簲鐢ㄣ? 鍏堝緩涓や釜java瀵硅薄 1.Adress綾? package 聽xml_chb; public ...  <a href='http://www.tkk7.com/hbcui1984/articles/71865.html'>闃呰鍏ㄦ枃</a><img src ="http://www.tkk7.com/hbcui1984/aggbug/71865.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/hbcui1984/" target="_blank">鎵窞姊?/a> 2006-09-25 23:33 <a href="http://www.tkk7.com/hbcui1984/articles/71865.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title> dom4j瀛︿範鎬葷粨錛堜簩錛?/title><link>http://www.tkk7.com/hbcui1984/articles/71619.html</link><dc:creator>鎵窞姊?/dc:creator><author>鎵窞姊?/author><pubDate>Sun, 24 Sep 2006 15:41:00 GMT</pubDate><guid>http://www.tkk7.com/hbcui1984/articles/71619.html</guid><wfw:comment>http://www.tkk7.com/hbcui1984/comments/71619.html</wfw:comment><comments>http://www.tkk7.com/hbcui1984/articles/71619.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/hbcui1984/comments/commentRss/71619.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/hbcui1984/services/trackbacks/71619.html</trackback:ping><description><![CDATA[ <h4 align="center">聽dom4j瀛︿範鎬葷粨錛堜簩錛?/h4> <p> <strong>錛堜竴錛夌Щ闄よ妭鐐瑰強灞炴?/strong> </p> <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 95%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <div> <img id="_1_48_Open_Image" onclick="this.style.display='none'; document.getElementById('_1_48_Open_Text').style.display='none'; document.getElementById('_1_48_Closed_Image').style.display='inline'; document.getElementById('_1_48_Closed_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" /> <img id="_1_48_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('_1_48_Closed_Text').style.display='none'; document.getElementById('_1_48_Open_Image').style.display='inline'; document.getElementById('_1_48_Open_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" /> <span style="COLOR: #000000">聽聽聽聽</span> <span id="_1_48_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**聽*/</span> <span id="_1_48_Open_Text"> <span style="COLOR: #008000">/**</span> <span style="COLOR: #008000">縐婚櫎鑺傜偣鍜屽睘鎬х殑鎿嶄綔<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽*聽</span> <span style="COLOR: #808080">@throws</span> <span style="COLOR: #008000">聽DocumentException<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" />聽聽聽聽聽</span> <span style="COLOR: #008000">*/</span> </span> <span style="COLOR: #000000"> <br /> <img id="_104_1214_Open_Image" onclick="this.style.display='none'; document.getElementById('_104_1214_Open_Text').style.display='none'; document.getElementById('_104_1214_Closed_Image').style.display='inline'; document.getElementById('_104_1214_Closed_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" /> <img id="_104_1214_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('_104_1214_Closed_Text').style.display='none'; document.getElementById('_104_1214_Open_Image').style.display='inline'; document.getElementById('_104_1214_Open_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" />聽聽聽聽</span> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">void</span> <span style="COLOR: #000000">聽RemoveOperator()聽</span> <span style="COLOR: #0000ff">throws</span> <span style="COLOR: #000000">聽DocumentException</span> <span id="_104_1214_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">...</span> <span id="_104_1214_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">寰呯敓鎴恱ml鐨勫瓧絎︿覆</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽String聽str</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"><root><book聽type='science'><Name>Java</Name><price>100</price></book></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"><book聽type='society'><Name>Society聽security</Name><price>130</price></book></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"><author><name>chb</name><sex>boy</sex></author></root></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">鐢熸垚涓涓狣ocument</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽Document聽document聽</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">聽DocumentHelper.parseText(str);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽Element聽root</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">document.getRootElement();<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">鍒犻櫎綾誨瀷涓簊ociety鐨刡ook鑺傜偣</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽Element聽book_society</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">(Element)document.selectSingleNode(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">//book[@type='society']</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽root.remove(book_society);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">1銆傛紜殑鍒犻櫎浜嗙被鍨嬩負society鐨刡ook鑺傜偣</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(document.asXML());<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">鍒犻櫎sex鑺傜偣</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽Element聽sex</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">(Element)root.selectSingleNode(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">//sex</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">浠巖oot鑺傜偣鍒犻櫎</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽root.remove(sex);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">2銆傝繖鏍鋒槸涓嶈兘鍒犻櫎sex鑺傜偣鐨?/span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(document.asXML());<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">浠巃uthor鑺傜偣鍒犻櫎</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽root.element(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">author</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">).remove(sex);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">3銆傝繖鏍峰氨鍙互姝g‘鍒犻櫎sex鑺傜偣</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(document.asXML());<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">鍒犻櫎灞炴?/span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽Attribute聽type</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">root.element(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">book</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">).attribute(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">type</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽root.element(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">book</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">).remove(type);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">4銆傛紜垹闄ook鑺傜偣鐨則ype灞炴?/span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(document.asXML());<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" />聽聽聽聽}</span> </span> </div> </div> <p>杈撳嚭緇撴灉涓猴細</p> <p>1銆傛紜殑鍒犻櫎浜嗙被鍨嬩負society鐨刡ook鑺傜偣<br /><?xml version="1.0" encoding="UTF-8"?><br /><root><book type="science"><Name>Java</Name><price>100</price></book><author><name>chb</name><sex>boy</sex></author></root><br />2銆傝繖鏍鋒槸涓嶈兘鍒犻櫎sex鑺傜偣鐨?br /><?xml version="1.0" encoding="UTF-8"?><br /><root><book type="science"><Name>Java</Name><price>100</price></book><author><name>chb</name><sex>boy</sex></author></root><br />3銆傝繖鏍峰氨鍙互姝g‘鍒犻櫎sex鑺傜偣<br /><?xml version="1.0" encoding="UTF-8"?><br /><root><book type="science"><Name>Java</Name><price>100</price></book><author><name>chb</name></author></root><br />4銆傛紜垹闄ook鑺傜偣鐨則ype灞炴?br /><?xml version="1.0" encoding="UTF-8"?><br /><root><book><Name>Java</Name><price>100</price></book><author><name>chb</name></author></root><br /></p> <p> <strong>鍒嗘瀽錛?/strong> </p> <p>絎簩涓緭鍑虹粨鏋滀笉鑳藉垹闄ex鑺傜偣錛屾垜浠渶瑕佺湅dom4j鐨凙PI</p> <h3>remove</h3> <pre>public boolean <b>remove</b>(<a title="interface in org.dom4j" >Element</a>聽element)</pre> <dl> <dd>Removes the given <code>Element</code> if the node is an <font color="#ff0000">immediate child</font> of this branch. If the given node is not an immediate child of this branch then the <a ><code>Node.detach()</code></a>method should be used instead. <p></p></dd> <dd> <dl> </dl> </dd> <dd> <dl> <dt> <b>Parameters:</b> </dt> <dd> <code>element</code> - is the element to be removed </dd> <dt> <b>Returns:</b> </dt> <dd>true if the element was removed</dd> </dl> </dd> </dl> <p>浠庝腑鎴戜滑鍙互鐪嬪嚭錛宺emove鍙兘鐢ㄥ湪瀹冭嚜宸辯殑鐩存帴瀛╁瓙鑺傜偣涓婏紝涓嶈兘鐢ㄥ湪瀛欏瓙鑺傜偣涓婏紝鍥犱負sex鑺傜偣涓嶆槸root鑺傜偣鐨勭洿鎺ュ瀛愯妭鐐癸紝鎵浠ヤ笉鑳藉垹闄わ紱鑰宻ex鑺傜偣鍗存槸author鑺傜偣鐨勭洿鎺ュ瀛愯妭鐐癸紝鎵浠ョ涓変釜杈撳嚭鍙互鍒犻櫎銆?/p> <p> <strong>錛堜簩錛夊皢涓や釜Document鍚堝茍涓轟竴涓狣ocument</strong> </p> <p>鍏堢湅涓涓敊璇殑鎯呭喌</p> <p>錛?錛変嬌鐢╝dd()鏂規硶娣誨姞</p> <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 95%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <div> <img id="_54_679_Open_Image" onclick="this.style.display='none'; document.getElementById('_54_679_Open_Text').style.display='none'; document.getElementById('_54_679_Closed_Image').style.display='inline'; document.getElementById('_54_679_Closed_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" /> <img id="_54_679_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('_54_679_Closed_Text').style.display='none'; document.getElementById('_54_679_Open_Image').style.display='inline'; document.getElementById('_54_679_Open_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" /> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">void</span> <span style="COLOR: #000000">聽CombineDocument()聽</span> <span style="COLOR: #0000ff">throws</span> <span style="COLOR: #000000">聽DocumentException</span> <span id="_54_679_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">...</span> <span id="_54_679_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">寰呯敓鎴愪袱涓狣ocument鐨勫瓧絎︿覆</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽String聽str_book</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"><root><book聽type='science'><Name>Java</Name><price>100</price></book></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"><book聽type='society'><Name>Society聽security</Name><price>130</price></book></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"></root></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽String聽str_author</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"><root><author><name>chb</name><sex>boy</sex></author></root></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">鐢熸垚涓や釜Document</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽Document聽doc_book</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">DocumentHelper.parseText(str_book);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽Document聽doc_author</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">DocumentHelper.parseText(str_author);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">鍙栧嚭doc_author鐨刟uthor鑺傜偣錛屾坊鍔犲埌doc_book鐨勬牴緇撶偣</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽Element聽author</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">(Element)doc_author.selectSingleNode(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">//author</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽doc_book.getRootElement().add(author);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(doc_book.asXML());<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" />聽聽聽聽}</span> </span> </div> </div> <p>璋冪敤CombineDocument鍑芥暟錛屼細鍑虹幇浠ヤ笅閿欒錛?/p> <p> <font color="#ff0000">org.dom4j.IllegalAddException</font>: The node "<a href="mailto:org.dom4j.tree.DefaultElement@17bd6a1">org.dom4j.tree.DefaultElement@17bd6a1</a> [Element: <author attributes: []/>]" could not be added to the element "root" because: <font color="#ff0000">The Node already has an existing parent of "root"<br /></font>聽at org.dom4j.tree.AbstractElement.addNode(AbstractElement.java:1521)<br />聽at org.dom4j.tree.AbstractElement.add(AbstractElement.java:1002)<br />聽at xml_chb.dom4j_chb.CombineDocument(dom4j_chb.java:189)<br />聽at xml_chb.dom4j_chb.main(dom4j_chb.java:199)<br />Exception in thread "main" </p> <p>鍗蟲彁紺篴uthor鑺傜偣宸茬粡鏈変竴涓猺oot鑺傜偣浜嗭紝涓嶈兘鍐嶆坊鍔犲埌鍙︿竴涓妭鐐逛笂鍘匯?/p> <p>錛?錛変嬌鐢╝ppendContent()鏂規硶</p> <p>鍗沖皢doc_book.getRootElement().add(author);</p> <p>鏀逛負錛歞oc_book.getRootElement().appendContent(author);</p> <p>杈撳嚭緇撴灉涓猴細</p> <p><?xml version="1.0" encoding="UTF-8"?><br /><root><br /><book type="science"><Name>Java</Name><price>100</price></book><br /><book type="society"><Name>Society security</Name><price>130</price></book><br /><font color="#0000ff"><name>chb</name><sex>boy</sex></font><br /></root></p> <p>鍙互鐪嬪嚭錛岀己灝戜簡author鑺傜偣錛屽彧鏄妸author鑺傜偣鐨勫瓙鑺傜偣娣誨姞涓婂幓浜嗭紝浣嗘槸鐢辨鍙錛宎ppendContent鏂規硶鏄湁甯屾湜鐨勩?/p> <p>鎴戜滑鐪嬩竴涓媎om4j鐨凙PI:</p> <h3>appendContent</h3> <pre>public void <b>appendContent</b>(<a title="interface in org.dom4j" >Branch</a>聽branch)</pre> <dl> <dd>Appends<font color="#ff0000"> the content of the given branch</font> to this branch instance. This method behaves like the <a title="class or interface in java.util" ><code>Collection.addAll(java.util.Collection)</code></a> method. <p></p></dd> <dd> <dl> </dl> </dd> <dd> <dl> <dt> <b>Parameters:</b> </dt> <dd> <code>branch</code> - is the branch whose content will be added to me.</dd> </dl> </dd> </dl> <hr /> <p>錛?錛変嬌鐢ㄦ紜殑appendContent鏂規硶</p> <p>灝嗭細Element author=(Element)doc_author.selectSingleNode("http://author");</p> <p>doc_book.getRootElement().appendContent(author);</p> <p>鏀逛負錛歞oc_book.getRootElement().appendContent(doc_author.getRootElement());</p> <p>杈撳嚭錛?/p> <p><?xml version="1.0" encoding="UTF-8"?><br /><root><br /><book type="science"><Name>Java</Name><price>100</price></book><br /><book type="society"><Name>Society security</Name><price>130</price></book><br /><author><name>chb</name><sex>boy</sex></author><br /></root></p> <p>鏄紜粨鏋?/p> <p>錛?錛夊彟涓縐嶅彲琛岀殑鏂規硶</p> <div style="BORDER-RIGHT: windowtext 0.5pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 0.5pt solid; PADDING-LEFT: 5.4pt; BACKGROUND: #e6e6e6; PADDING-BOTTOM: 4px; BORDER-LEFT: windowtext 0.5pt solid; WIDTH: 95%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: windowtext 0.5pt solid"> <div> <img id="_54_752_Open_Image" onclick="this.style.display='none'; document.getElementById('_54_752_Open_Text').style.display='none'; document.getElementById('_54_752_Closed_Image').style.display='inline'; document.getElementById('_54_752_Closed_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif" /> <img id="_54_752_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; document.getElementById('_54_752_Closed_Text').style.display='none'; document.getElementById('_54_752_Open_Image').style.display='inline'; document.getElementById('_54_752_Open_Text').style.display='inline';" src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif" /> <span style="COLOR: #0000ff">public</span> <span style="COLOR: #000000">聽</span> <span style="COLOR: #0000ff">void</span> <span style="COLOR: #000000">聽CombineDocument()聽</span> <span style="COLOR: #0000ff">throws</span> <span style="COLOR: #000000">聽DocumentException</span> <span id="_54_752_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">...</span> <span id="_54_752_Open_Text"> <span style="COLOR: #000000">{<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">寰呯敓鎴愪袱涓狣ocument鐨勫瓧絎︿覆</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽String聽str_book</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"><root><book聽type='science'><Name>Java</Name><price>100</price></book></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"><book聽type='society'><Name>Society聽security</Name><price>130</price></book></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽聽聽聽聽</span> <span style="COLOR: #000000">+</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"></root></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽String聽str_author</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000"><root><author><name>chb</name><sex>boy</sex></author></root></span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">;<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">鐢熸垚涓や釜Document</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽Document聽doc_book</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">DocumentHelper.parseText(str_book);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽Document聽doc_author</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">DocumentHelper.parseText(str_author);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">鏂扮敓鎴愪竴涓狣ocument</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽Element聽author</span> <span style="COLOR: #000000">=</span> <span style="COLOR: #000000">DocumentHelper.createElement(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">author</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽author.appendContent((Element)doc_author.selectSingleNode(</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">//author</span> <span style="COLOR: #000000">"</span> <span style="COLOR: #000000">));<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽</span> <span style="COLOR: #008000">//</span> <span style="COLOR: #008000">褰撳墠author灝氭棤鐖惰妭鐐癸紝鎵浠ュ彲浠ヤ嬌鐢╝dd鏂規硶娣誨姞</span> <span style="COLOR: #008000"> <br /> <img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /> </span> <span style="COLOR: #000000">聽聽聽聽聽聽聽聽doc_book.getRootElement().add(author);<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" /><br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif" />聽聽聽聽聽聽聽聽System.out.println(doc_book.asXML());<br /><img src="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" align="top" _fcksavedurl="http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif" />聽聽聽聽}</span> </span> </div> </div> <img src ="http://www.tkk7.com/hbcui1984/aggbug/71619.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/hbcui1984/" target="_blank">鎵窞姊?/a> 2006-09-24 23:41 <a href="http://www.tkk7.com/hbcui1984/articles/71619.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>dom4j瀛︿範鎬葷粨錛堜竴錛?/title><link>http://www.tkk7.com/hbcui1984/articles/71512.html</link><dc:creator>鎵窞姊?/dc:creator><author>鎵窞姊?/author><pubDate>Sat, 23 Sep 2006 18:10:00 GMT</pubDate><guid>http://www.tkk7.com/hbcui1984/articles/71512.html</guid><wfw:comment>http://www.tkk7.com/hbcui1984/comments/71512.html</wfw:comment><comments>http://www.tkk7.com/hbcui1984/articles/71512.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/hbcui1984/comments/commentRss/71512.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/hbcui1984/services/trackbacks/71512.html</trackback:ping><description><![CDATA[ <h4 align="center">dom4j瀛︿範鎬葷粨錛堜竴錛壜?/h4> <p> <strong>錛堜竴錛夊垱寤篋ocument鐨勫熀鏈搷浣?/strong> </p> <p> <font color="#333399">/**<br />聽 * xml鍩烘湰鎿嶄綔<br />聽 */</font> <br />聽public void BaseOperation(){<br />聽<font color="#99cc00">聽//鍒涘緩涓涓猟ocument<br /></font>聽聽Document document=DocumentHelper.createDocument();<br />聽聽<font color="#99cc00">//鍒涘緩鏍圭粨鐐?br /></font>聽聽Element root=document.addElement("root");<br />聽<font color="#99cc00">聽//涓烘牴緇撶偣娣誨姞涓涓猙ook鑺傜偣<br /></font>聽聽Element book1=root.addElement("book");<br />聽聽<font color="#99cc00">//涓篵ook1娣誨姞灞炴ype<br /></font>聽聽book1.addAttribute("type","science");<br />聽聽<font color="#99cc00">//涓篵ook1娣誨姞name瀛愯妭鐐?br /></font>聽聽Element name1=book1.addElement("Name");<br />聽<font color="#99cc00">聽//騫惰緗叾name涓?Java"<br /></font>聽聽name1.setText("Java");<br />聽聽<font color="#99cc00">//涓篵ook1鍒涘緩涓涓猵rice鑺傜偣,騫惰鍏朵環鏍間負100<br /></font>聽聽book1.addElement("price").setText("100");<br />聽聽<br />聽聽<font color="#99cc00">//涓烘牴緇撶偣娣誨姞絎簩涓猙ook鑺傜偣錛屽茍璁劇疆璇ook鑺傜偣鐨則ype灞炴?br /></font>聽聽Element book2=root.addElement("book").addAttribute("type","science");<br />聽<font color="#99cc00">聽//涓篵ook1娣誨姞name瀛愯妭鐐?br /></font>聽聽Element name2=book2.addElement("Name");<br />聽聽<font color="#99cc00">//騫惰緗叾name涓?Oracle"<br /></font>聽聽name2.setText("Oracle");<br />聽<font color="#99cc00">聽//涓篵ook1鍒涘緩涓涓猵rice鑺傜偣,騫惰鍏朵環鏍間負200<br /></font>聽聽book2.addElement("price").setText("200");<br />聽聽<br />聽<font color="#99cc00">聽//杈撳嚭xml<br /></font>聽聽System.out.println(document.asXML());<br />聽}</p> <p>璋冪敤BaseOperation錛岃緭鍑虹粨鏋滀負錛?/p> <p><?xml version="1.0" encoding="UTF-8"?><br /><root><br />聽<book type="science"><br />聽聽<Name>Java</Name><br />聽聽<price>100</price><br />聽</book><br />聽<book type="science"><br />聽聽<Name>Oracle</Name><br />聽聽<price>200</price><br />聽</book><br /></root></p> <p> <strong>錛堜簩錛夋牴鎹竴涓鍚圖ocument鏍煎紡鐨勫瓧絎︿覆鏉ョ敓鎴愪竴涓狣ocument</strong> </p> <p> <font color="#333399">聽/**灝嗗瓧絎︿覆杞寲涓篋ocument<br />聽 * @param str聽 杈撳叆鐨勫瓧絎︿覆<br />聽 * @return聽 鐢熸垚鐨刣ocument<br />聽 * @throws DocumentException<br />聽 */</font> <br />聽public Document parserStrtoDocument(String str) throws DocumentException{<br />聽聽Document document=DocumentHelper.parseText(str);<br />聽聽return document;<br />聽}</p> <p>璋冪敤紺轟緥錛?/p> <p>String str="<root><book type='science'><Name>Java</Name><price>100</price></book></root>";</p> <p>聽聽Document document = parserStrtoDocument(str);<br />聽聽System.out.println(document.asXML());</p> <p>杈撳嚭緇撴灉涓猴細</p> <p><?xml version="1.0" encoding="UTF-8"?><br /><root><br />聽<book type="science"><br />聽聽<Name>Java</Name><br />聽聽<price>100</price><br />聽</book><br /></root></p> <p> <strong>錛堜笁錛夊彇寰梮ml鑺傜偣灞炴х殑鍩烘湰鏂規硶</strong> </p> <p> <font color="#333399">聽/**<br />聽 * 鍙栧緱xml鐨勮妭鐐瑰拰灞炴х殑鍊?br />聽 * @throws DocumentException <br />聽 */</font> <br />聽public void getBaseInfofromDocument() throws DocumentException{<br />聽聽String str="<root><book type='science'><Name>Java</Name><price>100</price></book></root>";<br />聽<font color="#99cc00">聽//鐢熸垚涓涓狣ocument<br /></font>聽聽Document document = DocumentHelper.parseText(str);<br />聽聽<font color="#99cc00">//鍙栧緱鏍圭粨鐐?br /></font>聽聽Element root=document.getRootElement();<br />聽<font color="#99cc00">聽//鍙栧緱book鑺傜偣<br /></font>聽聽Element book=root.element("book");<br />聽聽<font color="#99cc00">//鍙栧緱book鑺傜偣鐨則ype灞炴х殑鍊?br /></font>聽聽String type=book.attributeValue("type");<br />聽聽<font color="#99cc00">//鍙栧緱Name鑺傜偣<br /></font>聽聽Element name=book.element("Name");<br />聽<font color="#99cc00">聽//鍙栧緱涔﹀悕<br /></font>聽聽String bookname=name.getText();<br />聽聽<font color="#99cc00">//鍙栧緱涔︾殑浠烽挶<br /></font>聽聽int price=Integer.parseInt(book.element("price").getText());<br />聽聽<br />聽<font color="#808000"><font color="#99cc00">聽//杈撳嚭涔︾洰淇℃伅</font><br /></font>聽聽System.out.println("涔﹀悕錛?+bookname);<br />聽聽System.out.println("鎵灞炵被鍒細"+type);<br />聽聽System.out.println("浠鋒牸錛?+price);<br />聽}</p> <p>璋冪敤getBaseInfofromDocument錛岃緭鍑虹粨鏋滀負錛?/p> <p>涔﹀悕錛欽ava<br />鎵灞炵被鍒細science<br />浠鋒牸錛?00</p> <p> <strong>錛堝洓錛夊埄鐢ㄨ凱浠o紝xpath鍙栧緱鑺傜偣鍙婂叾灞炴у?/strong> </p> <p> <font color="#333399">聽/**鍒╃敤榪唬錛寈path鍙栧緱xml鐨勮妭鐐瑰強鍏跺睘鎬у?br />聽 * @throws DocumentException<br />聽 */</font> <br />聽public void getComplexInfofromDocument() throws DocumentException{</p> <p> <br />聽聽String str="<root><book type='science'><Name>Java</Name><price>100</price></book>"<br />聽聽聽+"<book type='science'><Name>Oracle</Name><price>120</price></book>"<br />聽聽聽+"<book type='society'><Name>Society security</Name><price>130</price></book>"<br />聽聽聽+"<author><name>chb</name></author></root>";<br />聽<font color="#99cc00">聽//鐢熸垚涓涓狣ocument<br /></font>聽聽Document document = DocumentHelper.parseText(str);<br />聽聽<br />聽<font color="#99cc00">聽//鎻愬彇綾誨瀷涓?society"鐨勪功<br /></font><font color="#ff0000">聽聽//姝ゅ闇瑕佹坊鍔犳敮鎸亁path鐨刯ar鍖咃紝璇︾粏瑙佸娉?br /></font>聽聽Element society_book=(Element)document.selectSingleNode("/root/book[@type='society']");<br />聽聽System.out.println(society_book.asXML());<br />聽聽<br />聽聽<font color="#99cc00">//鎻愬彇浠鋒牸鑺傜偣鐨勫垪琛?br /></font>聽聽System.out.println("-----------浠鋒牸鍒楄〃-------------");<br />聽聽List price=document.selectNodes("http://price");<br />聽聽for(int i=0;i<price.size();i++){<br />聽聽聽Element elem_price=(Element)price.get(i);<br />聽聽聽System.out.println(elem_price.getText());<br />聽聽}<br />聽聽<br /><font color="#99cc00">聽聽//寰幆鏍圭粨鐐逛笅鐨勬墍鏈夎妭鐐癸紝鑻ュ綋鍓嶈妭鐐逛負book錛屽垯杈撳嚭榪欐湰涔︾殑璇︾粏淇℃伅<br /></font>聽聽System.out.println("-------------涔︾洰璇︽儏------------");<br />聽聽System.out.println("涔﹀悕\t\t綾誨埆\t\t浠鋒牸");<br />聽聽Element root=document.getRootElement();<br />聽聽Iterator iterator=root.elementIterator();<br />聽聽while(iterator.hasNext()){<br />聽聽聽Element element=(Element)iterator.next();<br />聽聽聽if(element.getName().equals("book")){<br />聽聽聽聽System.out.print(element.element("Name").getText()+"\t");<br />聽聽聽聽System.out.print(element.attributeValue("type")+"\t\t");<br />聽聽聽聽System.out.print(element.element("price").getText()+"\n");<br />聽聽聽}<br />聽聽}</p> <p>聽聽<font color="#99cc00">//鏌ユ壘浣滆呭鍚?br /></font>聽聽Element author=(Element)document.selectSingleNode("http://author");<br />聽聽System.out.println("---------"+author.element("name").getText()+"----------");<br />聽聽<font color="#99cc00">//鎻愬彇浣滆呯殑鎵鏈変功鐩悕縐?br /></font>聽聽Iterator iterator_book=root.elementIterator("book");聽聽<br />聽聽while(iterator_book.hasNext()){<br />聽聽聽Element book=(Element)iterator_book.next();<br />聽聽聽System.out.print(book.element("Name").getText()+"\t");<br />聽聽}<br />聽聽<br />聽<font color="#99cc00">聽//灞炴ц凱浠?br /></font>聽聽System.out.println("\n-------灞炴ц凱浠?-------");<br />聽聽String str1="<book type='science' name='Java' price='100'/>";<br />聽聽Document document1=DocumentHelper.parseText(str1);<br />聽<font color="#99cc00">聽//寮濮嬭凱浠?br /></font>聽聽Iterator iterator_attribute=document1.getRootElement().attributeIterator();<br />聽聽while(iterator_attribute.hasNext()){<br />聽<font color="#99cc00">聽聽//鎻愬彇褰撳墠灞炴?br /></font>聽聽聽Attribute attribute=(Attribute)iterator_attribute.next();<br />聽聽聽System.out.println(attribute.getName()+":"+attribute.getValue());<br />聽聽}<br />聽}</p> <p>璋冪敤getComplexInfofromDocument錛岃緭鍑虹粨鏋滀負錛?/p> <p><book type="society"><Name>Society security</Name><price>130</price></book><br />-----------浠鋒牸鍒楄〃-------------<br />100<br />120<br />130<br />-------------涔︾洰璇︽儏------------<br />涔﹀悕聽聽綾誨埆聽聽浠鋒牸<br />Java聽science聽聽100<br />Oracle聽science聽聽120<br />Society security聽society聽聽130<br />---------chb----------<br />Java聽Oracle聽Society security聽<br />-------灞炴ц凱浠?-------<br />type:science<br />name:Java<br />price:100</p> <p> <font color="#ff0000"> <strong>澶囨敞錛氳皟鐢ㄨ鏂規硶涔嬪墠錛屽簲璇ュ厛鍚戝伐紼嬩腑娣誨姞鏀寔xpath鐨刯ar鍖咃紝鍚﹀垯錛屼細鍑虹幇浠ヤ笅閿欒錛?/strong> </font> </p> <p> <font color="#ff0000">java.lang.NoClassDefFoundError: org/jaxen/JaxenException<br /></font>聽at org.dom4j.DocumentFactory.createXPath(DocumentFactory.java:230)<br />聽at org.dom4j.tree.AbstractNode.createXPath(AbstractNode.java:207)<br />聽at org.dom4j.tree.AbstractNode.selectSingleNode(AbstractNode.java:183)<br />聽at xml_chb.dom4j_chb.getComplexInfofromDocument(dom4j_chb.java:82)<br />聽at xml_chb.dom4j_chb.main(dom4j_chb.java:92)<br />Exception in thread "main" </p> <p>鍙渶瑕佸紩鍏axen鍖呭氨琛屼簡錛屾垜浣跨敤鐨勬槸hibernate鍖呬腑鐨刯axen-1.1-beta-7.jar鍖呫?/p> <img src ="http://www.tkk7.com/hbcui1984/aggbug/71512.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/hbcui1984/" target="_blank">鎵窞姊?/a> 2006-09-24 02:10 <a href="http://www.tkk7.com/hbcui1984/articles/71512.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>浣跨敤Hashtable瀵瑰瓧絎︿覆榪涜紕版挒http://www.tkk7.com/hbcui1984/articles/71147.html鎵窞姊?/dc:creator>鎵窞姊?/author>Thu, 21 Sep 2006 08:25:00 GMThttp://www.tkk7.com/hbcui1984/articles/71147.htmlhttp://www.tkk7.com/hbcui1984/comments/71147.htmlhttp://www.tkk7.com/hbcui1984/articles/71147.html#Feedback0http://www.tkk7.com/hbcui1984/comments/commentRss/71147.htmlhttp://www.tkk7.com/hbcui1984/services/trackbacks/71147.htmlpublic String[] checkArray(String[] str){
聽聽聽 聽聽聽 Hashtable<String, String> hash=new Hashtable<String, String>();
聽聽聽 聽聽聽 for(int i=0;i<str.length;i++){
聽聽聽 聽聽聽 聽聽聽 if(!hash.containsKey(str[i]))
聽聽聽 聽聽聽 聽聽聽 聽聽聽 hash.put(str[i], str[i]);
聽聽聽 聽聽聽 }
聽聽聽 聽聽聽 Enumeration enumeration=hash.keys();
聽聽聽 聽聽聽 String[] str_new=new String[hash.size()];
聽聽聽 聽聽聽 int i=0;
聽聽聽 聽聽聽 while(enumeration.hasMoreElements()){
聽聽聽 聽聽聽 聽聽聽 str_new[i]=enumeration.nextElement().toString();
聽聽聽 聽聽聽 聽聽聽 i++;
聽聽聽 聽聽聽 }
聽聽聽 聽聽聽 return str_new;
聽聽聽 }
紺轟緥錛?br />聽聽聽 聽聽聽 String[] mobile={"13811071500","13811071500","13811071501","13811071503","13811071501"};
聽聽聽 聽聽聽 mobile=checkArray(mobile);
聽聽聽 聽聽聽 for(int i=0;i<mobile.length;i++)
聽聽聽 聽聽聽 聽聽聽 System.out.println(mobile[i]);
聽聽聽 聽聽 杈撳嚭緇撴灉涓猴細
聽聽聽 聽聽聽 13811071503
聽聽聽 聽聽聽 13811071501
聽聽聽 聽聽聽 13811071500
2.A,B鍧囦負瀛楃涓叉暟緇勶紝鎵懼嚭鍦ˋ涓瓨鍦紝鑰屽湪B涓笉瀛樺湪鐨勫瓧絎︿覆
聽聽聽 public String[] compareArray(String[] A,String[] B){
聽聽聽 聽聽聽 Hashtable<String, String> hash=new Hashtable<String, String>();
聽聽聽 聽聽聽 Hashtable<String, String> hash_new=new Hashtable<String, String>();
聽聽聽 聽聽聽 for(int i=0;i<B.length;i++)
聽聽聽 聽聽聽 聽聽聽 hash.put(B[i], B[i]);
聽聽聽 聽聽聽 for(int i=0;i<A.length;i++){
聽聽聽 聽聽聽 聽聽聽 if(!hash.containsKey(A[i]))
聽聽聽 聽聽聽 聽聽聽 聽聽聽 hash_new.put(A[i], A[i]);
聽聽聽 聽聽聽 }
聽聽聽 聽聽聽 String[] C=new String[hash_new.size()];
聽聽聽 聽聽聽 int i=0;
聽聽聽 聽聽聽 Enumeration enumeration=hash_new.keys();
聽聽聽 聽聽聽 while(enumeration.hasMoreElements()){
聽聽聽 聽聽聽 聽聽聽 C[i]=enumeration.nextElement().toString();
聽聽聽 聽聽聽 聽聽聽 i++;
聽聽聽 聽聽聽 }
聽聽聽 聽聽聽 return C;
聽聽聽 }
紺轟緥錛?br />聽聽聽 聽聽聽 String[] mobile1={"13811071500","13811071501","13811071502","13811071503","13811071504"};
聽聽聽 聽聽聽 String[] mobile2={"13811071500","13811071505","13811071502","13811071506","13811071504"};
聽聽聽 聽聽聽 String[] mobile3=compareArray(mobile1,mobile2);
聽聽聽 聽聽聽 for(int i=0;i<mobile3.length;i++)
聽聽聽 聽聽聽 聽聽聽 System.out.println(mobile[i]);
杈撳嚭緇撴灉錛?br />聽聽聽 13811071503
聽聽聽 13811071501
瀛樺湪鐨勯棶棰橈細
姣忔閮芥槸鍊掑簭錛屽彲浠ュ啀瀵圭▼搴忕◢鍔犳敼鍔紝鍙樻垚姝e簭銆?/font>


]]>
鏍煎紡鍖栬緭鍑烘暟瀛?/title><link>http://www.tkk7.com/hbcui1984/articles/70628.html</link><dc:creator>鎵窞姊?/dc:creator><author>鎵窞姊?/author><pubDate>Tue, 19 Sep 2006 14:29:00 GMT</pubDate><guid>http://www.tkk7.com/hbcui1984/articles/70628.html</guid><wfw:comment>http://www.tkk7.com/hbcui1984/comments/70628.html</wfw:comment><comments>http://www.tkk7.com/hbcui1984/articles/70628.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.tkk7.com/hbcui1984/comments/commentRss/70628.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/hbcui1984/services/trackbacks/70628.html</trackback:ping><description><![CDATA[ <p>鍦ㄥ疄闄呭伐浣滀腑錛屽父甯擱渶瑕佽瀹氭暟瀛楃殑杈撳嚭鏍煎紡錛屽浠ョ櫨鍒嗘瘮鐨勫艦寮忚緭鍑猴紝鎴栬呰瀹氬皬鏁頒綅鏁扮瓑錛屽厛紼嶅井鎬葷粨濡備笅銆?br />涓昏浣跨敤鐨勭被錛歫ava.text.DecimalFormat<br />1銆傚疄渚嬪寲瀵硅薄錛屽彲浠ョ敤濡備笅涓ょ鏂規硶錛?br />DecimalFormat df=(DecimalFormat)NumberFormat.getInstance();<br />DecimalFormat df1=(DecimalFormat) DecimalFormat.getInstance();<br />鍥犱負DecimalFormat緇ф壙鑷狽umberFormat銆?br />2銆傝瀹氬皬鏁頒綅鏁?br />緋葷粺榛樿灝忔暟浣嶆暟涓?錛屽錛?br />聽聽DecimalFormat df=(DecimalFormat)NumberFormat.getInstance();<br />聽聽System.out.println(df.format(12.3456789));<br />杈撳嚭錛?2.346<br />鐜板湪鍙互閫氳繃濡備笅鏂規硶鎶婂皬鏁頒負璁句負涓や綅錛?br />聽 <font color="#ff0000">df.setMaximumFractionDigits(2);<br /></font>聽聽System.out.println(df.format(12.3456789));<br />鍒欒緭鍑轟負錛?2.35<br />3銆傚皢鏁板瓧杞寲涓虹櫨鍒嗘瘮杈撳嚭錛屾湁濡備笅涓ょ鏂規硶錛?br />(1) <br />聽 <font color="#ff0000">df.applyPattern("##.##%");<br /></font>聽聽System.out.println(df.format(12.3456789));<br />聽聽System.out.println(df.format(1));<br />聽聽System.out.println(df.format(0.015));<br />杈撳嚭鍒嗗埆涓猴細1234.57%聽 100%聽聽聽 1.5%<br />(2)<br />聽 df.setMaximumFractionDigits(2);<br />聽聽System.out.println(df.format(12.3456789*100)+"%");<br />聽聽System.out.println(df.format(1*100)+"%");<br />聽聽System.out.println(df.format(0.015*100)+"%");<br />杈撳嚭鍒嗗埆涓猴細<br />1,234.57%聽聽 100%聽聽 1.5%<br />4銆傝緗垎緇勫ぇ灝?br />聽聽 DecimalFormat df1=(DecimalFormat) DecimalFormat.getInstance();<br />聽<font color="#ff0000">聽df1.setGroupingSize(2);<br /></font>聽聽System.out.println(df1.format(123456789));<br />杈撳嚭錛?,23,45,67,89<br />榪樺彲浠ラ氳繃df1.setGroupingUsed(false);鏉ョ鐢ㄥ垎緇勮緗紝濡傦細<br />聽聽 DecimalFormat df1=(DecimalFormat) DecimalFormat.getInstance();<br />聽聽df1.setGroupingSize(2);<br />聽<font color="#ff0000">聽df1.setGroupingUsed(false);<br /></font>聽聽System.out.println(df1.format(123456789));<br />杈撳嚭錛?23456789<br />5銆傝緗皬鏁頒負蹇呴』涓?浣?br />聽 DecimalFormat df2=(DecimalFormat) DecimalFormat.getInstance();<br />聽聽<font color="#ff0000">df2.applyPattern("0.00");<br /></font>聽聽System.out.println(df2.format(1.2));<br />杈撳嚭錛?.20</p> <img src ="http://www.tkk7.com/hbcui1984/aggbug/70628.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/hbcui1984/" target="_blank">鎵窞姊?/a> 2006-09-19 22:29 <a href="http://www.tkk7.com/hbcui1984/articles/70628.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>java涓叧浜庢椂闂存棩鏈熸搷浣滅殑甯哥敤鍑芥暟http://www.tkk7.com/hbcui1984/articles/70269.html鎵窞姊?/dc:creator>鎵窞姊?/author>Mon, 18 Sep 2006 05:40:00 GMThttp://www.tkk7.com/hbcui1984/articles/70269.htmlhttp://www.tkk7.com/hbcui1984/comments/70269.htmlhttp://www.tkk7.com/hbcui1984/articles/70269.html#Feedback0http://www.tkk7.com/hbcui1984/comments/commentRss/70269.htmlhttp://www.tkk7.com/hbcui1984/services/trackbacks/70269.htmlCalendar time=Calendar.getInstance();
time.clear();
time.set(Calendar.YEAR,year);
time.set(Calendar.MONTH,i-1);//娉ㄦ剰,Calendar瀵硅薄榛樿涓鏈堜負0聽聽 聽聽聽 聽聽聽 聽
int day=time.getActualMaximum(Calendar.DAY_OF_MONTH);//鏈湀浠界殑澶╂暟
2.Calendar鍜孌ate鐨勮漿鍖?br />(1) Calendar杞寲涓篋ate
Calendar cal=Calendar.getInstance();
Date date=cal.getTime();
(2) Date杞寲涓篊alendar
Date date=new Date();
Calendar cal=Calendar.getInstance();
cal.setTime(date);
3.鏍煎紡鍖栬緭鍑烘棩鏈熸椂闂?br />Date date=new Date();
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
System.out.println(df.format(date));
4.璁$畻涓騫翠腑鐨勭鍑犳槦鏈?br />(1)璁$畻鏌愪竴澶╂槸涓騫翠腑鐨勭鍑犳槦鏈?br />Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.MONTH, 8);
cal.set(Calendar.DAY_OF_MONTH, 3);
int weekno=cal.get(Calendar.WEEK_OF_YEAR);
(2)璁$畻涓騫翠腑鐨勭鍑犳槦鏈熸槸鍑犲彿
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.WEEK_OF_YEAR, 1);
cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
System.out.println(df.format(cal.getTime()));
杈撳嚭:
2006-01-02
5.add()鍜宺oll()鐨勭敤娉?br />(1)add()鏂規硶
SimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd");
Calendar cal=Calendar.getInstance();
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.MONTH, 8);
cal.set(Calendar.DAY_OF_MONTH, 3);
cal.add(Calendar.DATE, -4);
Date date=cal.getTime();
System.out.println(df.format(date));
cal.add(Calendar.DATE, 4);
date=cal.getTime();
System.out.println(df.format(date));
杈撳嚭錛?br />聽聽聽 2006-08-30
聽聽聽 2006-09-03
(2)roll鏂規硶
cal.set(Calendar.YEAR, 2006);
cal.set(Calendar.MONTH, 8);
cal.set(Calendar.DAY_OF_MONTH, 3);
cal.roll(Calendar.DATE, -4);
date=cal.getTime();
System.out.println(df.format(date));
cal.roll(Calendar.DATE, 4);
date=cal.getTime();
System.out.println(df.format(date));
杈撳嚭錛?br />聽聽聽 2006-09-29
聽聽聽 2006-09-03
鍙錛?font color="#ff3300">roll()鏂規硶鍦ㄦ湰鏈堝唴寰幆錛屼竴鑸嬌鐢╝dd()鏂規硶錛?/font>

]]>
主站蜘蛛池模板: 久久久久久久久免费看无码| 69视频在线观看高清免费| 成年人性生活免费视频| 亚洲美女视频免费| 免费福利在线播放| 亚洲av成人一区二区三区| 成年女人免费视频播放77777| 亚洲国产系列一区二区三区 | a毛片视频免费观看影院| 最新国产AV无码专区亚洲| 一级成人a做片免费| 在线亚洲精品自拍| 另类免费视频一区二区在线观看 | 一个人看www免费高清字幕| 久久久久亚洲AV无码专区网站| 一级做受视频免费是看美女| 国产亚洲精品免费视频播放| 成全动漫视频在线观看免费高清版下载| 亚洲VA中文字幕无码毛片| 中文字幕天天躁日日躁狠狠躁免费| 亚洲另类古典武侠| 国产成人aaa在线视频免费观看| 黄色毛片免费观看| 国产亚洲色婷婷久久99精品| 曰批视频免费40分钟试看天天| 亚洲AV无码一区二区三区在线| 成人爱做日本视频免费| 久久99精品免费一区二区| 亚洲日本视频在线观看| 日本免费中文字幕在线看| a级毛片毛片免费观看永久| 亚洲福利电影一区二区?| 好爽好紧好大的免费视频国产| 国产黄在线观看免费观看不卡| 亚洲视频在线观看免费| 毛片a级三毛片免费播放| 一区二区三区在线观看免费| 亚洲黄色在线电影| 亚洲日本韩国在线| 日本视频一区在线观看免费| 日本中文字幕免费看|