Document.Element
<p><strong>简要描述:</strong> </p>
<ul>
<li>com.seeyon.v3x.dee.Document.Element</li>
<li>Element是Document的元素</li>
<li>一级元素为Document根元素,只有唯一一个,名称为“root”</li>
<li>二级元素为“root”的子元素,定义为表名称,名称自定义但不允许重复,可以有多个</li>
<li>三级元素为表元素的子元素,定义为表中行记录,名称固定为“row”,可以有多个</li>
<li>四级元素为“row”的子元素,定义为字段,名称自定义但不允许重复,可以有多个,字段的值为数据值</li>
</ul>
<p><strong>格式如下:</strong></p>
<pre><code> &lt;root&gt;
&lt;table1&gt;
&lt;row&gt;
&lt;field1&gt;value&lt;/field1&gt;&lt;field2&gt;value&lt;/field2&gt;&lt;fieldN&gt;value&lt;/fieldN&gt;...
&lt;/row&gt;
&lt;row&gt;
&lt;field1&gt;value&lt;/field1&gt;&lt;field2&gt;value&lt;/field2&gt;&lt;fieldN&gt;value&lt;/fieldN&gt;...
&lt;/row&gt;
...
&lt;/table1&gt;
&lt;table2&gt;
&lt;row&gt;
&lt;field1&gt;value&lt;/field1&gt;&lt;field2&gt;value&lt;/field2&gt;&lt;fieldN&gt;value&lt;/fieldN&gt;...
&lt;/row&gt;
&lt;row&gt;
&lt;field1&gt;value&lt;/field1&gt;&lt;field2&gt;value&lt;/field2&gt;&lt;fieldN&gt;value&lt;/fieldN&gt;...
&lt;/row&gt;
...
&lt;/table2&gt;
...
&lt;/root&gt;</code></pre>
<p><strong>方法列表:</strong></p>
<table>
<thead>
<tr>
<th>方法名称</th>
<th>方法简介</th>
</tr>
</thead>
<tbody>
<tr>
<td>String getName()</td>
<td>获取当前元素的名称</td>
</tr>
<tr>
<td>Object getValue()</td>
<td>获取当前元素的值</td>
</tr>
<tr>
<td>void setValue(Object value)</td>
<td>设置当前元素的值</td>
</tr>
<tr>
<td>List<Element> getChildren()</td>
<td>获取当前元素的所有直接子元素</td>
</tr>
<tr>
<td>List<Element> getChildren(String name)</td>
<td>根据指定名称获取元素的直接子元素</td>
</tr>
<tr>
<td>List<Attribute> getAttributes()</td>
<td>获取当前元素的所有属性</td>
</tr>
<tr>
<td>Attribute getAttribute(String name)</td>
<td>根据指定名称获取当前元素的属性</td>
</tr>
<tr>
<td>Attribute setAttribute(String name, Object value)</td>
<td>设置当前元素的属性</td>
</tr>
<tr>
<td>Element getChild(String name)</td>
<td>根据名称获取当前元素的子元素</td>
</tr>
<tr>
<td>Element addChild(String name)</td>
<td>为当前元素增加指定名称的子元素</td>
</tr>
<tr>
<td>Element addChild(Element element)</td>
<td>为当前元素增加子元素</td>
</tr>
<tr>
<td>void removeChild(String name)</td>
<td>根据指定元素名称删除当前元素的子元素</td>
</tr>
</tbody>
</table>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>String getName()</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>获取当前元素的名称</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">无</td>
<td style="text-align: left;"></td>
<td style="text-align: left;"></td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">String</td>
<td style="text-align: left;">元素名称</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>document.getRootElement().getName();//可以获取root元素的名称</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>Object getValue();</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>获取当前元素的值</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">无</td>
<td style="text-align: left;"></td>
<td style="text-align: left;"></td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">Object</td>
<td style="text-align: left;">元素的值</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>List&lt;Element&gt; list = document.getRootElement().getChild(&quot;table1&quot;).getChildren();//先获取table1的所有row元素
list.get(0).getChild(&quot;field1&quot;).getValue();//获取第一个row元素的子元素field1元素的值</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>void setValue(Object value)</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>设置当前元素的值</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">value</td>
<td style="text-align: left;">Object</td>
<td style="text-align: left;">元素的值</td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">void</td>
<td style="text-align: left;">没有返回值</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>List&lt;Element&gt; list = document.getRootElement().getChild(&quot;table1&quot;).getChildren();//先获取table1的所有row元素
list.get(0).getChild(&quot;field1&quot;).setValue(&quot;hello world&quot;);//获取第一个row元素的子元素field1,并且设置field1元素的值为&quot;hello world&quot;</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>List&lt;Element&gt; getChildren()</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>获取当前元素的所有直接子元素</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">无</td>
<td style="text-align: left;"></td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">List<Element></td>
<td style="text-align: left;">所有直接子节点Element对象的集合</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>document.getRootElement().getChildren();//可获取root节点下所有直接子节点(即表节点)</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>List&lt;Element&gt; getChildren(String name)</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>根据指定名称获取元素的直接子元素</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">name</td>
<td style="text-align: left;">String</td>
<td style="text-align: left;">子节点名称</td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">List<Element></td>
<td style="text-align: left;">所有名称为name的直接子节点Element对象的集合</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>document.getRootElement().getChild(&quot;table1&quot;).getChildren(&quot;row&quot;);//可获取表table1节点下的所有row节点的集合</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>List&lt;Attribute&gt; getAttributes()</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>获取当前元素的所有属性</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">无</td>
<td style="text-align: left;"></td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">List<Attribute></td>
<td style="text-align: left;">元素所有属性的集合</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>document.getRootElement().getChild(&quot;table1&quot;).getAttributes();//获取表节点table1的所有属性</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>Attribute getAttribute(String name)</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>根据指定名称获取当前元素的属性</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">name</td>
<td style="text-align: left;">String</td>
<td style="text-align: left;">属性名称</td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">com.seeyon.v3x.dee.Document.Attribute</td>
<td style="text-align: left;">元素属性对象</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>document.getRootElement().getChild(&quot;table1&quot;).getAttribute(&quot;totalCount&quot;);//获取表节点table1的“totalCount”属性</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>Attribute setAttribute(String name, Object value)</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>设置当前元素的属性</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">name</td>
<td style="text-align: left;">String</td>
<td style="text-align: left;">属性名称</td>
</tr>
<tr>
<td style="text-align: left;">value</td>
<td style="text-align: left;">Object</td>
<td style="text-align: left;">属性值</td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">com.seeyon.v3x.dee.Document.Attribute</td>
<td style="text-align: left;">设置到元素的属性对象</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>document.getRootElement().getChild(&quot;table1&quot;).setAttribute(&quot;id&quot;,&quot;888&quot;);//设置元素table1的属性id的值为“888”,如果元素table1没有属性“id”,那么会新建属性名称为“id”,值为“888”,并且设置给元素</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>Element getChild(String name)</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>根据名称获取当前元素的子元素</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">name</td>
<td style="text-align: left;">String</td>
<td style="text-align: left;">子元素名称</td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">com.seeyon.v3x.dee.Document.Element</td>
<td style="text-align: left;">子元素对象</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>document.getRootElement().getChild(&quot;table1&quot;);//获取根元素下的名称为table1的表元素</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>Element addChild(String name)</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>为当前元素增加指定名称的子元素</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">name</td>
<td style="text-align: left;">String</td>
<td style="text-align: left;">子元素名称</td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">com.seeyon.v3x.dee.Document.Element</td>
<td style="text-align: left;">子元素对象</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>document.getRootElement().addChild(&quot;table2&quot;);//增加根元素的子元素,名称为“table2”</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>Element addChild(Element element)</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>为当前元素增加子元素</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">element</td>
<td style="text-align: left;">com.seeyon.v3x.dee.Document.Element</td>
<td style="text-align: left;">子元素Element对象</td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">com.seeyon.v3x.dee.Document.Element</td>
<td style="text-align: left;">子元素对象</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>Element table3 = document.createElement(&quot;table3&quot;);//创建名称为“table3”的元素
document.getRootElement().addChild(table3);//将“table3”元素插入根元素下,作为根元素的子元素</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>
<hr />
<p><strong>方法签名:</strong> </p>
<p><code>void removeChild(String name)</code></p>
<p><strong>简要描述:</strong> </p>
<ul>
<li>根据指定元素名称删除当前元素的子元素</li>
</ul>
<p><strong>参数:</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">参数名</th>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">name</td>
<td style="text-align: left;">String</td>
<td style="text-align: left;">子元素名称</td>
</tr>
</tbody>
</table>
<p><strong>返回值说明</strong> </p>
<table>
<thead>
<tr>
<th style="text-align: left;">类型</th>
<th style="text-align: left;">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: left;">void</td>
<td style="text-align: left;">没有返回值</td>
</tr>
</tbody>
</table>
<p><strong>使用例子</strong></p>
<pre><code>document.getRootElement().removeChild(&quot;table1&quot;);//删除根元素下名称为“table1”的子元素</code></pre>
<p><strong>备注</strong> </p>
<ul>
<li>无</li>
</ul>