Location: PHPKode > projects > XMLNuke Web Development Framework XML > xmlnuke-php5-v3.5r356/xmlnuke-php5/data/sites/docs/xml/en-us/db_3.en-us.xml
<?xml version="1.0" encoding="utf-8"?>
<page>
	<meta>
		<title>The IIterator interface and the objects for standardized data access.</title>
		<abstract>The standardized method for accessing any data source through the IIterator interface and the objects for accessing data existing in XLMNuke.</abstract>
		<created>4/2/2008 15:54:20</created>
		<modified>Sun Sep 14 2008 13:09:13</modified>
		<keyword>xmlnuke</keyword>
		<groupkeyword>bdref</groupkeyword>
	</meta>
	<blockcenter>
		<title>The IIterator Interface</title>
		<body>
			<p>In XMLNuke, all of the structures for accessing data use an identical method to iterate through their entries. The origin does not matter, whether it is XML, DataBase, .CSV files, etc,; all of them implement the IIterator interface. The interface has the following methods: 
<ul><li><b>hasNext()</b> - returns true or false and indicates if there are still files in the structure that are being iterated.</li><li><b>moveNext()</b> - returns a SingleRow type object that represents the fields and data of an entry</li></ul></p>
			<p>All of the objects in XMLNuke that manipulate or use a data source receive an IIterator as a standard way to iterate these data.
</p>
		</body>
	</blockcenter>
	<blockcenter>
		<title>The SingleRow Object</title>
		<body>
			<p>The SingleRow object represents an "entry", or a group of data from the same instance. Each entry iterated with the moveNext() method of the IIterator interface generates a SingleRow type object. The SingleRow object basically uses the following methods:
<ul>
<li><b>getField(name)</b> - obtain the value of a specific field</li>
<li><b>getFieldArray(name)</b> - obtain an array with all of the data in the "name" field for that entry. It's important to note that the SingleRow object is in fact an abstraction for an XML and not necessarily for a relational database. This way, a field may, in some cases, have more than one value.</li>
<li><b>getFieldNames()</b> - Obtains the names of all the fields. </li>
<li><b>getDomObject()</b> - Obtains the DOM object to be manipulated</li>
</ul>
Important note: The SingleRow object has methods to modify the values, add fields or remove fields; however, it is only sensitive to an <a href="engine:xmlnuke?xml=technicalref_3">AnyDataSet</a> object.</p>
		</body>
	</blockcenter>
	<blockcenter>
		<title>Classes for data access on XMLNuke</title>
		<body>
			<p>XMLNuke has several classes to access and manipulate data. Even though the data sources exist in various formats, the programmer only needs to know the IIterator interface and the SingleRow object. The data sources are listed as follows:

<table style="font-family: verdana; font-size: 11px">

<tr style="background: silver; font-weight: bold">
<td>Class</td>
<td>Data Source</td>
<td>Acess</td>
<td>Xmlnuke Engine</td>
<td>Notes</td>
</tr>
<tr>
<td style="background: silver; font-weight: bold">AnyDataSet</td>
<td>XML Pre-Defined</td>
<td>Reading/Writing</td>
<td>PHP5/CSharp</td>
<td>Available in all versions of XMLNuke. It can serve as a small data repository and does not require other configurations. It does not serve for concurrent access and access to many entries.</td>
</tr>
<tr>
<td style="background: silver; font-weight: bold">DBDataSet</td>
<td>Relational DataBase</td>
<td>Reading/Writing</td>
<td>PHP5/CSharp</td>
<td>The supported databases and versons may be accessed <a href="engine:xmlnuke?xml=bd_1">here</a>. The reading and writing method should be done through SQL commands. It supports transactions and parameters.</td>
</tr>
<tr><td style="background: silver; font-weight: bold">ArrayDataSet</td>
<td>Array</td>
<td>Reading</td>
<td>PHP5/CSharp</td>
<td>In the CSharp version, the class is capable of iterating an object of the NameValueCollection type. In the PHP version, it iterates any array.</td>
</tr>
<tr>
<td style="background: silver; font-weight: bold">DSDataSet</td>
<td>DataSet .NET</td>
<td>Reading</td>
<td>CSharp</td>
<td>It is capable of iterating in a standardized way a DataSet in .NET</td>
</tr>
<tr>
<td style="background: silver; font-weight: bold">SocketDataSet</td>
<td>Stream text in Socket</td>
<td>Reading</td>
<td>PHP5</td>
<td>It connects through fsocketopen() and reads a data stream. A line and column separator must be supplied to determine the entries and columns</td>
</tr>
<tr>
<td style="background: silver; font-weight: bold">TextFileDataSet</td>
<td>Text Delimeted</td>
<td>Reading</td>
<td>PHP5/CSharp</td>
<td>Open a text document and allows it to iterate through the IIterator. The line break is the entry delimitor, and to delimit the fields a regular expression must be provided. The object by default has a regular expression for .CSV documents generated by Excel.</td>
</tr>
<tr>
<td style="background: silver; font-weight: bold">XmlDataSet</td>
<td>XML</td>
<td>Reading</td>
<td>PHP5/CSharp</td>
<td>Allows an XML document to be iterated in a standardized way. An XPATH should be provided to determine the entries and an XPATH collection (related to the XPATH of the line) should be provided to determine the fields. Attributes or text nodes can be provided.</td>
</tr>
</table>
</p>
		</body>
	</blockcenter>
</page>
Return current item: XMLNuke Web Development Framework XML