⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lib0072.html

📁 j2ee架构师手册
💻 HTML
字号:
<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Chapter 11: Building XML Access Objects</title>
<link rel="STYLESHEET" type="text/css" href="images/xpolecat.css">
<link rel="STYLESHEET" type="text/css" href="images/ie.content.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle"  alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0071.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0073.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
<br>
<div class="chapter">
<a name="ch11"></a>
<h1 class="chapter-title"><span class="chapter-titlelabel">Chapter 11: </span>Building XML Access Objects</h1><div class="section">
<h2 class="sect2-title">
<a name="339"></a>Overview</h2>
<a name="340"></a><a name="IDX-139"></a>
<p class="para">Data access objects are classes that read and write persistent data. XML manipulation, because it's really a data access operation, is part of the DAO layer. An XML access object (XAO) reads and writes data in an XML format and converts that format to value objects that other layers in the application can use. For example, <span class="fixed">PurchaseOrderXAO</span> is an XAO for a purchasing application that reads and transmits orders in an XML format. <span class="fixed">PurchaseOrderXAO</span> contains the following methods:</p>
<div class="informalexample">
<pre class="literallayout">
public void setPurchaseOrder(String xmlText);
public void setPurchaseOrder(PurchaseOrderVO[] order);
public void setPurchaseOrder(InputStream order);

public String        getPurchaseOrderXmlText();
public PurchaseOrderVO[]  getPurchaseOrder();

public void transmit(EDIDestination dest);
public void save(OutputStream os);
</pre>
</div>
<p class="para">Business objects use XAOs to interpret and produce XML data, as illustrated in <a class="internaljump" href="#ch11fig01">figure 11.1</a>. Typically, XAOs should have little to do with implementing the business rules associated with processing the data. XML-related code is separated to limit and localize the impact that changes in the XML structure have on your application. If this logic were scattered in various <a name="341"></a><a name="IDX-140"></a>places in the business logic layer, for example, it would be much harder to find and change.</p>
<div class="figure">
<a name="342"></a><a name="ch11fig01"></a><span class="figuremediaobject"><a href="images/fig156%5F01%5F0%2Ejpg" NAME="IMG_30" target="_parent"><img src="images/fig156_01.jpg" height="250" width="350" alt="Click To expand" border="0"></a></span>
<br style="line-height: 1">
<span class="figure-title"><span class="figure-titlelabel">Figure 11.1: </span>Using XML Access Objects Within a Layered Architecture</span>
</div>
<div class="highlights">
<p class="first-para">As a technical architect, you are responsible for forming coding standards and guidelines. This chapter provides implementation guidance and examples for structuring XAOs. In addition, we'll look at a way to generate code that XAOs can use easily, saving you development and maintenance time.</p>
<p class="last-para">The chapter assumes that you have a basic knowledge of XML concepts and have used an XML parser with Java. Familiarity with XSL style sheets and templates will also help you understand the examples presented here. For readers wanting an XML concept review, the tutorials at W3Schools (<a target="_top" class="url" href="http://www.w3schools.com/">http://www.w3schools.com/</a>) are well written and concise.</p>
</div>
</div>
</div><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;"><a href="toc.html"><img src="images/teamlib.gif" width="62" height="15" border="0" align="absmiddle"  alt="Team LiB"></a></div></td>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href="LiB0071.html"><img src="images/previous.gif" width="62" height="15" border="0" align="absmiddle" alt="Previous Section"></a>
<a href="LiB0073.html"><img src="images/next.gif" width="41" height="15" border="0" align="absmiddle" alt="Next Section"></a>
</div></td></tr></table>
</body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -