﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-风人园-文章分类-XML</title><link>http://www.blogjava.net/wuxufeng8080/category/13148.html</link><description /><language>zh-cn</language><lastBuildDate>Thu, 01 Mar 2007 01:27:05 GMT</lastBuildDate><pubDate>Thu, 01 Mar 2007 01:27:05 GMT</pubDate><ttl>60</ttl><item><title>dom4j </title><link>http://www.blogjava.net/wuxufeng8080/articles/72218.html</link><dc:creator>风人园</dc:creator><author>风人园</author><pubDate>Wed, 27 Sep 2006 02:35:00 GMT</pubDate><guid>http://www.blogjava.net/wuxufeng8080/articles/72218.html</guid><description><![CDATA[
		<blockquote>dom4j 是一种解析 XML 文档的开放源代码 XML 框架。本文介绍如何使用包含在 dom4j 中的解析器创建并修改 XML 文档。</blockquote>
		<!--START RESERVED FOR FUTURE USE INCLUDE FILES-->
		<!-- include java script once we verify teams wants to use this and it will work on dbcs and cyrillic characters -->
		<!--END RESERVED FOR FUTURE USE INCLUDE FILES-->
		<p>dom4j API 包含一个解析 XML 文档的工具。本文中将使用这个解析器创建一个示例 XML 文档。清单 1 显示了这个示例 XML 文档，catalog.xml。</p>
		<a name="code1">
				<b>清单 1. 示例 XML 文档（catalog.xml）</b>
		</a>
		<br />
		<table cellspacing="0" cellpadding="5" width="80%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
&lt;catalog&gt; 
&lt;!--An XML Catalog--&gt; 
&lt;?target instruction?&gt;
  &lt;journal title="XML Zone" 
                  publisher="IBM developerWorks"&gt; 

&lt;article level="Intermediate" date="December-2001"&gt;
 &lt;title&gt;Java configuration with XML Schema&lt;/title&gt; 
 &lt;author&gt; 
     &lt;firstname&gt;Marcello&lt;/firstname&gt; 
     &lt;lastname&gt;Vitaletti&lt;/lastname&gt; 
 &lt;/author&gt;
  &lt;/article&gt;
  &lt;/journal&gt; 
&lt;/catalog&gt;
</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>然后使用同一个解析器修改 catalog.xml，清单 2 是修改后的 XML 文档，catalog-modified.xml。</p>
		<a name="code2">
				<b>清单 2. 修改后的 XML 文档（catalog-modified.xml）</b>
		</a>
		<br />
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">&lt;?xml version="1.0" encoding="UTF-8"?&gt; 
&lt;catalog&gt; 
&lt;!--An XML catalog--&gt; 
&lt;?target instruction?&gt;
  &lt;journal title="XML Zone"
                   publisher="IBM developerWorks"&gt; 

&lt;article level="Introductory" date="October-2002"&gt;
 &lt;title&gt;Create flexible and extensible XML schemas&lt;/title&gt; 
 &lt;author&gt; 
     &lt;firstname&gt;Ayesha&lt;/firstname&gt; 
     &lt;lastname&gt;Malik&lt;/lastname&gt; 
 &lt;/author&gt; 
  &lt;/article&gt;
  &lt;/journal&gt; 
&lt;/catalog&gt;
</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>与 W3C DOM API 相比，使用 dom4j 所包含的解析器的好处是 dom4j 拥有本地的 XPath 支持。DOM 解析器不支持使用 XPath 选择节点。</p>
		<p>本文包括以下几个部分：</p>
		<ul>
				<li>预先设置 
</li>
				<li>创建文档 
</li>
				<li>修改文档 </li>
		</ul>
		<p>
				<a name="h1">
						<span class="atitle">
								<font face="Arial" size="4">预先设置</font>
						</span>
				</a>
		</p>
		<p>这个解析器可以从 <a href="http://dom4j.org/" target="_new"><font color="#5c81a7">http://dom4j.org</font></a> 获取。通过设置使 <code>dom4j-1.4/dom4j-full.jar</code> 能够在 classpath 中访问，该文件中包括 dom4j 类、XPath 引擎以及 SAX 和 DOM 接口。如果已经使用了 JAXP 解析器中包含的 SAX 和 DOM 接口，向 classpath 中增加 <code>dom4j-1.4/dom4j.jar</code> 。 <code>dom4j.jar </code>包括 dom4j 类和 XPath 引擎，但是不含 SAX 与 DOM 接口。 </p>
		<br />
		<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tbody>
						<tr>
								<td>
										<img height="1" alt="" src="http://www.ibm.com/i/v14/rules/blue_rule.gif" width="100%" />
										<br />
										<img height="6" alt="" src="http://www.ibm.com/i/c.gif" width="8" border="0" />
								</td>
						</tr>
				</tbody>
		</table>
		<table class="no-print" cellspacing="0" cellpadding="0" align="right">
				<tbody>
						<tr align="right">
								<td>
										<img height="4" alt="" src="http://www.ibm.com/i/c.gif" width="100%" />
										<br />
										<table cellspacing="0" cellpadding="0" border="0">
												<tbody>
														<tr>
																<td valign="center">
																		<img height="16" alt="" src="http://www.ibm.com/i/v14/icons/u_bold.gif" width="16" border="0" />
																		<br />
																</td>
																<td valign="top" align="right">
																		<a class="fbox" href="http://www-128.ibm.com/developerworks/cn/xml/x-dom4j.html#main">
																				<b>
																						<font color="#996699">回页首</font>
																				</b>
																		</a>
																</td>
														</tr>
												</tbody>
										</table>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<br />
		<p>
				<a name="h2">
						<span class="atitle">
								<font face="Arial" size="4">创建文档</font>
						</span>
				</a>
		</p>
		<p>本节讨论使用 dom4j API 创建 XML 文档的过程，并创建示例 XML 文档 catalog.xml。</p>
		<p>使用 import 语句导入 dom4j API 类：</p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>使用 <code>DocumentHelper</code> 类创建一个文档实例。 <code>DocumentHelper</code> 是生成 XML 文档节点的 dom4j API 工厂类。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console"> Document document = DocumentHelper.createDocument();</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>使用 <code>addElement()</code> 方法创建根元素 <code>catalog</code> 。 <code>addElement()</code> 用于向 XML 文档中增加元素。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">Element catalogElement = document.addElement("catalog");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>在 <code>catalog</code> 元素中使用 <code>addComment()</code> 方法添加注释“An XML catalog”。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console"> catalogElement.addComment("An XML catalog");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>在 <code>catalog</code> 元素中使用 <code>addProcessingInstruction()</code> 方法增加一个处理指令。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">catalogElement.addProcessingInstruction("target","text");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>在 <code>catalog</code> 元素中使用 <code>addElement()</code> 方法增加 <code>journal</code> 元素。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">Element journalElement =  catalogElement.addElement("journal");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>使用 <code>addAttribute()</code> 方法向 <code>journal</code> 元素添加 <code>title</code> 和 <code>publisher</code> 属性。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">journalElement.addAttribute("title", "XML Zone");
         journalElement.addAttribute("publisher", "IBM developerWorks");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>向 <code>article</code> 元素中添加 <code>journal</code> 元素。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">Element articleElement=journalElement.addElement("article");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>为 <code>article</code> 元素增加 <code>level</code> 和 <code>date</code> 属性。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">articleElement.addAttribute("level", "Intermediate");
      articleElement.addAttribute("date", "December-2001");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>向 <code>article</code> 元素中增加 <code>title</code> 元素。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">Element titleElement=articleElement.addElement("title");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>使用 <code>setText()</code> 方法设置 <code>article</code> 元素的文本。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">titleElement.setText("Java configuration with XML Schema");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>在 <code>article</code> 元素中增加 <code>author</code> 元素。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">Element authorElement=articleElement.addElement("author");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>在 <code>author</code> 元素中增加 <code>firstname</code> 元素并设置该元素的文本。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">Element  firstNameElement=authorElement.addElement("firstname");
     firstNameElement.setText("Marcello");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>在 <code>author</code> 元素中增加 <code>lastname</code> 元素并设置该元素的文本。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">Element lastNameElement=authorElement.addElement("lastname");
     lastNameElement.setText("Vitaletti");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>可以使用 <code>addDocType() </code>方法添加文档类型说明。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">document.addDocType("catalog", null,"file://c:/Dtds/catalog.dtd");</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>这样就向 XML 文档中增加文档类型说明：</p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">&lt;!DOCTYPE catalog SYSTEM "file://c:/Dtds/catalog.dtd"&gt;</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>如果文档要使用文档类型定义（DTD）文档验证则必须有 Doctype。</p>
		<p>XML 声明 <code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;</code> 自动添加到 XML 文档中。 </p>
		<p>清单 3 所示的例子程序 XmlDom4J.java 用于创建 XML 文档 catalog.xml。</p>
		<a name="code3">
				<b>清单 3. 生成 XML 文档 catalog.xml 的程序（XmlDom4J.java）</b>
		</a>
		<br />
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.XMLWriter;
import java.io.*;



public class XmlDom4J{


public void generateDocument(){
Document document = DocumentHelper.createDocument();
     Element catalogElement = document.addElement("catalog");
     catalogElement.addComment("An XML Catalog");
     catalogElement.addProcessingInstruction("target","text");
     Element journalElement =  catalogElement.addElement("journal");
     journalElement.addAttribute("title", "XML Zone");
     journalElement.addAttribute("publisher", "IBM developerWorks");


     Element articleElement=journalElement.addElement("article");
     articleElement.addAttribute("level", "Intermediate");
     articleElement.addAttribute("date", "December-2001");
     Element  titleElement=articleElement.addElement("title");
     titleElement.setText("Java configuration with XML Schema");
     Element authorElement=articleElement.addElement("author");
     Element  firstNameElement=authorElement.addElement("firstname");
     firstNameElement.setText("Marcello");
     Element lastNameElement=authorElement.addElement("lastname");
     lastNameElement.setText("Vitaletti");

     document.addDocType("catalog",
                           null,"file://c:/Dtds/catalog.dtd");
    try{
    XMLWriter output = new XMLWriter(
            new FileWriter( new File("c:/catalog/catalog.xml") ));
        output.write( document );
        output.close();
        }
     catch(IOException e){System.out.println(e.getMessage());}
}

public static void main(String[] argv){
XmlDom4J dom4j=new XmlDom4J();
dom4j.generateDocument();
}}
</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>这一节讨论了创建 XML 文档的过程，下一节将介绍使用 dom4j API 修改这里创建的 XML 文档。 </p>
		<br />
		<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tbody>
						<tr>
								<td>
										<img height="1" alt="" src="http://www.ibm.com/i/v14/rules/blue_rule.gif" width="100%" />
										<br />
										<img height="6" alt="" src="http://www.ibm.com/i/c.gif" width="8" border="0" />
								</td>
						</tr>
				</tbody>
		</table>
		<table class="no-print" cellspacing="0" cellpadding="0" align="right">
				<tbody>
						<tr align="right">
								<td>
										<img height="4" alt="" src="http://www.ibm.com/i/c.gif" width="100%" />
										<br />
										<table cellspacing="0" cellpadding="0" border="0">
												<tbody>
														<tr>
																<td valign="center">
																		<img height="16" alt="" src="http://www.ibm.com/i/v14/icons/u_bold.gif" width="16" border="0" />
																		<br />
																</td>
																<td valign="top" align="right">
																		<a class="fbox" href="http://www-128.ibm.com/developerworks/cn/xml/x-dom4j.html#main">
																				<b>
																						<font color="#996699">回页首</font>
																				</b>
																		</a>
																</td>
														</tr>
												</tbody>
										</table>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<br />
		<p>
				<a name="h3">
						<span class="atitle">
								<font face="Arial" size="4">修改文档</font>
						</span>
				</a>
		</p>
		<p>这一节说明如何使用 dom4j API 修改示例 XML 文档 catalog.xml。</p>
		<p>使用 SAXReader 解析 XML 文档 catalog.xml：</p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">SAXReader saxReader = new SAXReader();
 Document document = saxReader.read(inputXml);</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>
				<code>SAXReader</code> 包含在 org.dom4j.io 包中。 </p>
		<p>
				<code>inputXml</code> 是从 c:/catalog/catalog.xml 创建的 java.io.File。使用 XPath 表达式从 <code>article</code> 元素中获得 <code>level</code> 节点列表。如果 <code>level</code> 属性值是“Intermediate”则改为“Introductory”。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">List list = document.selectNodes("//article/@level" );
      Iterator iter=list.iterator();
        while(iter.hasNext()){
            Attribute attribute=(Attribute)iter.next();
               if(attribute.getValue().equals("Intermediate"))
               attribute.setValue("Introductory"); 
       }</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>获取 <code>article</code> 元素列表，从 <code>article</code> 元素中的 <code>title</code> 元素得到一个迭代器，并修改 <code>title</code> 元素的文本。 </p>
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">list = document.selectNodes("//article" );
     iter=list.iterator();
   while(iter.hasNext()){
       Element element=(Element)iter.next();
      Iterator iterator=element.elementIterator("title");
   while(iterator.hasNext()){
   Element titleElement=(Element)iterator.next();
   if(titleElement.getText().equals("Java configuration with XML Schema"))
     titleElement.setText("Create flexible and extensible XML schema");

    }}</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>通过和 <code>title</code> 元素类似的过程修改 <code>author</code> 元素。 </p>
		<p>清单 4 所示的示例程序 Dom4JParser.java 用于把 catalog.xml 文档修改成 catalog-modified.xml 文档。</p>
		<a name="code4">
				<b>清单 4. 用于修改 catalog.xml 的程序（Dom4Jparser.java）</b>
		</a>
		<br />
		<table cellspacing="0" cellpadding="5" width="100%" bgcolor="#eeeeee" border="1">
				<tbody>
						<tr>
								<td>
										<pre>
												<code class="section">
														<font face="Lucida Console">import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.Attribute;
import java.util.List;
import java.util.Iterator;
import org.dom4j.io.XMLWriter;
import java.io.*;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader; 

public class Dom4JParser{

 public void modifyDocument(File inputXml){

  try{
   SAXReader saxReader = new SAXReader();
   Document document = saxReader.read(inputXml);

   List list = document.selectNodes("//article/@level" );
   Iterator iter=list.iterator();
   while(iter.hasNext()){
    Attribute attribute=(Attribute)iter.next();
    if(attribute.getValue().equals("Intermediate"))
      attribute.setValue("Introductory"); 

       }
   
   list = document.selectNodes("//article/@date" );
   iter=list.iterator();
   while(iter.hasNext()){
    Attribute attribute=(Attribute)iter.next();
    if(attribute.getValue().equals("December-2001"))
      attribute.setValue("October-2002");

       }

   list = document.selectNodes("//article" );
   iter=list.iterator();
   while(iter.hasNext()){
    Element element=(Element)iter.next();
    Iterator iterator=element.elementIterator("title");
      while(iterator.hasNext()){
        Element titleElement=(Element)iterator.next();
        if(titleElement.getText().equals("Java configuration with XML

      Schema"))
        titleElement.setText("Create flexible and extensible XML schema");

                                          }

                                }

    list = document.selectNodes("//article/author" );
    iter=list.iterator();
     while(iter.hasNext()){
     Element element=(Element)iter.next();
     Iterator iterator=element.elementIterator("firstname");
     while(iterator.hasNext()){
      Element firstNameElement=(Element)iterator.next();
      if(firstNameElement.getText().equals("Marcello"))
      firstNameElement.setText("Ayesha");
                                     }

                              }

    list = document.selectNodes("//article/author" );
    iter=list.iterator();
     while(iter.hasNext()){
      Element element=(Element)iter.next();
      Iterator iterator=element.elementIterator("lastname");
     while(iterator.hasNext()){
      Element lastNameElement=(Element)iterator.next();
      if(lastNameElement.getText().equals("Vitaletti"))
      lastNameElement.setText("Malik");

                                  }

                               }
     XMLWriter output = new XMLWriter(
      new FileWriter( new File("c:/catalog/catalog-modified.xml") ));
     output.write( document );
     output.close();
   }
 
  catch(DocumentException e)
                 {
                  System.out.println(e.getMessage());
                            }

  catch(IOException e){
                       System.out.println(e.getMessage());
                    }
 }

 public static void main(String[] argv){

  Dom4JParser dom4jParser=new Dom4JParser();
  dom4jParser.modifyDocument(new File("c:/catalog/catalog.xml"));

                                        }

   }
</font>
												</code>
										</pre>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<p>这一节说明了如何使用 dom4j 中的解析器修改示例 XML 文档。这个解析器不使用 DTD 或者模式验证 XML 文档。如果 XML 文档需要验证，可以解释用 dom4j 与 JAXP SAX 解析器。</p>
		<br />
		<table cellspacing="0" cellpadding="0" width="100%" border="0">
				<tbody>
						<tr>
								<td>
										<img height="1" alt="" src="http://www.ibm.com/i/v14/rules/blue_rule.gif" width="100%" />
										<br />
										<img height="6" alt="" src="http://www.ibm.com/i/c.gif" width="8" border="0" />
								</td>
						</tr>
				</tbody>
		</table>
		<table class="no-print" cellspacing="0" cellpadding="0" align="right">
				<tbody>
						<tr align="right">
								<td>
										<img height="4" alt="" src="http://www.ibm.com/i/c.gif" width="100%" />
										<br />
										<table cellspacing="0" cellpadding="0" border="0">
												<tbody>
														<tr>
																<td valign="center">
																		<img height="16" alt="" src="http://www.ibm.com/i/v14/icons/u_bold.gif" width="16" border="0" />
																		<br />
																</td>
																<td valign="top" align="right">
																		<a class="fbox" href="http://www-128.ibm.com/developerworks/cn/xml/x-dom4j.html#main">
																				<b>
																						<font color="#996699">回页首</font>
																				</b>
																		</a>
																</td>
														</tr>
												</tbody>
										</table>
								</td>
						</tr>
				</tbody>
		</table>
		<br />
		<br />
		<p>
				<a name="h4">
						<span class="atitle">
								<font face="Arial" size="4">结束语</font>
						</span>
				</a>
		</p>
		<p>包含在 dom4j 中的解析器是一种用于解析 XML 文档的非验证性工具，可以与JAXP、Crimson 或 Xerces 集成。本文说明了如何使用该解析器创建和修改 XML 文档。 </p>
		<br />
<img src ="http://www.blogjava.net/wuxufeng8080/aggbug/72218.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/wuxufeng8080/" target="_blank">风人园</a> 2006-09-27 10:35 <a href="http://www.blogjava.net/wuxufeng8080/articles/72218.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>