XML (可扩展标记语言)

XML (可扩展标记语言)

一、 标记语言

    标记语言,是一种将文本(txt)以及文本相关的其他信息结合起来,展现出关于文档结构和数据处理细节的电脑文字编码。

    当今广泛使用的标记语言是超文本标记语言(HyperText Markup Language,)HTML 和 可扩展标记语言(Extensible Markup Language)XML。标记语言广泛应用于网页和网络应用程序。

1、超文本标记语言 HTML

(1)写法格式:linklink
(2)关注数据的展示与用户体验
(3)标记是预定义、不可扩展的(如 表示超链接)

2、可扩展的标记语言 XML

(1)写法格式:同 html 样式
(2)仅关注数据本身
(3)标记可扩展,可自定义

xml 和 Html 语言是由同一种父语言 SGML(Standard Generalized Markup Language,标准通用标记语言)发展出来的两种语言。

    xml 由 html 发展而来,与 html 格式相似,但是比html 严格。

    XML 描述的是结构、内容和语义,它不描述页面元素的格式化。HTML 侧重于如何表现信息,内容描述与显示整合为一体。

    XML 中的每个元素名都是成对出现的,结束标签前加一个/



二、XML 作用

    XML 可以用于描述数据、存储数据、传输(交换)数据。XML 现在已经成为一种通用的数据交换格式,它的平台无关性,语言无关性,系统无关性,给数据集成与交互带来了极大的方便,用户可以定义自己需要的标记。

1、存储、交换数据

    XML 只用元素和属性来描述数据,而不提供数据的显示方法,这使得 XML 具有能够运
行于不同系统平台之间和转换成不同格式目标文件。 用 XML 在应用程序和公司之间作数据交换,几个应用程序可以共享和解析同一个 XML 文件,不必使用传统的字符串解析或拆解过程。

2、配置

许多应用都将配置数据存储在各种文件里,如 SSH、Android。使用 XML 配置文件的应用程序能够方便地处理所需数据,不用像其它应用那样要经过重新编译才能修改和维护应用系统。xml 比 数据库占用的资源少,操作方便,用来存储简单的信息,现在主要用在程序的配置文件上(比如 web.xml)。现在有越来越多的设备也支持 XML 了。

三、XML 示例

用 XML 存储已注册用户的数据方式

1、方式 1
"1.0" encoding="UTF-8"?>


张三</name>
28</age>
</person>

李四</name>
30</age>
</person>
</people>
2、方式 2
"1.0" encoding="UTF-8"?>

"白晶晶" age="28"></person>
"至尊宝" age="300"></person>
</people>
用 xml 存储连续剧
"1.0" encoding="UTF-8"?>
<!-- 第一行是XML声明 -->
<!-- 这是XML处理指令的例子:处理指令以,以?>结束 -->
<!--,在本例中是xml> -->
<!-- 处理指令一定要顶格写,前面不能有任何空白 -->


"郑晓龙"</span>>芈月传<<span class="token operator">/</span>title>
<players>
<player>孙俪<<span class="token operator">/</span>player>
<player>刘涛<<span class="token operator">/</span>player>
<player>马苏<<span class="token operator">/</span>player>
<player>方中信<<span class="token operator">/</span>player>
<player>黄轩<<span class="token operator">/</span>player>
<player>高云翔<<span class="token operator">/</span>player>
<<span class="token operator">/</span>players>
<desc><<span class="token operator">!</span><span class="token namespace">[CDATA[战国时期,芈月是楚威王最宠爱的小公主,但<desc>在楚威王
死后生活一落千丈,母亲向氏被楚威后逐出宫,芈月和弟弟芈戎躲过了一次次灾难和危机。
芈月与楚公子黄歇青梅竹马,真心相爱,但被作为嫡公主芈姝的陪嫁媵侍远嫁秦国。芈姝当
上了秦国的王后,芈月不得已成为宠妃...]]</span>><<span class="token operator">/</span>desc>
<<span class="token operator">/</span>sitcom>
<sitcom>
<title director=<span class="token string">"郑晓龙"</span>>甄嬛传<<span class="token operator">/</span>title>
<players>
<player>孙俪<<span class="token operator">/</span>player>
<player>陈建斌<<span class="token operator">/</span>player>
<player>蔡少芬<<span class="token operator">/</span>player>
<player>蒋欣<<span class="token operator">/</span>player>
<player>李东学<<span class="token operator">/</span>player>
<<span class="token operator">/</span>players>
<<span class="token operator">/</span>sitcom>
<<span class="token operator">/</span>sitcoms>
</code></pre> 
  <p>    文档的后缀名是 xml,每个文档有且仅有一个根元素,所谓根元素就是包含了其他所有元素的元素。XML 目前只有一个版本,即 1.0.XML 是自描述数据,使用现有的国际标准。</p> 
  <p>    XML 中有格式良好(Well-formed)的 XML 和有效的(validate)XML。</p> 
  <br> 
  <br> 
  <h3><font color="blue">四、格式良好的 xml<br></font></h3> 
  <h5>1、语法规范:</h5> 
  <h6>1)、必须有 XML 文档声明:</h6> 
  <p><a href="http://img.e-com-net.com/image/info8/54a6084936ae4a9597ed389dcf60802b.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/54a6084936ae4a9597ed389dcf60802b.jpg" alt="XML (可扩展标记语言)_第1张图片" width="650" height="105" style="border:1px solid black;"></a><br> <a href="http://img.e-com-net.com/image/info8/4878b2a5cfa9492f96e913769b03f3c7.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/4878b2a5cfa9492f96e913769b03f3c7.jpg" alt="XML (可扩展标记语言)_第2张图片" width="650" height="224" style="border:1px solid black;"></a></p> 
  <p><strong>说明:</strong><br>     XML standalone 定义了外部定义的 DTD 文件的存在性. standalone element 有效值是 yes 和 no. 如下是一个例子:</p> 
  <pre><code class="prism language-powershell"><?xml version=<span class="token string">"1.0"</span> encoding=<span class="token string">"UTF-8"</span> standalone=<span class="token string">"no"</span>?>
<<span class="token operator">!</span>DOCTYPE s1 PUBLIC <span class="token string">"http://www.ibm.com/example.dtd"</span> <span class="token string">"example.dtd"</span>>
<s1><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><span class="token punctuation">.</span><<span class="token operator">/</span>s1>
</code></pre> 
  <p>    值 no 表示这个 XML 文档不是独立的而是依赖于外部所定义的一个 DTD. 值 yes 表示这个 XML 文档是自包含的(self-contained).</p> 
  <p>    注意文本文件保存时候默认的编码格式是ANSI,需用记事本把它手动改为UTF-8保存。</p> 
  <h6>2)、必须有且仅有一个根元素</h6> 
  <h6>3)、严格区分大小写</h6> 
  <h6>4)、属性值用引号(双引号或单引号) :</h6> 
  <p>    等号分开的名称-值对;在一个元素上,相同的属性只能出现一次</p> 
  <h6>5)、标记成对;</h6> 
  <h6>6)、空标记关闭;</h6> 
  <h6>7)、元素正确嵌套。</h6> 
  <br> 
  <h5>2、元素命名规则</h5> 
  <h6>1)、名称中可以包含字母、数字或者其他可见字符;</h6> 
  <h6>2)、名称不能以数字开头;</h6> 
  <h6>3)、不能以 XML/xml/Xml…开头;</h6> 
  <h6>4)、名称中不能含空格;</h6> 
  <h6>5)、名称中不能含冒号(注:冒号留给命名空间使用)</h6> 
  <br> 
  <h5>3、实体</h5> 
  <p>    实体叫 ENTITY,实体的作用是避免重复输入。作用相当于宏或者变量。</p> 
  <h6>1)内置的 5 种实体</h6> 
  <table> 
   <thead> 
    <tr> 
     <th>实体</th> 
     <th>符号</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td><code><</code></td> 
     <td><</td> 
    </tr> 
    <tr> 
     <td><code>></code></td> 
     <td>></td> 
    </tr> 
    <tr> 
     <td><code>&</code></td> 
     <td>&</td> 
    </tr> 
    <tr> 
     <td><code>"</code></td> 
     <td>"</td> 
    </tr> 
    <tr> 
     <td><code>'</code></td> 
     <td>’</td> 
    </tr> 
   </tbody> 
  </table> 
  <h6>2)自定义实体</h6> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span>DOCTYPE 根元素<span class="token punctuation">[</span>
<<span class="token operator">!</span>-<span class="token operator">-</span>实体声明<span class="token operator">--</span>>
<<span class="token operator">!</span>ENTITY 实体名 <span class="token string">"实体内容"</span>>
<span class="token punctuation">]</span>>
使用已定义的实体:&实体名<span class="token punctuation">;</span>
<?xml version=<span class="token string">"1.0"</span> encoding=<span class="token string">"UTF-8"</span>?>
<<span class="token operator">!</span>DOCTYPE sxt<span class="token punctuation">[</span>
<<span class="token operator">!</span>-<span class="token operator">-</span>实体声明<span class="token operator">--</span>>
<<span class="token operator">!</span>ENTITY xm <span class="token string">"明明"</span>>
<<span class="token operator">!</span>ENTITY gen <span class="token string">"保密"</span>>
<span class="token punctuation">]</span>>
<xxx>
<teacher>
 <name>明明<<span class="token operator">/</span>name>
 <gender>保密<<span class="token operator">/</span>gender>
 <<span class="token operator">/</span>teacher>
 <<span class="token operator">!</span>-<span class="token operator">-</span>引用实体的方法<span class="token operator">--</span>>
 <teacher>
 <name>&xm<span class="token punctuation">;</span><<span class="token operator">/</span>name>
 <gender>&gen<span class="token punctuation">;</span><<span class="token operator">/</span>gender>
 <<span class="token operator">/</span>teacher>
<<span class="token operator">/</span>xxx>
</code></pre> 
  <br> 
  <h5>4、文档类型声明</h5> 
  <p>    文档类型定义——DOCTYPE,文档类型声明,紧跟 XML 声明之后,包含所有实体声明</p> 
  <pre><code class="prism language-powershell"><?xml version=<span class="token string">"1.0"</span> encoding=<span class="token string">"utf-8"</span>?>
<<span class="token operator">!</span>DOCTYPE 根元素标记名<span class="token punctuation">[</span><<span class="token operator">!</span>-<span class="token operator">-</span>实体声明<span class="token operator">--</span>><span class="token punctuation">]</span>>
</code></pre> 
  <br> 
  <br> 
  <h3><font color="blue">五、组成</font></h3> 
  <h5>1、构成</h5> 
  <p>    所有的 XML 文档(以及 HTML 文档)均由以下简单的构建模块构成:<br>     元素<br>     属性<br>     实体<br>     PCDATA<br>     CDATA<br>     CDATA 节(character data)</p> 
  <h5>2、CDATA</h5> 
  <p>    用于把整段文本解释为纯字符数据而不是标记的情况。如包含大量的<、>、&、或者"字符。CDATA 节中的所有字符都会被当做元素字符数据的常量部分,而不是 XML 标记,可以输入除]]>外任意字符,不能嵌套。</p> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span><span class="token namespace">[CDATA[ ...... ]]</span>>
</code></pre> 
  <h5>3、PCDATA</h5> 
  <p>    PCDATA 的意思是被解析的字符数据(parsed character data)。<br> 可把字符数据想象为 XML 元素的开始标签与结束标签之间的文本。PCDATA 是会被解析器解析的文本。这些文本将被解析器检查实体以及标记。文本中的标签会被当作标记来处理,而实体会被展开。不过,被解析的字符数据不应当包含任何 &、< 或者 > 字符;需要使用 &、< 以及 > 的内置实体来分别替换它们。<br> <br><br> <br></p> 
  <h3><font color="blue">六、XML 解析(重点)</font></h3> 
  <p>    基本的解析方式有两种:一种叫 SAX,另一种叫 DOM。SAX(Simple API for XML)是基于事件流的解析,DOM(Document Object Model)是基于 XML 文档树结构的解析。SAX:效率高,数据量小,仅一次获取 ,DOM:整颗树加载到内存中,耗内存,可多次获取。</p> 
  <h5>1、DOM 解析</h5> 
  <p>    与 js 中的类似,使用 JAXP(Java API for XML Parsing),即:用于 XML 解析的 Java API.</p> 
  <p>    DOM(Document Object Model, 文档对象模型),在应用程序中,基于 DOM 的 XML分析器将一个 XML 文档转换成一个对象模型的集合(通常称为 DOM 树),应用程序正是通过对这个对象模型的操作,来实现对 XML 文档数据的操作。</p> 
  <p>    XML 本身是以树状的形式出现的,所以 DOM 操作的时候,也将按章树的形式进行转换。在整个 DOM 树种,最大的地方指的是 Document,表示一个文档,在这个文档中存在一个根节点。</p> 
  <p>    注意:在使用 DOM 操作的时候,每一个文字的区域也是一个节点,称为文本节点。<br> 核心操作接口</p> 
  <h6>在 DOM 解析中有以下四个核心的操作接口</h6> 
  <h6>Document :</h6> 
  <p>    此接口代表了整个 XML 文档,表示的是整棵 DOM 树的根,提供了对文档中的数据进行访问和操作的入口,通过 Document 节点可以访问 XML 文件中所有的元素内容。</p> 
  <h6>Node :</h6> 
  <p>    此接口在整个 DOM 树种具有举足轻重的低位,DOM 操作的核心接口中有很大一部分接口是从 Node 接口继承过来的。例如:Document、Element 等接口,在 DOM树种,每一个 Node 接口代表了 DOM 树种的一个节点。</p> 
  <h6>NodeList :</h6> 
  <p>    此接口表示的是一个节点的集合,一般用于表示有顺序关系的一组节点,例如:一个节点的子节点,当文档改变的时候会直接影响到 NodeList 集合。</p> 
  <h6>NamedNodeMap :</h6> 
  <p>    此接口表示的是一组节点和其唯一名字对应的一一对应关系,本接口主要用于属性节点的表示上。</p> 
  <h6>DOM 解析过程</h6> 
  <p>如果一个程序需要进行 DOM 解析读取操作的话,也需要按照如下的步骤进行:</p> 
  <ul> 
   <li>① 建 立 DocumentBuilderFactory : DocumentBuilderFactory factory =<br> DocumentBuilderFactory.newInstance();</li> 
   <li>②建立 DocumentBuilder: DocumentBuilder builder = factory.newDocumentBuilder();</li> 
   <li>③建立 Document : Document doc = builder.parse(“要解析的文件路径”);</li> 
   <li>④建立 NodeList : NodeList nl = doc.getElementsByTagName(“读取节点”);</li> 
   <li>⑤进行 XML 信息读取<br> DOM 操作除了可以进行解析外,也可以进行文档的生成<br> 如果想要生成 XML 文件,则在创建文档的时候,就应该使用 newDocument()方法<br> 如果要将 DOM 的文档输出,本身是比较麻烦的 。一次编写多次 copy</li> 
  </ul> 
  <pre><code class="prism language-java"><span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">createXml</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token keyword">throws</span> Exception<span class="token punctuation">{</span>
<span class="token comment">//获取解析器工厂</span>
DocumentBuilderFactory factory<span class="token operator">=</span>DocumentBuilderFactory<span class="token punctuation">.</span><span class="token function">newInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//获取解析器</span>
DocumentBuilder builder<span class="token operator">=</span>factory<span class="token punctuation">.</span><span class="token function">newDocumentBuilder</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//创建文档</span>
Document doc<span class="token operator">=</span>builder<span class="token punctuation">.</span><span class="token function">newDocument</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//创建元素、设置关系</span>
Element root<span class="token operator">=</span>doc<span class="token punctuation">.</span><span class="token function">createElement</span><span class="token punctuation">(</span><span class="token string">"people"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Element person<span class="token operator">=</span>doc<span class="token punctuation">.</span><span class="token function">createElement</span><span class="token punctuation">(</span><span class="token string">"person"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Element name<span class="token operator">=</span>doc<span class="token punctuation">.</span><span class="token function">createElement</span><span class="token punctuation">(</span><span class="token string">"name"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Element age<span class="token operator">=</span>doc<span class="token punctuation">.</span><span class="token function">createElement</span><span class="token punctuation">(</span><span class="token string">"age"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
name<span class="token punctuation">.</span><span class="token function">appendChild</span><span class="token punctuation">(</span>doc<span class="token punctuation">.</span><span class="token function">createTextNode</span><span class="token punctuation">(</span><span class="token string">"shsxt"</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
age<span class="token punctuation">.</span><span class="token function">appendChild</span><span class="token punctuation">(</span>doc<span class="token punctuation">.</span><span class="token function">createTextNode</span><span class="token punctuation">(</span><span class="token string">"10"</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
doc<span class="token punctuation">.</span><span class="token function">appendChild</span><span class="token punctuation">(</span>root<span class="token punctuation">)</span><span class="token punctuation">;</span>
root<span class="token punctuation">.</span><span class="token function">appendChild</span><span class="token punctuation">(</span>person<span class="token punctuation">)</span><span class="token punctuation">;</span>
person<span class="token punctuation">.</span><span class="token function">appendChild</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
person<span class="token punctuation">.</span><span class="token function">appendChild</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//写出去</span>
<span class="token comment">// 获得变压器工厂</span>
TransformerFactory tsf<span class="token operator">=</span>TransformerFactory<span class="token punctuation">.</span><span class="token function">newInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Transformer ts<span class="token operator">=</span>tsf<span class="token punctuation">.</span><span class="token function">newTransformer</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//设置编码</span>
ts<span class="token punctuation">.</span><span class="token function">setOutputProperty</span><span class="token punctuation">(</span>OutputKeys<span class="token punctuation">.</span>ENCODING<span class="token punctuation">,</span> <span class="token string">"UTF-8"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//创建带有DOM节点的新输入源,充当转换Source树的持有者</span>
DOMSource source<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">DOMSource</span><span class="token punctuation">(</span>doc<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//充当转换结果的持有者</span>
File file<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">File</span><span class="token punctuation">(</span><span class="token string">"src/output.xml"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
StreamResult result<span class="token operator">=</span><span class="token keyword">new</span> <span class="token class-name">StreamResult</span><span class="token punctuation">(</span>file<span class="token punctuation">)</span><span class="token punctuation">;</span>
ts<span class="token punctuation">.</span><span class="token function">transform</span><span class="token punctuation">(</span>source<span class="token punctuation">,</span> result<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre> 
  <br> 
  <h5>2、SAX 解析</h5> 
  <p>    SAX(Simple API for XML)解析是按照 xml 文件的顺序一步一步的来解析。<br>     SAX 没有官方的标准机构,它不属于任何标准阻止或团体,也不属于任何公司或个人,而是提供任何人使用的一种计算机技术。<br>     SAX(Simple API for XML,操作 XML 的简单接口),与 DOM 操作不同的是,SAX 采用的是一种顺序的模式进行访问,是一种快速读取 XML 数据的方式。当使用 SAX 解析器进行操作的时候会触发一系列的事情,当扫描到文档(document)开始与结束、元素(element)开始与结束时都会调用相关的处理方法,并由这些操作方法作出相应的操作,直至整个文档扫描结束。<br>     如果要想实现这种 SAX 解析,则肯定首先建立一个 SAX 的解析器</p> 
  <pre><code class="prism language-java"><span class="token comment">// 1、创建解析器工厂</span>
SAXParserFactory factory <span class="token operator">=</span> SAXParserFactory<span class="token punctuation">.</span><span class="token function">newInstance</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 2、获得解析器</span>
SAXParser parser <span class="token operator">=</span> factory<span class="token punctuation">.</span><span class="token function">newSAXParser</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// SAX解析器 ,继承 DefaultHandler</span>
String path <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">File</span><span class="token punctuation">(</span><span class="token string">"resource/demo01.xml"</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">getAbsolutePath</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 解析</span>
parser<span class="token punctuation">.</span><span class="token function">parse</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> <span class="token keyword">new</span> <span class="token class-name">MySaxHandler</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> 
  <br> 
  <h5>3、DOM4j 解析</h5> 
  <p>    dom4j 是一个简单的开源库,用于处理 XML、 XPath 和 XSLT,它基于 Java 平台,使用 Java 的集合框架,全面集成了 DOM,SAX 和 JAXP。下载路径:<br> http://www.dom4j.org/dom4j-1.6.1/</p> 
  <p>http://sourceforge.net/projects/dom4j</p> 
  <p>可以使用 DOM4J 进行 XML 文件的读、写操作<br>     DOM4J 与 JDOM 一样都属于一个免费的 XML 开源组建,但是由于现在的开发框架中使用该技术较多,比如 Hibernate、Spring 等都使用 DOM4J 这个功能,所以作为介绍,大家可以对该组件有一个了解。并没有谁好谁坏,一般框架使用 DOM4J 较多,而我们平时如果要用则 JDOM 较常见。可以发现 DOM4J 发挥了很多新特性,比如输出格式就可以很好解析</p> 
  <pre><code class="prism language-powershell">File file = new File<span class="token punctuation">(</span><span class="token string">"resource/outputdom4j.xml"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
SAXReader reader = new SAXReader<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">/</span><span class="token operator">/</span> 读取文件作为文档
Document doc = reader<span class="token punctuation">.</span>read<span class="token punctuation">(</span>file<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">/</span><span class="token operator">/</span> 获取文档的根元素
Element root = doc<span class="token punctuation">.</span>getRootElement<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">/</span><span class="token operator">/</span> 根据跟元素找到全部的子节点
Iterator<Element> iter = root<span class="token punctuation">.</span>elementIterator<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">while</span><span class="token punctuation">(</span>iter<span class="token punctuation">.</span>hasNext<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
Element name = iter<span class="token punctuation">.</span>next<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span>println<span class="token punctuation">(</span><span class="token string">"value = "</span> <span class="token operator">+</span> name<span class="token punctuation">.</span>getText<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre> 
  <h6>创建代码</h6> 
  <pre><code class="prism language-powershell">/<span class="token operator">/</span> 使用DocumentHelper来创建 Document对象
Document document = DocumentHelper<span class="token punctuation">.</span>createDocument<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">/</span><span class="token operator">/</span> 创建元素并设置关系
Element person = document<span class="token punctuation">.</span>addElement<span class="token punctuation">(</span><span class="token string">"person"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Element name = person<span class="token punctuation">.</span>addElement<span class="token punctuation">(</span><span class="token string">"name"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Element age = person<span class="token punctuation">.</span>addElement<span class="token punctuation">(</span><span class="token string">"age"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">/</span><span class="token operator">/</span> 设置文本
name<span class="token punctuation">.</span>setText<span class="token punctuation">(</span><span class="token string">"shsxt"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
age<span class="token punctuation">.</span>setText<span class="token punctuation">(</span><span class="token string">"10"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">/</span><span class="token operator">/</span> 创建格式化输出器
OutputFormat of = OutputFormat<span class="token punctuation">.</span>createPrettyPrint<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
of<span class="token punctuation">.</span>setEncoding<span class="token punctuation">(</span><span class="token string">"utf-8"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">/</span><span class="token operator">/</span> 输出到文件
File file = new File<span class="token punctuation">(</span><span class="token string">"resource/outputdom4j.xml"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
XMLWriter writer = new XMLWriter<span class="token punctuation">(</span>new FileOutputStream<span class="token punctuation">(</span>new
File<span class="token punctuation">(</span>file<span class="token punctuation">.</span>getAbsolutePath<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>of<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token operator">/</span><span class="token operator">/</span> 写出
writer<span class="token punctuation">.</span><span class="token function">write</span><span class="token punctuation">(</span>document<span class="token punctuation">)</span><span class="token punctuation">;</span>
writer<span class="token punctuation">.</span>flush<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
writer<span class="token punctuation">.</span>close<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> 
  <h6>Dom4J解析XML文档 代码</h6> 
  <pre><code class="prism language-java"><span class="token comment">// 	1、得到要解析的文件对象</span>
<span class="token comment">// 	2、得到解析器</span>
<span class="token comment">//	3、通过解析器将文件对象转换成Document对象</span>
<span class="token comment">// 	4、得到当前文档对象的根节点</span>
<span class="token comment">// 	5、得到 根节点的所有子节点,返回迭代器</span>
<span class="token comment">// 	6、遍历,得到每一个子节点的名称和值</span>
 
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">Dom4JReader</span> <span class="token punctuation">{</span>
	
	<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span>String<span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token keyword">throws</span> Exception <span class="token punctuation">{</span>
		
		<span class="token comment">// 1、得到要解析的文件对象</span>
		File file <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">File</span><span class="token punctuation">(</span><span class="token string">"src/test.xml"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 2、得到解析器</span>
		SAXReader reader <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">SAXReader</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 3、通过解析器将文件对象转换成Document对象</span>
		Document document <span class="token operator">=</span> reader<span class="token punctuation">.</span><span class="token function">read</span><span class="token punctuation">(</span>file<span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 4、得到当前文档对象的根节点</span>
		Element root <span class="token operator">=</span> document<span class="token punctuation">.</span><span class="token function">getRootElement</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 5、得到 根节点的所有子节点,返回迭代器</span>
		Iterator<span class="token generics function"><span class="token punctuation"><</span>Element<span class="token punctuation">></span></span> iterator <span class="token operator">=</span> root<span class="token punctuation">.</span><span class="token function">elementIterator</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 6、遍历,得到每一个子节点的名称和值</span>
		<span class="token keyword">while</span><span class="token punctuation">(</span>iterator<span class="token punctuation">.</span><span class="token function">hasNext</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
			Element el <span class="token operator">=</span> iterator<span class="token punctuation">.</span><span class="token function">next</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
			System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>el<span class="token punctuation">.</span><span class="token function">getName</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
			System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>el<span class="token punctuation">.</span><span class="token function">getText</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token punctuation">}</span>
		
	<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> 
  <h6>Dom4JWriter 代码</h6> 
  <pre><code class="prism language-java"><span class="token comment">// 使用DocumentHelper来创建 Document对象</span>
<span class="token comment">// 创建元素并设置关系</span>
<span class="token comment">// 设置文本</span>
<span class="token comment">// 创建格式化输出器</span>
<span class="token comment">// 输出到文件</span>
<span class="token comment">// 写出</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">Dom4JWriter</span> <span class="token punctuation">{</span>

	<span class="token keyword">public</span> <span class="token keyword">static</span> <span class="token keyword">void</span> <span class="token function">main</span><span class="token punctuation">(</span>String<span class="token punctuation">[</span><span class="token punctuation">]</span> args<span class="token punctuation">)</span> <span class="token keyword">throws</span> Exception <span class="token punctuation">{</span>
		
		<span class="token comment">// 使用DocumentHelper来创建 Document对象</span>
		Document document <span class="token operator">=</span> DocumentHelper<span class="token punctuation">.</span><span class="token function">createDocument</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 创建元素并设置关系</span>
		Element person <span class="token operator">=</span> document<span class="token punctuation">.</span><span class="token function">addElement</span><span class="token punctuation">(</span><span class="token string">"person"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		Element name <span class="token operator">=</span> person<span class="token punctuation">.</span><span class="token function">addElement</span><span class="token punctuation">(</span><span class="token string">"name"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		Element age <span class="token operator">=</span> person<span class="token punctuation">.</span><span class="token function">addElement</span><span class="token punctuation">(</span><span class="token string">"age"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 设置文本</span>
		name<span class="token punctuation">.</span><span class="token function">setText</span><span class="token punctuation">(</span><span class="token string">"shsxt"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		age<span class="token punctuation">.</span><span class="token function">setText</span><span class="token punctuation">(</span><span class="token string">"10"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 创建格式化输出器</span>
		OutputFormat of <span class="token operator">=</span> OutputFormat<span class="token punctuation">.</span><span class="token function">createPrettyPrint</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		of<span class="token punctuation">.</span><span class="token function">setEncoding</span><span class="token punctuation">(</span><span class="token string">"utf-8"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 输出到文件</span>
		File file <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">File</span><span class="token punctuation">(</span><span class="token string">"src/outputdom4j.xml"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		XMLWriter writer <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">XMLWriter</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">FileOutputStream</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">File</span><span class="token punctuation">(</span>file<span class="token punctuation">.</span><span class="token function">getAbsolutePath</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>of<span class="token punctuation">)</span><span class="token punctuation">;</span>
		<span class="token comment">// 写出</span>
		writer<span class="token punctuation">.</span><span class="token function">write</span><span class="token punctuation">(</span>document<span class="token punctuation">)</span><span class="token punctuation">;</span>
		writer<span class="token punctuation">.</span><span class="token function">flush</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		writer<span class="token punctuation">.</span><span class="token function">close</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
		
	<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</code></pre> 
  <br> 
  <h5>4、JDOM 解析</h5> 
  <p><strong>下载路径:</strong> http://www.jdom.org/downloads/index.html</p> 
  <p>    JDOM 是一种使用 XML 的独特 Java 工具包,用于快速开发 XML 应用程序。 JDOM 是一个开源项目,它基于树形结构,利用纯 Java 的技术对 XML 文档实现解析、生成、序列化及多种操作。</p> 
  <p><strong>JDOM 解析</strong><br>     掌握 JDOM 开发工具的使用及产生原理可以使用 JDOM 进行读取或写入的操作在 W3C 本身提供的 XML 操作标准,DOM 和 SAX,但是从开发角度上看,DOM 和 SAX本身是各有特点的,DOM 可以修改,但不适合读取大文件,而 SAX 可以读取大文件,但是本身不能修改所谓的 JDOM = DOM 的可修改 + SAX 的读取大文件<br>     DOM 本身是一个免费的开源组建,直接从 www.jdom.org 上下载,下载后解压,将 jdom.jar 包拷贝到 Tomcat 目录(项目)的 lib 中</p> 
  <h6>JDOM 主要操作的类:</h6> 
  <p><a href="http://img.e-com-net.com/image/info8/4f81e6ffb7af46e69fa7de1de22a2098.jpg" target="_blank"><img src="http://img.e-com-net.com/image/info8/4f81e6ffb7af46e69fa7de1de22a2098.jpg" alt="XML (可扩展标记语言)_第3张图片" width="650" height="330" style="border:1px solid black;"></a><br>     我们发现 JDOM 的输出操作要比传统的 DOM 方便得多,而且也更加直观,包括在输出的时候都很容易了。此时观察到的是 JDOM 对于 DOM 解析的支持,但是也说,JDOM 本身也支持了 SAX 的特点;所以,可以使用 SAX 进行解析操作。</p> 
  <h6>解析代码:</h6> 
  <pre><code class="prism language-java"><span class="token comment">// 获取SAX解析器</span>
SAXBuilder builder <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">SAXBuilder</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
File file <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">File</span><span class="token punctuation">(</span><span class="token string">"resource/demo01.xml"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 获取文档</span>
Document doc <span class="token operator">=</span> builder<span class="token punctuation">.</span><span class="token function">build</span><span class="token punctuation">(</span><span class="token keyword">new</span> <span class="token class-name">File</span><span class="token punctuation">(</span>file<span class="token punctuation">.</span><span class="token function">getAbsolutePath</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 获取根节点</span>
Element root <span class="token operator">=</span> doc<span class="token punctuation">.</span><span class="token function">getRootElement</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>root<span class="token punctuation">.</span><span class="token function">getName</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 获取根节点下所有的子节点, 也可以根据标签名称获取指定的直接点</span>
List<span class="token generics function"><span class="token punctuation"><</span>Element<span class="token punctuation">></span></span> list <span class="token operator">=</span> root<span class="token punctuation">.</span><span class="token function">getChildren</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>list<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> x <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> x<span class="token operator"><</span>list<span class="token punctuation">.</span><span class="token function">size</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span> x<span class="token operator">++</span><span class="token punctuation">)</span><span class="token punctuation">{</span>
Element e <span class="token operator">=</span> list<span class="token punctuation">.</span><span class="token function">get</span><span class="token punctuation">(</span>x<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 获取元素的名称和里面的文本</span>
String name <span class="token operator">=</span> e<span class="token punctuation">.</span><span class="token function">getName</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span>name <span class="token operator">+</span> <span class="token string">"="</span> <span class="token operator">+</span> e<span class="token punctuation">.</span><span class="token function">getText</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
System<span class="token punctuation">.</span>out<span class="token punctuation">.</span><span class="token function">println</span><span class="token punctuation">(</span><span class="token string">"=================="</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token punctuation">}</span>
</code></pre> 
  <h6>创建代码</h6> 
  <pre><code class="prism language-java"><span class="token comment">// 创建节点</span>
Element person <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Element</span><span class="token punctuation">(</span><span class="token string">"person"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Element name <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Element</span><span class="token punctuation">(</span><span class="token string">"name"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
Element age <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Element</span><span class="token punctuation">(</span><span class="token string">"age"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 创建属性</span>
Attribute id <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Attribute</span><span class="token punctuation">(</span><span class="token string">"id"</span><span class="token punctuation">,</span><span class="token string">"1"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 设置文本</span>
name<span class="token punctuation">.</span><span class="token function">setText</span><span class="token punctuation">(</span><span class="token string">"shsxt"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
age<span class="token punctuation">.</span><span class="token function">setText</span><span class="token punctuation">(</span><span class="token string">"10"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">// 设置关系</span>
Document doc <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">Document</span><span class="token punctuation">(</span>person<span class="token punctuation">)</span><span class="token punctuation">;</span>
person<span class="token punctuation">.</span><span class="token function">addContent</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
name<span class="token punctuation">.</span><span class="token function">setAttribute</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">;</span>
person<span class="token punctuation">.</span><span class="token function">addContent</span><span class="token punctuation">(</span>age<span class="token punctuation">)</span><span class="token punctuation">;</span>
XMLOutputter out <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">XMLOutputter</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
File file <span class="token operator">=</span> <span class="token keyword">new</span> <span class="token class-name">File</span><span class="token punctuation">(</span><span class="token string">"resource/outputjdom.xml"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
out<span class="token punctuation">.</span><span class="token function">output</span><span class="token punctuation">(</span>doc<span class="token punctuation">,</span> <span class="token keyword">new</span> <span class="token class-name">FileOutputStream</span><span class="token punctuation">(</span>file<span class="token punctuation">.</span><span class="token function">getAbsoluteFile</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</code></pre> 
  <br> 
  <br> 
  <h3><font color="blue">七、XPATH</font></h3> 
  <h5>1、XPATH</h5> 
  <p>    XPath 是一门在 XML 文档中查找信息的语言,可用来在 XML 文档中对元素和属性进行遍历。XPath 是 W3C XSLT 标准的主要元素,并且 XQuery 和 XPointer 同时被构建于 XPath 表达之上。因此,对 XPath 的理解是很多高级 XML 应用的基础。XPath非常类似对数据库操作的 SQL 语言,或者说 JQuery,它可以方便开发者抓起文档中需要的东西。(dom4j 也支持 xpath)</p> 
  <h5>2.节点类型</h5> 
  <p>    XPath 中有七种结点类型:元素、属性、文本、命名空间、处理指令、注释以及文档节点 (或称为根节点)。<br>     文档中存在元素节点,属性节点,根节点</p> 
  <h5>3.常用路径表达式</h5> 
  <table> 
   <thead> 
    <tr> 
     <th>表达式</th> 
     <th>描述</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td>节点名称(nodename)</td> 
     <td>选取此节点的所有子节点</td> 
    </tr> 
    <tr> 
     <td>/</td> 
     <td>从根节点选取</td> 
    </tr> 
    <tr> 
     <td>//</td> 
     <td>从匹配选择的当前节点选择文档中的节点,而不考虑它们的位置</td> 
    </tr> 
    <tr> 
     <td>.</td> 
     <td>选取当前节点</td> 
    </tr> 
    <tr> 
     <td>…</td> 
     <td>选取当前节点的父节点</td> 
    </tr> 
    <tr> 
     <td>@</td> 
     <td>选取属性</td> 
    </tr> 
   </tbody> 
  </table> 
  <p><strong>示例如下:</strong><br> //@lang ---- 选取所有名为 lang 的属性</p> 
  <h5>4.限定语</h5> 
  <p>用来查找某个特定的节点或者包含某个指定的值的节点。以方括号括起</p> 
  <pre><code class="prism language-bash">//book<span class="token punctuation">[</span>price<span class="token operator">></span>35.00<span class="token punctuation">]</span> 选择所有 book 元素,且其中的 price 元素的值须大于 35.00
/bookstore/book<span class="token punctuation">[</span>1<span class="token punctuation">]</span> 选取属于 bookstore 子元素的第一个 book 元素。
/bookstore/book<span class="token punctuation">[</span>last<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">]</span> 选取属于 bookstore 子元素的最后一个 book 元素。
/bookstore/book<span class="token punctuation">[</span>last<span class="token punctuation">(</span><span class="token punctuation">)</span>-1<span class="token punctuation">]</span> 选取属于 bookstore 子元素的倒数第二个 book 元素。
/bookstore/book<span class="token punctuation">[</span>position<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token operator"><</span>3<span class="token punctuation">]</span> 选取最前面的两个属于 bookstore 元素的子元素的 book 元素。
//title<span class="token punctuation">[</span>@lang<span class="token punctuation">]</span> 选取所有拥有名为 lang 的属性的 title 元素。
//title<span class="token punctuation">[</span>@lang<span class="token operator">=</span><span class="token string">'eng'</span><span class="token punctuation">]</span> 选取所有 title 元素,且这些元素拥有值为 eng 的 lang 属性。
/bookstore/book<span class="token punctuation">[</span>price<span class="token operator">></span>35.00<span class="token punctuation">]</span> 选取所有 bookstore 元素的 book 元素,且其中的 price
元素的值须大于 35.00。
/bookstore/book<span class="token punctuation">[</span>price<span class="token operator">></span>35.00<span class="token punctuation">]</span>/title 选取所有 bookstore 元素中的 book 元素的 title 元
素,且其中的 price 元素的值须大于 35.00。
</code></pre> 
  <h5>5 .通配符</h5> 
  <table> 
   <thead> 
    <tr> 
     <th>通配符</th> 
     <th>描述</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td>*</td> 
     <td>匹配任何元素节点</td> 
    </tr> 
    <tr> 
     <td>@*</td> 
     <td>匹配任何属性节点</td> 
    </tr> 
    <tr> 
     <td>node()</td> 
     <td>匹配任何类型的节点</td> 
    </tr> 
    <tr> 
     <td><code>|</code></td> 
     <td>选取若干路径</td> 
    </tr> 
   </tbody> 
  </table> 
  <h6>使用示例</h6> 
  <table> 
   <thead> 
    <tr> 
     <th>路径表达式</th> 
     <th>结果</th> 
    </tr> 
   </thead> 
   <tbody> 
    <tr> 
     <td>/bookstore/*</td> 
     <td>选取 bookstore 元素的所有子节点</td> 
    </tr> 
    <tr> 
     <td>//*</td> 
     <td>选取文档中的所有元素</td> 
    </tr> 
    <tr> 
     <td>//title[@*]</td> 
     <td>选取所有带有属性的 title 元素。</td> 
    </tr> 
    <tr> 
     <td>//book/title</td> 
     <td>//book/price</td> 
    </tr> 
    <tr> 
     <td>//title //price</td> 
     <td>选取所有文档中的 title 和 price 元素。</td> 
    </tr> 
    <tr> 
     <td>/bookstore/book/title //price</td> 
     <td>选取所有属于 bookstore 元素的 book 元素的 title 元素,以及文档中所有的 price 元素</td> 
    </tr> 
   </tbody> 
  </table> 
  <br> 
  <br> 
  <h3><font color="blue">八、DTD</font></h3> 
  <p>    使用 DTD 可以对文档的内容进行约束,XML 中的 DTD 数据必须用<!DOCTYPE>标记说明,语法格式如下:</p> 
  <p><strong>XML 的元素内容定义格式如下:</strong></p> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span>ELEMENT 元素内容描述字符串>
</code></pre> 
  <p><strong>DTD 还可以描述子元素的结构,其使用语法:</strong></p> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span>ELEMENT 子元素结构名称 子元素结构表达式>
</code></pre> 
  <p><strong>其中子元素结构有以下几种常用的定义方式:</strong><br> 1.按顺序包括 B、C、D、的所有内容:</p> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span>ELEMENT A<span class="token punctuation">(</span>B<span class="token punctuation">,</span>C<span class="token punctuation">,</span>D<span class="token punctuation">)</span>>
</code></pre> 
  <p>2.在 A 中要包含 B、C、D、的任意一个的内容:</p> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span>ELEMENT A<span class="token punctuation">(</span>B<span class="token punctuation">|</span>C<span class="token punctuation">|</span>D<span class="token punctuation">)</span>>
</code></pre> 
  <p>3.在 A 中包含 0-1 个 B:</p> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span>ELEMENT A<span class="token punctuation">(</span>B?<span class="token punctuation">)</span>>
</code></pre> 
  <p>4.在 A 中要包含 1 次以上各 B:</p> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span>ELEMENT A<span class="token punctuation">(</span>B<span class="token operator">+</span><span class="token punctuation">)</span>>
</code></pre> 
  <p>5.在 A 中要包含 O 次以上各 B:</p> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span>ELEMENT A<span class="token punctuation">(</span>B<span class="token operator">*</span><span class="token punctuation">)</span>>
</code></pre> 
  <p>6.空元素</p> 
  <pre><code class="prism language-powershell"><<span class="token operator">!</span>ELEMENT A EMPTY>
</code></pre> 
  <p><strong>代码示例:</strong></p> 
  <pre><code class="prism language-powershell"><?xml version=<span class="token string">"1.0"</span> encoding=<span class="token string">"UTF-8"</span>?>
<<span class="token operator">!</span>DOCTYPE persons<span class="token punctuation">[</span>
<<span class="token operator">!</span>ELEMENT persons <span class="token punctuation">(</span>person<span class="token operator">+</span><span class="token punctuation">)</span>>
<<span class="token operator">!</span>ELEMENT person <span class="token punctuation">(</span> name <span class="token punctuation">,</span> password? <span class="token punctuation">,</span> age<span class="token operator">+</span><span class="token punctuation">)</span> >
 <<span class="token operator">!</span>ATTLIST person sex <span class="token punctuation">(</span>男<span class="token punctuation">|</span>女<span class="token punctuation">)</span> <span class="token comment">#REQUIRED> </span>
 <<span class="token operator">!</span>ATTLIST person id ID <span class="token comment">#REQUIRED> </span>
 <<span class="token operator">!</span>ELEMENT name <span class="token punctuation">(</span><span class="token comment">#PCDATA)> </span>
 <<span class="token operator">!</span>ELEMENT password <span class="token punctuation">(</span><span class="token comment">#PCDATA)> </span>
 <<span class="token operator">!</span>ELEMENT age <span class="token punctuation">(</span><span class="token comment">#PCDATA)> </span>
<span class="token punctuation">]</span>> 
<persons>
 <person sex=<span class="token string">"男"</span> id=<span class="token string">"p1"</span>> 
 <name><<span class="token operator">/</span>name> 
 <password><<span class="token operator">/</span>password> 
 <age><<span class="token operator">/</span>age> 
 <<span class="token operator">/</span>person>
 <person sex=<span class="token string">"女"</span> id=<span class="token string">"p2"</span>> 
 <name><<span class="token operator">/</span>name> 
 <password><<span class="token operator">/</span>password> 
 <age><<span class="token operator">/</span>age> 
<<span class="token operator">/</span>person> 
<<span class="token operator">/</span>persons> 
</code></pre> 
  <br> 
  <br> 
  <h3><font color="blue">九、schema 简单编写</font></h3> 
  <p>    XML Schema 本身也是一种 XML 构造,它用来描述[哪个元素,在什么时候出现],[该元素具有什么样的属性]等等,也就是说,XML Schema 是对 XML 的树形构造加以描述说明的一种语言。原本,使用 DTD 对 XML 的树形构造加以描述说明,但 DTD 存在严重的局限性,DTD不能定义数据的类型,语法也与 XML 语言完全不一样,在使用的便利性,数据结构表达的严谨性上存在问题。使用 schema 对 xml 格式严格检查。</p> 
  <p><strong>简单的 XML Schema 例</strong><br> <strong>hello.xml</strong></p> 
  <pre><code class="prism language-powershell"><?xml version=<span class="token string">"1.0"</span> encoding=<span class="token string">"UTF-8"</span>?>
<hello xmlns:xsi=<span class="token string">"http://www.w3.org/2001/XMLSchema-instance"</span> 
xsi:noNamespaceSchemaLocation=<span class="token string">"file:///C:/Users/Administrator/Desktop/test.xsd"</span>>xmlschema简单入门 <<span class="token operator">/</span>hello>
</code></pre> 
  <p><strong>写一个简单的 XML Schema</strong></p> 
  <pre><code class="prism language-powershell"><?xml version=<span class="token string">"1.0"</span> encoding=<span class="token string">"UTF-8"</span>?>
<xs:schema xmlns:xs=<span class="token string">"http://www.w3.org/2001/XMLSchema"</span>>
<xs:element name=<span class="token string">"hello"</span> <span class="token function">type</span>=<span class="token string">"xs:string"</span><span class="token operator">/</span>> 
<<span class="token operator">/</span>xs:schema>
</code></pre> 
  <p><strong>解说:</strong></p> 
  <pre><code class="prism language-bash">第一行:
<span class="token operator"><</span>?xml version<span class="token operator">=</span><span class="token string">"1.0"</span> encoding<span class="token operator">=</span><span class="token string">"utf-8"</span>?<span class="token operator">></span>
XML 申明。XML Schema 本身也是 XML 文档,所以它遵循 XML 记述语法。使用 encoding属性指定文档的编码格式。
</code></pre> 
  <pre><code class="prism language-bash">根节点:
<span class="token operator"><</span>xs:schema xmlns:xs<span class="token operator">=</span><span class="token string">"http://www.w3.org/2001/XMLSchema"</span><span class="token operator">></span>
其中 xs 是命名空间,schema 是根节点名。
注意 xs:schema 与 xmlns:xs 中的 xs 要完全一样(名称可以任意,只要一样就可以),它标明以 xs:开头的节点元素是 http://www.w3.org/2001/XMLSchema 定义的元素。
</code></pre> 
  <pre><code class="prism language-bash">element 元素:
<span class="token operator"><</span>xs:element name<span class="token operator">=</span><span class="token string">"hello"</span> type<span class="token operator">=</span><span class="token string">"xs:string"</span><span class="token operator">></span>
上面已经说明,xs:element 表示 element 是 http://www.w3.org/2001/XMLSchema 中定义的元素。它的 name 属性用来定义它所描述的 XML 文档中的节点名。type 是表示该节点的值的类型。这里的 xs:string(string 类型)表示 hello 节点不能包含子节点,不能包含属性,它的内容值应该是 string 类型。除了 string 之外,XML Schema 还有很多其他类型。
</code></pre> 
  <pre><code class="prism language-bash">最后使用
<span class="token operator"><</span>/xs:schema<span class="token operator">></span>
完成整个 XML Schema 描述。
</code></pre> 
 </div> 
</div>
                            </div>
                        </div>
                    </div>
                    <!--PC和WAP自适应版-->
                    <div id="SOHUCS" sid="1754382299232747520"></div>
                    <script type="text/javascript" src="/views/front/js/chanyan.js"></script>
                    <!-- 文章页-底部 动态广告位 -->
                    <div class="youdao-fixed-ad" id="detail_ad_bottom"></div>
                </div>
                <div class="col-md-3">
                    <div class="row" id="ad">
                        <!-- 文章页-右侧1 动态广告位 -->
                        <div id="right-1" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                            <div class="youdao-fixed-ad" id="detail_ad_1"> </div>
                        </div>
                        <!-- 文章页-右侧2 动态广告位 -->
                        <div id="right-2" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                            <div class="youdao-fixed-ad" id="detail_ad_2"></div>
                        </div>
                        <!-- 文章页-右侧3 动态广告位 -->
                        <div id="right-3" class="col-lg-12 col-md-12 col-sm-4 col-xs-4 ad">
                            <div class="youdao-fixed-ad" id="detail_ad_3"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="container">
        <h4 class="pt20 mb15 mt0 border-top">你可能感兴趣的:(web,前端_基础)</h4>
        <div id="paradigm-article-related">
            <div class="recommend-post mb30">
                <ul class="widget-links">
                    <li><a href="/article/1835511912843014144.htm"
                           title="理解Gunicorn:Python WSGI服务器的基石" target="_blank">理解Gunicorn:Python WSGI服务器的基石</a>
                        <span class="text-muted">范范0825</span>
<a class="tag" taget="_blank" href="/search/ipython/1.htm">ipython</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/%E8%BF%90%E7%BB%B4/1.htm">运维</a>
                        <div>理解Gunicorn:PythonWSGI服务器的基石介绍Gunicorn,全称GreenUnicorn,是一个为PythonWSGI(WebServerGatewayInterface)应用设计的高效、轻量级HTTP服务器。作为PythonWeb应用部署的常用工具,Gunicorn以其高性能和易用性著称。本文将介绍Gunicorn的基本概念、安装和配置,帮助初学者快速上手。1.什么是Gunico</div>
                    </li>
                    <li><a href="/article/1835509897106649088.htm"
                           title="Long类型前后端数据不一致" target="_blank">Long类型前后端数据不一致</a>
                        <span class="text-muted">igotyback</span>
<a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a>
                        <div>响应给前端的数据浏览器控制台中response中看到的Long类型的数据是正常的到前端数据不一致前后端数据类型不匹配是一个常见问题,尤其是当后端使用Java的Long类型(64位)与前端JavaScript的Number类型(最大安全整数为2^53-1,即16位)进行数据交互时,很容易出现精度丢失的问题。这是因为JavaScript中的Number类型无法安全地表示超过16位的整数。为了解决这个问</div>
                    </li>
                    <li><a href="/article/1835509643619692544.htm"
                           title="如何在 Fork 的 GitHub 项目中保留自己的修改并同步上游更新?github_fork_update" target="_blank">如何在 Fork 的 GitHub 项目中保留自己的修改并同步上游更新?github_fork_update</a>
                        <span class="text-muted">iBaoxing</span>
<a class="tag" taget="_blank" href="/search/github/1.htm">github</a>
                        <div>如何在Fork的GitHub项目中保留自己的修改并同步上游更新?在GitHub上Fork了一个项目后,你可能会对项目进行一些修改,同时原作者也在不断更新。如果想要在保留自己修改的基础上,同步原作者的最新更新,很多人会不知所措。本文将详细讲解如何在不丢失自己改动的情况下,将上游仓库的更新合并到自己的仓库中。问题描述假设你在GitHub上Fork了一个项目,并基于该项目做了一些修改,随后你发现原作者对</div>
                    </li>
                    <li><a href="/article/1835504217729626112.htm"
                           title="Python教程:一文了解使用Python处理XPath" target="_blank">Python教程:一文了解使用Python处理XPath</a>
                        <span class="text-muted">旦莫</span>
<a class="tag" taget="_blank" href="/search/Python%E8%BF%9B%E9%98%B6/1.htm">Python进阶</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a>
                        <div>目录1.环境准备1.1安装lxml1.2验证安装2.XPath基础2.1什么是XPath?2.2XPath语法2.3示例XML文档3.使用lxml解析XML3.1解析XML文档3.2查看解析结果4.XPath查询4.1基本路径查询4.2使用属性查询4.3查询多个节点5.XPath的高级用法5.1使用逻辑运算符5.2使用函数6.实战案例6.1从网页抓取数据6.1.1安装Requests库6.1.2代</div>
                    </li>
                    <li><a href="/article/1835504218178416640.htm"
                           title="Google earth studio 简介" target="_blank">Google earth studio 简介</a>
                        <span class="text-muted">陟彼高冈yu</span>
<a class="tag" taget="_blank" href="/search/%E6%97%85%E6%B8%B8/1.htm">旅游</a>
                        <div>GoogleEarthStudio是一个基于Web的动画工具,专为创作使用GoogleEarth数据的动画和视频而设计。它利用了GoogleEarth强大的三维地图和卫星影像数据库,使用户能够轻松地创建逼真的地球动画、航拍视频和动态地图可视化。网址为https://www.google.com/earth/studio/。GoogleEarthStudio是一个基于Web的动画工具,专为创作使用G</div>
                    </li>
                    <li><a href="/article/1835502578050363392.htm"
                           title="PHP环境搭建详细教程" target="_blank">PHP环境搭建详细教程</a>
                        <span class="text-muted">好看资源平台</span>
<a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a><a class="tag" taget="_blank" href="/search/php/1.htm">php</a>
                        <div>PHP是一个流行的服务器端脚本语言,广泛用于Web开发。为了使PHP能够在本地或服务器上运行,我们需要搭建一个合适的PHP环境。本教程将结合最新资料,介绍在不同操作系统上搭建PHP开发环境的多种方法,包括Windows、macOS和Linux系统的安装步骤,以及本地和Docker环境的配置。1.PHP环境搭建概述PHP环境的搭建主要分为以下几类:集成开发环境:例如XAMPP、WAMP、MAMP,这</div>
                    </li>
                    <li><a href="/article/1835499615491813376.htm"
                           title="四章-32-点要素的聚合" target="_blank">四章-32-点要素的聚合</a>
                        <span class="text-muted">彩云飘过</span>

                        <div>本文基于腾讯课堂老胡的课《跟我学Openlayers--基础实例详解》做的学习笔记,使用的openlayers5.3.xapi。源码见1032.html,对应的官网示例https://openlayers.org/en/latest/examples/cluster.htmlhttps://openlayers.org/en/latest/examples/earthquake-clusters.</div>
                    </li>
                    <li><a href="/article/1835498925755297792.htm"
                           title="DIV+CSS+JavaScript技术制作网页(旅游主题网页设计与制作)云南大理" target="_blank">DIV+CSS+JavaScript技术制作网页(旅游主题网页设计与制作)云南大理</a>
                        <span class="text-muted">STU学生网页设计</span>
<a class="tag" taget="_blank" href="/search/%E7%BD%91%E9%A1%B5%E8%AE%BE%E8%AE%A1/1.htm">网页设计</a><a class="tag" taget="_blank" href="/search/%E6%9C%9F%E6%9C%AB%E7%BD%91%E9%A1%B5%E4%BD%9C%E4%B8%9A/1.htm">期末网页作业</a><a class="tag" taget="_blank" href="/search/html%E9%9D%99%E6%80%81%E7%BD%91%E9%A1%B5/1.htm">html静态网页</a><a class="tag" taget="_blank" href="/search/html5%E6%9C%9F%E6%9C%AB%E5%A4%A7%E4%BD%9C%E4%B8%9A/1.htm">html5期末大作业</a><a class="tag" taget="_blank" href="/search/%E7%BD%91%E9%A1%B5%E8%AE%BE%E8%AE%A1/1.htm">网页设计</a><a class="tag" taget="_blank" href="/search/web%E5%A4%A7%E4%BD%9C%E4%B8%9A/1.htm">web大作业</a>
                        <div>️精彩专栏推荐作者主页:【进入主页—获取更多源码】web前端期末大作业:【HTML5网页期末作业(1000套)】程序员有趣的告白方式:【HTML七夕情人节表白网页制作(110套)】文章目录二、网站介绍三、网站效果▶️1.视频演示2.图片演示四、网站代码HTML结构代码CSS样式代码五、更多源码二、网站介绍网站布局方面:计划采用目前主流的、能兼容各大主流浏览器、显示效果稳定的浮动网页布局结构。网站程</div>
                    </li>
                    <li><a href="/article/1835498219489030144.htm"
                           title="高端密码学院笔记285" target="_blank">高端密码学院笔记285</a>
                        <span class="text-muted">柚子_b4b4</span>

                        <div>高端幸福密码学院(高级班)幸福使者:李华第(598)期《幸福》之回归内在深层生命原动力基础篇——揭秘“激励”成长的喜悦心理案例分析主讲:刘莉一,知识扩充:成功=艰苦劳动+正确方法+少说空话。贪图省力的船夫,目标永远下游。智者的梦再美,也不如愚人实干的脚印。幸福早课堂2020.10.16星期五一笔记:1,重视和珍惜的前提是知道它的价值非常重要,当你珍惜了,你就真正定下来,真正的学到身上。2,大家需要</div>
                    </li>
                    <li><a href="/article/1835497792265613312.htm"
                           title="【加密社】Solidity 中的事件机制及其应用" target="_blank">【加密社】Solidity 中的事件机制及其应用</a>
                        <span class="text-muted">加密社</span>
<a class="tag" taget="_blank" href="/search/%E9%97%B2%E4%BE%83/1.htm">闲侃</a><a class="tag" taget="_blank" href="/search/%E5%8C%BA%E5%9D%97%E9%93%BE/1.htm">区块链</a><a class="tag" taget="_blank" href="/search/%E6%99%BA%E8%83%BD%E5%90%88%E7%BA%A6/1.htm">智能合约</a><a class="tag" taget="_blank" href="/search/%E5%8C%BA%E5%9D%97%E9%93%BE/1.htm">区块链</a>
                        <div>加密社引言在Solidity合约开发过程中,事件(Events)是一种非常重要的机制。它们不仅能够让开发者记录智能合约的重要状态变更,还能够让外部系统(如前端应用)监听这些状态的变化。本文将详细介绍Solidity中的事件机制以及如何利用不同的手段来触发、监听和获取这些事件。事件存储的地方当我们在Solidity合约中使用emit关键字触发事件时,该事件会被记录在区块链的交易收据中。具体而言,事件</div>
                    </li>
                    <li><a href="/article/1835497710975807488.htm"
                           title="从0到500+,我是如何利用自媒体赚钱?" target="_blank">从0到500+,我是如何利用自媒体赚钱?</a>
                        <span class="text-muted">一列脚印</span>

                        <div>运营公众号半个多月,从零基础的小白到现在慢慢懂了一些运营的知识。做好公众号是很不容易的,要做很多事情;排版、码字、引流…通通需要自己解决,业余时间全都花费在这上面涨这么多粉丝是真的不容易,对比知乎大佬来说,我们这种没资源,没人脉,还没钱的小透明来说,想要一个月涨粉上万,怕是今天没睡醒(不过你有的方法,算我piapia打脸)至少我是清醒的,自己慢慢努力,实现我的万粉目标!大家快来围观、支持我吧!孩子</div>
                    </li>
                    <li><a href="/article/1835497074049773568.htm"
                           title="数组去重" target="_blank">数组去重</a>
                        <span class="text-muted">好奇的猫猫猫</span>

                        <div>整理自js中基础数据结构数组去重问题思考?如何去除数组中重复的项例如数组:[1,3,4,3,5]我们在做去重的时候,一开始想到的肯定是,逐个比较,外面一层循环,内层后一个与前一个一比较,如果是久不将当前这一项放进新的数组,挨个比较完之后返回一个新的去过重复的数组不好的实践方式上述方法效率极低,代码量还多,思考?有没有更好的方法这时候不禁一想当然有了!!!hashtable啊,通过对象的hash办法</div>
                    </li>
                    <li><a href="/article/1835496149843275776.htm"
                           title="关于城市旅游的HTML网页设计——(旅游风景云南 5页)HTML+CSS+JavaScript" target="_blank">关于城市旅游的HTML网页设计——(旅游风景云南 5页)HTML+CSS+JavaScript</a>
                        <span class="text-muted">二挡起步</span>
<a class="tag" taget="_blank" href="/search/web%E5%89%8D%E7%AB%AF%E6%9C%9F%E6%9C%AB%E5%A4%A7%E4%BD%9C%E4%B8%9A/1.htm">web前端期末大作业</a><a class="tag" taget="_blank" href="/search/javascript/1.htm">javascript</a><a class="tag" taget="_blank" href="/search/html/1.htm">html</a><a class="tag" taget="_blank" href="/search/css/1.htm">css</a><a class="tag" taget="_blank" href="/search/%E6%97%85%E6%B8%B8/1.htm">旅游</a><a class="tag" taget="_blank" href="/search/%E9%A3%8E%E6%99%AF/1.htm">风景</a>
                        <div>⛵源码获取文末联系✈Web前端开发技术描述网页设计题材,DIV+CSS布局制作,HTML+CSS网页设计期末课程大作业|游景点介绍|旅游风景区|家乡介绍|等网站的设计与制作|HTML期末大学生网页设计作业,Web大学生网页HTML:结构CSS:样式在操作方面上运用了html5和css3,采用了div+css结构、表单、超链接、浮动、绝对定位、相对定位、字体样式、引用视频等基础知识JavaScrip</div>
                    </li>
                    <li><a href="/article/1835496148601761792.htm"
                           title="HTML网页设计制作大作业(div+css) 云南我的家乡旅游景点 带文字滚动" target="_blank">HTML网页设计制作大作业(div+css) 云南我的家乡旅游景点 带文字滚动</a>
                        <span class="text-muted">二挡起步</span>
<a class="tag" taget="_blank" href="/search/web%E5%89%8D%E7%AB%AF%E6%9C%9F%E6%9C%AB%E5%A4%A7%E4%BD%9C%E4%B8%9A/1.htm">web前端期末大作业</a><a class="tag" taget="_blank" href="/search/web%E8%AE%BE%E8%AE%A1%E7%BD%91%E9%A1%B5%E8%A7%84%E5%88%92%E4%B8%8E%E8%AE%BE%E8%AE%A1/1.htm">web设计网页规划与设计</a><a class="tag" taget="_blank" href="/search/html/1.htm">html</a><a class="tag" taget="_blank" href="/search/css/1.htm">css</a><a class="tag" taget="_blank" href="/search/javascript/1.htm">javascript</a><a class="tag" taget="_blank" href="/search/dreamweaver/1.htm">dreamweaver</a><a class="tag" taget="_blank" href="/search/%E5%89%8D%E7%AB%AF/1.htm">前端</a>
                        <div>Web前端开发技术描述网页设计题材,DIV+CSS布局制作,HTML+CSS网页设计期末课程大作业游景点介绍|旅游风景区|家乡介绍|等网站的设计与制作HTML期末大学生网页设计作业HTML:结构CSS:样式在操作方面上运用了html5和css3,采用了div+css结构、表单、超链接、浮动、绝对定位、相对定位、字体样式、引用视频等基础知识JavaScript:做与用户的交互行为文章目录前端学习路线</div>
                    </li>
                    <li><a href="/article/1835495644123459584.htm"
                           title="Day1笔记-Python简介&标识符和关键字&输入输出" target="_blank">Day1笔记-Python简介&标识符和关键字&输入输出</a>
                        <span class="text-muted">~在杰难逃~</span>
<a class="tag" taget="_blank" href="/search/Python/1.htm">Python</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a><a class="tag" taget="_blank" href="/search/%E5%A4%A7%E6%95%B0%E6%8D%AE/1.htm">大数据</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90/1.htm">数据分析</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E6%8C%96%E6%8E%98/1.htm">数据挖掘</a>
                        <div>大家好,从今天开始呢,杰哥开展一个新的专栏,当然,数据分析部分也会不定时更新的,这个新的专栏主要是讲解一些Python的基础语法和知识,帮助0基础的小伙伴入门和学习Python,感兴趣的小伙伴可以开始认真学习啦!一、Python简介【了解】1.计算机工作原理编程语言就是用来定义计算机程序的形式语言。我们通过编程语言来编写程序代码,再通过语言处理程序执行向计算机发送指令,让计算机完成对应的工作,编程</div>
                    </li>
                    <li><a href="/article/1835495170972413952.htm"
                           title="git - Webhook让部署自动化" target="_blank">git - Webhook让部署自动化</a>
                        <span class="text-muted">大猪大猪</span>

                        <div>我们现在有一个需求,将项目打包上传到gitlab或者github后,程序能自动部署,不用手动地去服务器中进行项目更新并运行,如何做到?这里我们可以使用gitlab与github的挂钩,挂钩的原理就是,每当我们有请求到gitlab与github服务器时,这时他俩会根据我们配置的挂钩地扯进行访问,webhook挂钩程序会一直监听着某个端口请求,一但收到他们发过来的请求,这时就知道用户有请求提交了,这时</div>
                    </li>
                    <li><a href="/article/1835493651992637440.htm"
                           title="大伟说成语之唉声叹气" target="_blank">大伟说成语之唉声叹气</a>
                        <span class="text-muted">求索大伟</span>

                        <div>*大伟说成语*【唉声叹气】叹气:因心里不痛快或不如意而吐出长气,发出声音。因为痛苦、憋闷或感伤而发出叹息的声音。【大伟说】情绪外露,非人类所特有,动物亦有情绪,悲哀和欢乐所表示的情绪亦是不一样的,会嗷嗷大叫也会低吟痛哭。不同的是,人类的情绪更复杂,更多样,更丰富。唉声叹气,可以说是最基础的情绪,因为无奈而举足无措,不知该如何如何化解,只有独自一人慢慢承受,长吁短叹不知如何是好,其实是无能无力的表现</div>
                    </li>
                    <li><a href="/article/1835493626688401408.htm"
                           title="Python快速入门 —— 第三节:类与对象" target="_blank">Python快速入门 —— 第三节:类与对象</a>
                        <span class="text-muted">孤华暗香</span>
<a class="tag" taget="_blank" href="/search/Python%E5%BF%AB%E9%80%9F%E5%85%A5%E9%97%A8/1.htm">Python快速入门</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a>
                        <div>第三节:类与对象目标:了解面向对象编程的基础概念,并学会如何定义类和创建对象。内容:类与对象:定义类:class关键字。类的构造函数:__init__()。类的属性和方法。对象的创建与使用。示例:classStudent:def__init__(self,name,age,major):self.name&#</div>
                    </li>
                    <li><a href="/article/1835493374514262016.htm"
                           title="MongoDB Oplog 窗口" target="_blank">MongoDB Oplog 窗口</a>
                        <span class="text-muted">喝醉酒的小白</span>
<a class="tag" taget="_blank" href="/search/MongoDB/1.htm">MongoDB</a><a class="tag" taget="_blank" href="/search/%E8%BF%90%E7%BB%B4/1.htm">运维</a>
                        <div>在MongoDB中,oplog(操作日志)是一个特殊的日志系统,用于记录对数据库的所有写操作。oplog允许副本集成员(通常是从节点)应用主节点上已经执行的操作,从而保持数据的一致性。它是MongoDB副本集实现数据复制的基础。MongoDBOplog窗口oplog窗口是指在MongoDB副本集中,从节点可以用来同步数据的时间范围。这个窗口通常由以下因素决定:Oplog大小:oplog的大小是有限</div>
                    </li>
                    <li><a href="/article/1835493267907637248.htm"
                           title="webpack图片等资源的处理" target="_blank">webpack图片等资源的处理</a>
                        <span class="text-muted">dmengmeng</span>

                        <div>需要的loaderfile-loader(让我们可以引入这些资源文件)url-loader(其实是file-loader的二次封装)img-loader(处理图片所需要的)在没有使用任何处理图片的loader之前,比如说css中用到了背景图片,那么最后打包会报错的,因为他没办法处理图片。其实你只想能够使用图片的话。只加一个file-loader就可以,打开网页能准确看到图片。{test:/\.(p</div>
                    </li>
                    <li><a href="/article/1835492740536823808.htm"
                           title="node.js学习" target="_blank">node.js学习</a>
                        <span class="text-muted">小猿L</span>
<a class="tag" taget="_blank" href="/search/node.js/1.htm">node.js</a><a class="tag" taget="_blank" href="/search/node.js/1.htm">node.js</a><a class="tag" taget="_blank" href="/search/%E5%AD%A6%E4%B9%A0/1.htm">学习</a><a class="tag" taget="_blank" href="/search/vim/1.htm">vim</a>
                        <div>node.js学习实操及笔记温故node.js,node.js学习实操过程及笔记~node.js学习视频node.js官网node.js中文网实操笔记githubcsdn笔记为什么学node.js可以让别人访问我们编写的网页为后续的框架学习打下基础,三大框架vuereactangular离不开node.jsnode.js是什么官网:node.js是一个开源的、跨平台的运行JavaScript的运行</div>
                    </li>
                    <li><a href="/article/1835491101276991488.htm"
                           title="数据仓库——维度表一致性" target="_blank">数据仓库——维度表一致性</a>
                        <span class="text-muted">墨染丶eye</span>
<a class="tag" taget="_blank" href="/search/%E8%83%8C%E8%AF%B5/1.htm">背诵</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E4%BB%93%E5%BA%93/1.htm">数据仓库</a>
                        <div>数据仓库基础笔记思维导图已经整理完毕,完整连接为:数据仓库基础知识笔记思维导图维度一致性问题从逻辑层面来看,当一系列星型模型共享一组公共维度时,所涉及的维度称为一致性维度。当维度表存在不一致时,短期的成功难以弥补长期的错误。维度时确保不同过程中信息集成起来实现横向钻取货活动的关键。造成横向钻取失败的原因维度结构的差别,因为维度的差别,分析工作涉及的领域从简单到复杂,但是都是通过复杂的报表来弥补设计</div>
                    </li>
                    <li><a href="/article/1835490471032483840.htm"
                           title="高级 ECharts 技巧:自定义图表主题与样式" target="_blank">高级 ECharts 技巧:自定义图表主题与样式</a>
                        <span class="text-muted">SnowMan1993</span>
<a class="tag" taget="_blank" href="/search/echarts/1.htm">echarts</a><a class="tag" taget="_blank" href="/search/%E4%BF%A1%E6%81%AF%E5%8F%AF%E8%A7%86%E5%8C%96/1.htm">信息可视化</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E5%88%86%E6%9E%90/1.htm">数据分析</a>
                        <div>ECharts是一个强大的数据可视化库,提供了多种内置主题和样式,但你也可以根据项目的设计需求,自定义图表的主题与样式。本文将介绍如何使用ECharts自定义图表主题,以提升数据可视化的吸引力和一致性。1.什么是ECharts主题?ECharts的主题是指定义图表样式的配置项,包括颜色、字体、线条样式等。通过预设主题,你可以快速更改图表的整体风格,而自定义主题则允许你在此基础上进行个性化设置。2.</div>
                    </li>
                    <li><a href="/article/1835490218409553920.htm"
                           title="01-Git初识" target="_blank">01-Git初识</a>
                        <span class="text-muted">Meereen</span>
<a class="tag" taget="_blank" href="/search/Git/1.htm">Git</a><a class="tag" taget="_blank" href="/search/git/1.htm">git</a>
                        <div>01-Git初识概念:一个免费开源,分布式的代码版本控制系统,帮助开发团队维护代码作用:记录代码内容。切换代码版本,多人开发时高效合并代码内容如何学:个人本机使用:Git基础命令和概念多人共享使用:团队开发同一个项目的代码版本管理Git配置用户信息配置:用户名和邮箱,应用在每次提交代码版本时表明自己的身份命令:查看git版本号git-v配置用户名gitconfig--globaluser.name</div>
                    </li>
                    <li><a href="/article/1835489587498151936.htm"
                           title="ARM驱动学习之基础小知识" target="_blank">ARM驱动学习之基础小知识</a>
                        <span class="text-muted">JT灬新一</span>
<a class="tag" taget="_blank" href="/search/ARM/1.htm">ARM</a><a class="tag" taget="_blank" href="/search/%E5%B5%8C%E5%85%A5%E5%BC%8F/1.htm">嵌入式</a><a class="tag" taget="_blank" href="/search/arm%E5%BC%80%E5%8F%91/1.htm">arm开发</a><a class="tag" taget="_blank" href="/search/%E5%AD%A6%E4%B9%A0/1.htm">学习</a>
                        <div>ARM驱动学习之基础小知识•sch原理图工程师工作内容–方案–元器件选型–采购(能不能买到,价格)–原理图(涉及到稳定性)•layout画板工程师–layout(封装、布局,布线,log)(涉及到稳定性)–焊接的一部分工作(调试阶段板子的焊接)•驱动工程师–驱动,原理图,layout三部分的交集容易发生矛盾•PCB研发流程介绍–方案,原理图(网表)–layout工程师(gerber文件)–PCB板</div>
                    </li>
                    <li><a href="/article/1835489208152715264.htm"
                           title="Rust基础知识" target="_blank">Rust基础知识</a>
                        <span class="text-muted">GRKF15</span>
<a class="tag" taget="_blank" href="/search/rust/1.htm">rust</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a><a class="tag" taget="_blank" href="/search/%E5%90%8E%E7%AB%AF/1.htm">后端</a>
                        <div>1.Rust语言简介1.1基础语法变量声明:let关键字用于声明变量,可以指定或不指定类型,如leta=10;和letmutc=30i32;。函数定义:使用fn关键字定义函数,并指定参数类型及返回类型,如fnadd(i:i32,j:i32)->i32{i+j}。控制流:包括if、else等,控制语句后需要使用;来结束语句。1.2数据类型整数类型:i8、i16、i32、i64、i128,以及无符号的</div>
                    </li>
                    <li><a href="/article/1835484420023349248.htm"
                           title="18、架构-可观测性之聚合度量" target="_blank">18、架构-可观测性之聚合度量</a>
                        <span class="text-muted">大树~~</span>
<a class="tag" taget="_blank" href="/search/%E6%9E%B6%E6%9E%84/1.htm">架构</a><a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E5%90%8E%E7%AB%AF/1.htm">后端</a><a class="tag" taget="_blank" href="/search/%E6%9E%B6%E6%9E%84/1.htm">架构</a>
                        <div>聚合度量聚合度量是指对系统运行时产生的各种指标数据进行收集、聚合和分析,以了解系统的健康状况和性能表现。聚合度量是可观测性的关键组成部分,通过对度量数据的分析,可以及时发现系统中的异常和瓶颈。以下是对聚合度量各个方面的详细解析,并结合具体的数据案例和技术支撑。指标收集收集系统运行时产生的各种指标数据是聚合度量的基础。常见的指标包括CPU使用率、内存使用率、请求处理时间、请求数、错误率等。以下是指标</div>
                    </li>
                    <li><a href="/article/1835476983614631936.htm"
                           title="Python开发常用的三方模块如下:" target="_blank">Python开发常用的三方模块如下:</a>
                        <span class="text-muted">换个网名有点难</span>
<a class="tag" taget="_blank" href="/search/python/1.htm">python</a><a class="tag" taget="_blank" href="/search/%E5%BC%80%E5%8F%91%E8%AF%AD%E8%A8%80/1.htm">开发语言</a>
                        <div>Python是一门功能强大的编程语言,拥有丰富的第三方库,这些库为开发者提供了极大的便利。以下是100个常用的Python库,涵盖了多个领域:1、NumPy,用于科学计算的基础库。2、Pandas,提供数据结构和数据分析工具。3、Matplotlib,一个绘图库。4、Scikit-learn,机器学习库。5、SciPy,用于数学、科学和工程的库。6、TensorFlow,由Google开发的开源机</div>
                    </li>
                    <li><a href="/article/1835476350190841856.htm"
                           title="ExpRe[25] bash外的其它shell:zsh和fish" target="_blank">ExpRe[25] bash外的其它shell:zsh和fish</a>
                        <span class="text-muted">tritone</span>
<a class="tag" taget="_blank" href="/search/ExpRe/1.htm">ExpRe</a><a class="tag" taget="_blank" href="/search/bash/1.htm">bash</a><a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/ubuntu/1.htm">ubuntu</a><a class="tag" taget="_blank" href="/search/shell/1.htm">shell</a>
                        <div>文章目录zsh基础配置实用特性插件`autojump`语法高亮自动补全fish优点缺点时效性本篇撰写时间为2021.12.15,由于计算机技术日新月异,博客中所有内容都有时效和版本限制,具体做法不一定总行得通,链接可能改动失效,各种软件的用法可能有修改。但是其中透露的思想往往是值得学习的。本篇前置:ExpRe[10]Ubuntu[2]准备神秘软件、备份恢复软件https://www.cnblogs</div>
                    </li>
                    <li><a href="/article/1835473957185220608.htm"
                           title="网络编程基础" target="_blank">网络编程基础</a>
                        <span class="text-muted">记得开心一点啊</span>
<a class="tag" taget="_blank" href="/search/%E7%BD%91%E7%BB%9C/1.htm">网络</a>
                        <div>目录♫什么是网络编程♫Socket套接字♪什么是Socket套接字♪数据报套接字♪流套接字♫数据报套接字通信模型♪数据报套接字通讯模型♪DatagramSocket♪DatagramPacket♪实现UDP的服务端代码♪实现UDP的客户端代码♫流套接字通信模型♪流套接字通讯模型♪ServerSocket♪Socket♪实现TCP的服务端代码♪实现TCP的客户端代码♫什么是网络编程网络编程,指网络上</div>
                    </li>
                                <li><a href="/article/54.htm"
                                       title="JAVA中的Enum" target="_blank">JAVA中的Enum</a>
                                    <span class="text-muted">周凡杨</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/enum/1.htm">enum</a><a class="tag" taget="_blank" href="/search/%E6%9E%9A%E4%B8%BE/1.htm">枚举</a>
                                    <div>Enum是计算机编程语言中的一种数据类型---枚举类型。 在实际问题中,有些变量的取值被限定在一个有限的范围内。       例如,一个星期内只有七天 我们通常这样实现上面的定义: 
public String monday;
public String tuesday;
public String wensday;
public String thursday</div>
                                </li>
                                <li><a href="/article/181.htm"
                                       title="赶集网mysql开发36条军规" target="_blank">赶集网mysql开发36条军规</a>
                                    <span class="text-muted">Bill_chen</span>
<a class="tag" taget="_blank" href="/search/mysql/1.htm">mysql</a><a class="tag" taget="_blank" href="/search/%E4%B8%9A%E5%8A%A1%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1/1.htm">业务架构设计</a><a class="tag" taget="_blank" href="/search/mysql%E8%B0%83%E4%BC%98/1.htm">mysql调优</a><a class="tag" taget="_blank" href="/search/mysql%E6%80%A7%E8%83%BD%E4%BC%98%E5%8C%96/1.htm">mysql性能优化</a>
                                    <div>(一)核心军规   (1)不在数据库做运算      cpu计算务必移至业务层;   (2)控制单表数据量      int型不超过1000w,含char则不超过500w;      合理分表;      限制单库表数量在300以内;   (3)控制列数量      字段少而精,字段数建议在20以内</div>
                                </li>
                                <li><a href="/article/308.htm"
                                       title="Shell test命令" target="_blank">Shell test命令</a>
                                    <span class="text-muted">daizj</span>
<a class="tag" taget="_blank" href="/search/shell/1.htm">shell</a><a class="tag" taget="_blank" href="/search/%E5%AD%97%E7%AC%A6%E4%B8%B2/1.htm">字符串</a><a class="tag" taget="_blank" href="/search/test/1.htm">test</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E5%AD%97/1.htm">数字</a><a class="tag" taget="_blank" href="/search/%E6%96%87%E4%BB%B6%E6%AF%94%E8%BE%83/1.htm">文件比较</a>
                                    <div>Shell test命令 
Shell中的 test 命令用于检查某个条件是否成立,它可以进行数值、字符和文件三个方面的测试。  数值测试    参数 说明   -eq 等于则为真   -ne 不等于则为真   -gt 大于则为真   -ge 大于等于则为真   -lt 小于则为真   -le 小于等于则为真    
实例演示: 
num1=100
num2=100if test $[num1]</div>
                                </li>
                                <li><a href="/article/435.htm"
                                       title="XFire框架实现WebService(二)" target="_blank">XFire框架实现WebService(二)</a>
                                    <span class="text-muted">周凡杨</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/webservice/1.htm">webservice</a>
                                    <div>   有了XFire框架实现WebService(一),就可以继续开发WebService的简单应用。 
Webservice的服务端(WEB工程): 
两个java bean类: 
Course.java 
   package cn.com.bean; 
public class Course { 
    private </div>
                                </li>
                                <li><a href="/article/562.htm"
                                       title="重绘之画图板" target="_blank">重绘之画图板</a>
                                    <span class="text-muted">朱辉辉33</span>
<a class="tag" taget="_blank" href="/search/%E7%94%BB%E5%9B%BE%E6%9D%BF/1.htm">画图板</a>
                                    <div>       上次博客讲的五子棋重绘比较简单,因为只要在重写系统重绘方法paint()时加入棋盘和棋子的绘制。这次我想说说画图板的重绘。 
       画图板重绘难在需要重绘的类型很多,比如说里面有矩形,园,直线之类的,所以我们要想办法将里面的图形加入一个队列中,这样在重绘时就</div>
                                </li>
                                <li><a href="/article/689.htm"
                                       title="Java的IO流" target="_blank">Java的IO流</a>
                                    <span class="text-muted">西蜀石兰</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a>
                                    <div>刚学Java的IO流时,被各种inputStream流弄的很迷糊,看老罗视频时说想象成插在文件上的一根管道,当初听时觉得自己很明白,可到自己用时,有不知道怎么代码了。。。 
每当遇到这种问题时,我习惯性的从头开始理逻辑,会问自己一些很简单的问题,把这些简单的问题想明白了,再看代码时才不会迷糊。 
 
IO流作用是什么? 
答:实现对文件的读写,这里的文件是广义的; 
 
Java如何实现程序到文件</div>
                                </li>
                                <li><a href="/article/816.htm"
                                       title="No matching PlatformTransactionManager bean found for qualifier 'add' - neither" target="_blank">No matching PlatformTransactionManager bean found for qualifier 'add' - neither</a>
                                    <span class="text-muted">林鹤霄</span>

                                    <div>java.lang.IllegalStateException: No matching PlatformTransactionManager bean found for qualifier 'add' - neither qualifier match nor bean name match! 
  
网上找了好多的资料没能解决,后来发现:项目中使用的是xml配置的方式配置事务,但是</div>
                                </li>
                                <li><a href="/article/943.htm"
                                       title="Row size too large (> 8126). Changing some columns to TEXT or BLOB" target="_blank">Row size too large (> 8126). Changing some columns to TEXT or BLOB</a>
                                    <span class="text-muted">aigo</span>
<a class="tag" taget="_blank" href="/search/column/1.htm">column</a>
                                    <div>原文:http://stackoverflow.com/questions/15585602/change-limit-for-mysql-row-size-too-large 
  
异常信息: 
Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAM</div>
                                </li>
                                <li><a href="/article/1070.htm"
                                       title="JS 格式化时间" target="_blank">JS 格式化时间</a>
                                    <span class="text-muted">alxw4616</span>
<a class="tag" taget="_blank" href="/search/JavaScript/1.htm">JavaScript</a>
                                    <div>/**
 * 格式化时间 2013/6/13 by 半仙 alxw4616@msn.com
 * 需要 pad 函数
 * 接收可用的时间值.
 * 返回替换时间占位符后的字符串
 *
 * 时间占位符:年 Y 月 M 日 D 小时 h 分 m 秒 s 重复次数表示占位数
 * 如 YYYY 4占4位 YY 占2位<p></p>
 * MM DD hh mm</div>
                                </li>
                                <li><a href="/article/1197.htm"
                                       title="队列中数据的移除问题" target="_blank">队列中数据的移除问题</a>
                                    <span class="text-muted">百合不是茶</span>
<a class="tag" taget="_blank" href="/search/%E9%98%9F%E5%88%97%E7%A7%BB%E9%99%A4/1.htm">队列移除</a>
                                    <div>  
   队列的移除一般都是使用的remov();都可以移除的,但是在昨天做线程移除的时候出现了点问题,没有将遍历出来的全部移除,  代码如下; 
  
   // 
package com.Thread0715.com;

import java.util.ArrayList;

public class Threa</div>
                                </li>
                                <li><a href="/article/1324.htm"
                                       title="Runnable接口使用实例" target="_blank">Runnable接口使用实例</a>
                                    <span class="text-muted">bijian1013</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/thread/1.htm">thread</a><a class="tag" taget="_blank" href="/search/Runnable/1.htm">Runnable</a><a class="tag" taget="_blank" href="/search/java%E5%A4%9A%E7%BA%BF%E7%A8%8B/1.htm">java多线程</a>
                                    <div>Runnable接口 
a.       该接口只有一个方法:public void run(); 
b.       实现该接口的类必须覆盖该run方法 
c.       实现了Runnable接口的类并不具有任何天</div>
                                </li>
                                <li><a href="/article/1451.htm"
                                       title="oracle里的extend详解" target="_blank">oracle里的extend详解</a>
                                    <span class="text-muted">bijian1013</span>
<a class="tag" taget="_blank" href="/search/oracle/1.htm">oracle</a><a class="tag" taget="_blank" href="/search/%E6%95%B0%E6%8D%AE%E5%BA%93/1.htm">数据库</a><a class="tag" taget="_blank" href="/search/extend/1.htm">extend</a>
                                    <div>扩展已知的数组空间,例: 
DECLARE
  TYPE CourseList IS TABLE OF VARCHAR2(10);
  courses CourseList;
BEGIN
  --   初始化数组元素,大小为3
  courses := CourseList('Biol   4412 ', 'Psyc   3112 ', 'Anth   3001 ');
  --   </div>
                                </li>
                                <li><a href="/article/1578.htm"
                                       title="【httpclient】httpclient发送表单POST请求" target="_blank">【httpclient】httpclient发送表单POST请求</a>
                                    <span class="text-muted">bit1129</span>
<a class="tag" taget="_blank" href="/search/httpclient/1.htm">httpclient</a>
                                    <div>浏览器Form Post请求 
浏览器可以通过提交表单的方式向服务器发起POST请求,这种形式的POST请求不同于一般的POST请求 
1. 一般的POST请求,将请求数据放置于请求体中,服务器端以二进制流的方式读取数据,HttpServletRequest.getInputStream()。这种方式的请求可以处理任意数据形式的POST请求,比如请求数据是字符串或者是二进制数据 
2. Form </div>
                                </li>
                                <li><a href="/article/1705.htm"
                                       title="【Hive十三】Hive读写Avro格式的数据" target="_blank">【Hive十三】Hive读写Avro格式的数据</a>
                                    <span class="text-muted">bit1129</span>
<a class="tag" taget="_blank" href="/search/hive/1.htm">hive</a>
                                    <div> 1. 原始数据 
hive> select * from word; 
OK
1	MSN  
10	QQ  
100	Gtalk  
1000	Skype  
  
  
 2. 创建avro格式的数据表 
  
hive> CREATE TABLE avro_table(age INT, name STRING)STORE</div>
                                </li>
                                <li><a href="/article/1832.htm"
                                       title="nginx+lua+redis自动识别封解禁频繁访问IP" target="_blank">nginx+lua+redis自动识别封解禁频繁访问IP</a>
                                    <span class="text-muted">ronin47</span>

                                    <div>在站点遇到攻击且无明显攻击特征,造成站点访问慢,nginx不断返回502等错误时,可利用nginx+lua+redis实现在指定的时间段 内,若单IP的请求量达到指定的数量后对该IP进行封禁,nginx返回403禁止访问。利用redis的expire命令设置封禁IP的过期时间达到在 指定的封禁时间后实行自动解封的目的。 
一、安装环境: 
 
 CentOS x64 release 6.4(Fin</div>
                                </li>
                                <li><a href="/article/1959.htm"
                                       title="java-二叉树的遍历-先序、中序、后序(递归和非递归)、层次遍历" target="_blank">java-二叉树的遍历-先序、中序、后序(递归和非递归)、层次遍历</a>
                                    <span class="text-muted">bylijinnan</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a>
                                    <div>
import java.util.LinkedList;
import java.util.List;
import java.util.Stack;


public class BinTreeTraverse {
	//private int[] array={ 1, 2, 3, 4, 5, 6, 7, 8, 9 };
	private int[] array={ 10,6,</div>
                                </li>
                                <li><a href="/article/2086.htm"
                                       title="Spring源码学习-XML 配置方式的IoC容器启动过程分析" target="_blank">Spring源码学习-XML 配置方式的IoC容器启动过程分析</a>
                                    <span class="text-muted">bylijinnan</span>
<a class="tag" taget="_blank" href="/search/java/1.htm">java</a><a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/IOC/1.htm">IOC</a>
                                    <div>以FileSystemXmlApplicationContext为例,把Spring IoC容器的初始化流程走一遍: 
 

ApplicationContext context = new FileSystemXmlApplicationContext
            ("C:/Users/ZARA/workspace/HelloSpring/src/Beans.xml&q</div>
                                </li>
                                <li><a href="/article/2213.htm"
                                       title="[科研与项目]民营企业请慎重参与军事科技工程" target="_blank">[科研与项目]民营企业请慎重参与军事科技工程</a>
                                    <span class="text-muted">comsci</span>
<a class="tag" taget="_blank" href="/search/%E4%BC%81%E4%B8%9A/1.htm">企业</a>
                                    <div> 
 
     军事科研工程和项目 并非要用最先进,最时髦的技术,而是要做到“万无一失” 
 
   而民营科技企业在搞科技创新工程的时候,往往考虑的是技术的先进性,而对先进技术带来的风险考虑得不够,在今天提倡军民融合发展的大环境下,这种“万无一失”和“时髦性”的矛盾会日益凸显。。。。。。所以请大家在参与任何重大的军事和政府项目之前,对</div>
                                </li>
                                <li><a href="/article/2340.htm"
                                       title="spring 定时器-两种方式" target="_blank">spring 定时器-两种方式</a>
                                    <span class="text-muted">cuityang</span>
<a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a><a class="tag" taget="_blank" href="/search/quartz/1.htm">quartz</a><a class="tag" taget="_blank" href="/search/%E5%AE%9A%E6%97%B6%E5%99%A8/1.htm">定时器</a>
                                    <div>方式一: 
间隔一定时间 运行 
 
<bean id="updateSessionIdTask" class="com.yang.iprms.common.UpdateSessionTask" autowire="byName" /> 
 
 <bean id="updateSessionIdSchedule</div>
                                </li>
                                <li><a href="/article/2467.htm"
                                       title="简述一下关于BroadView站点的相关设计" target="_blank">简述一下关于BroadView站点的相关设计</a>
                                    <span class="text-muted">damoqiongqiu</span>
<a class="tag" taget="_blank" href="/search/view/1.htm">view</a>
                                    <div>终于弄上线了,累趴,戳这里http://www.broadview.com.cn 
  
简述一下相关的技术点 
  
前端:jQuery+BootStrap3.2+HandleBars,全站Ajax(貌似对SEO的影响很大啊!怎么破?),用Grunt对全部JS做了压缩处理,对部分JS和CSS做了合并(模块间存在很多依赖,全部合并比较繁琐,待完善)。 
  
后端:U</div>
                                </li>
                                <li><a href="/article/2594.htm"
                                       title="运维 PHP问题汇总" target="_blank">运维 PHP问题汇总</a>
                                    <span class="text-muted">dcj3sjt126com</span>
<a class="tag" taget="_blank" href="/search/windows2003/1.htm">windows2003</a>
                                    <div>1、Dede(织梦)发表文章时,内容自动添加关键字显示空白页 
解决方法: 
后台>系统>系统基本参数>核心设置>关键字替换(是/否),这里选择“是”。 
后台>系统>系统基本参数>其他选项>自动提取关键字,这里选择“是”。 
  
2、解决PHP168超级管理员上传图片提示你的空间不足 
网站是用PHP168做的,反映使用管理员在后台无法</div>
                                </li>
                                <li><a href="/article/2721.htm"
                                       title="mac 下 安装php扩展 - mcrypt" target="_blank">mac 下 安装php扩展 - mcrypt</a>
                                    <span class="text-muted">dcj3sjt126com</span>
<a class="tag" taget="_blank" href="/search/PHP/1.htm">PHP</a>
                                    <div>MCrypt是一个功能强大的加密算法扩展库,它包括有22种算法,phpMyAdmin依赖这个PHP扩展,具体如下: 
 
  
  下载并解压libmcrypt-2.5.8.tar.gz。 
  在终端执行如下命令:  tar zxvf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8/ ./configure --disable-posix-threads --</div>
                                </li>
                                <li><a href="/article/2848.htm"
                                       title="MongoDB更新文档 [四]" target="_blank">MongoDB更新文档 [四]</a>
                                    <span class="text-muted">eksliang</span>
<a class="tag" taget="_blank" href="/search/mongodb/1.htm">mongodb</a><a class="tag" taget="_blank" href="/search/Mongodb%E6%9B%B4%E6%96%B0%E6%96%87%E6%A1%A3/1.htm">Mongodb更新文档</a>
                                    <div>MongoDB更新文档 
转载请出自出处:http://eksliang.iteye.com/blog/2174104 
MongoDB对文档的CURD,前面的博客简单介绍了,但是对文档更新篇幅比较大,所以这里单独拿出来。 
语法结构如下: 
db.collection.update( criteria, objNew, upsert, multi) 
参数含义    参数   </div>
                                </li>
                                <li><a href="/article/2975.htm"
                                       title="Linux下的解压,移除,复制,查看tomcat命令" target="_blank">Linux下的解压,移除,复制,查看tomcat命令</a>
                                    <span class="text-muted">y806839048</span>
<a class="tag" taget="_blank" href="/search/tomcat/1.htm">tomcat</a>
                                    <div>重复myeclipse生成webservice有问题删除以前的,干净 
 
 1、先切换到:cd usr/local/tomcat5/logs 
 
2、tail -f catalina.out 
 
3、这样运行时就可以实时查看运行日志了 
 
 
 
 
Ctrl+c 是退出tail命令。 
 有问题不明的先注掉 
   cp /opt/tomcat-6.0.44/webapps/g</div>
                                </li>
                                <li><a href="/article/3102.htm"
                                       title="Spring之使用事务缘由(3-XML实现)" target="_blank">Spring之使用事务缘由(3-XML实现)</a>
                                    <span class="text-muted">ihuning</span>
<a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a>
                                    <div>  
用事务通知声明式地管理事务 
  
事务管理是一种横切关注点。为了在 Spring 2.x 中启用声明式事务管理,可以通过 tx Schema 中定义的 <tx:advice> 元素声明事务通知,为此必须事先将这个 Schema 定义添加到 <beans> 根元素中去。声明了事务通知后,就需要将它与切入点关联起来。由于事务通知是在 <aop:</div>
                                </li>
                                <li><a href="/article/3229.htm"
                                       title="GCD使用经验与技巧浅谈" target="_blank">GCD使用经验与技巧浅谈</a>
                                    <span class="text-muted">啸笑天</span>
<a class="tag" taget="_blank" href="/search/GC/1.htm">GC</a>
                                    <div>前言 
GCD(Grand Central Dispatch)可以说是Mac、iOS开发中的一大“利器”,本文就总结一些有关使用GCD的经验与技巧。 
dispatch_once_t必须是全局或static变量 
这一条算是“老生常谈”了,但我认为还是有必要强调一次,毕竟非全局或非static的dispatch_once_t变量在使用时会导致非常不好排查的bug,正确的如下:        1  </div>
                                </li>
                                <li><a href="/article/3356.htm"
                                       title="linux(Ubuntu)下常用命令备忘录1" target="_blank">linux(Ubuntu)下常用命令备忘录1</a>
                                    <span class="text-muted">macroli</span>
<a class="tag" taget="_blank" href="/search/linux/1.htm">linux</a><a class="tag" taget="_blank" href="/search/%E5%B7%A5%E4%BD%9C/1.htm">工作</a><a class="tag" taget="_blank" href="/search/ubuntu/1.htm">ubuntu</a>
                                    <div>在使用下面的命令是可以通过--help来获取更多的信息1,查询当前目录文件列表:ls 
 
 ls命令默认状态下将按首字母升序列出你当前文件夹下面的所有内容,但这样直接运行所得到的信息也是比较少的,通常它可以结合以下这些参数运行以查询更多的信息:  
 ls / 显示/.下的所有文件和目录  
 ls -l 给出文件或者文件夹的详细信息 
 ls -a 显示所有文件,包括隐藏文</div>
                                </li>
                                <li><a href="/article/3483.htm"
                                       title="nodejs同步操作mysql" target="_blank">nodejs同步操作mysql</a>
                                    <span class="text-muted">qiaolevip</span>
<a class="tag" taget="_blank" href="/search/%E5%AD%A6%E4%B9%A0%E6%B0%B8%E6%97%A0%E6%AD%A2%E5%A2%83/1.htm">学习永无止境</a><a class="tag" taget="_blank" href="/search/%E6%AF%8F%E5%A4%A9%E8%BF%9B%E6%AD%A5%E4%B8%80%E7%82%B9%E7%82%B9/1.htm">每天进步一点点</a><a class="tag" taget="_blank" href="/search/mysql/1.htm">mysql</a><a class="tag" taget="_blank" href="/search/nodejs/1.htm">nodejs</a>
                                    <div>// db-util.js
var mysql = require('mysql');
var pool = mysql.createPool({
  connectionLimit : 10,
  host: 'localhost',
  user: 'root',
  password: '',
  database: 'test',
  port: 3306
});

</div>
                                </li>
                                <li><a href="/article/3610.htm"
                                       title="一起学Hive系列文章" target="_blank">一起学Hive系列文章</a>
                                    <span class="text-muted">superlxw1234</span>
<a class="tag" taget="_blank" href="/search/hive/1.htm">hive</a><a class="tag" taget="_blank" href="/search/Hive%E5%85%A5%E9%97%A8/1.htm">Hive入门</a>
                                    <div>  
[一起学Hive]系列文章 目录贴,入门Hive,持续更新中。 
  
[一起学Hive]之一—Hive概述,Hive是什么 
[一起学Hive]之二—Hive函数大全-完整版 
[一起学Hive]之三—Hive中的数据库(Database)和表(Table) 
[一起学Hive]之四-Hive的安装配置 
[一起学Hive]之五-Hive的视图和分区 
[一起学Hive</div>
                                </li>
                                <li><a href="/article/3737.htm"
                                       title="Spring开发利器:Spring Tool Suite 3.7.0 发布" target="_blank">Spring开发利器:Spring Tool Suite 3.7.0 发布</a>
                                    <span class="text-muted">wiselyman</span>
<a class="tag" taget="_blank" href="/search/spring/1.htm">spring</a>
                                    <div>Spring Tool Suite(简称STS)是基于Eclipse,专门针对Spring开发者提供大量的便捷功能的优秀开发工具。 
  
在3.7.0版本主要做了如下的更新: 
  
 
 将eclipse版本更新至Eclipse Mars 4.5 GA 
 Spring Boot(JavaEE开发的颠覆者集大成者,推荐大家学习)的配置语言YAML编辑器的支持(包含自动提示,</div>
                                </li>
                </ul>
            </div>
        </div>
    </div>

<div>
    <div class="container">
        <div class="indexes">
            <strong>按字母分类:</strong>
            <a href="/tags/A/1.htm" target="_blank">A</a><a href="/tags/B/1.htm" target="_blank">B</a><a href="/tags/C/1.htm" target="_blank">C</a><a
                href="/tags/D/1.htm" target="_blank">D</a><a href="/tags/E/1.htm" target="_blank">E</a><a href="/tags/F/1.htm" target="_blank">F</a><a
                href="/tags/G/1.htm" target="_blank">G</a><a href="/tags/H/1.htm" target="_blank">H</a><a href="/tags/I/1.htm" target="_blank">I</a><a
                href="/tags/J/1.htm" target="_blank">J</a><a href="/tags/K/1.htm" target="_blank">K</a><a href="/tags/L/1.htm" target="_blank">L</a><a
                href="/tags/M/1.htm" target="_blank">M</a><a href="/tags/N/1.htm" target="_blank">N</a><a href="/tags/O/1.htm" target="_blank">O</a><a
                href="/tags/P/1.htm" target="_blank">P</a><a href="/tags/Q/1.htm" target="_blank">Q</a><a href="/tags/R/1.htm" target="_blank">R</a><a
                href="/tags/S/1.htm" target="_blank">S</a><a href="/tags/T/1.htm" target="_blank">T</a><a href="/tags/U/1.htm" target="_blank">U</a><a
                href="/tags/V/1.htm" target="_blank">V</a><a href="/tags/W/1.htm" target="_blank">W</a><a href="/tags/X/1.htm" target="_blank">X</a><a
                href="/tags/Y/1.htm" target="_blank">Y</a><a href="/tags/Z/1.htm" target="_blank">Z</a><a href="/tags/0/1.htm" target="_blank">其他</a>
        </div>
    </div>
</div>
<footer id="footer" class="mb30 mt30">
    <div class="container">
        <div class="footBglm">
            <a target="_blank" href="/">首页</a> -
            <a target="_blank" href="/custom/about.htm">关于我们</a> -
            <a target="_blank" href="/search/Java/1.htm">站内搜索</a> -
            <a target="_blank" href="/sitemap.txt">Sitemap</a> -
            <a target="_blank" href="/custom/delete.htm">侵权投诉</a>
        </div>
        <div class="copyright">版权所有 IT知识库 CopyRight © 2000-2050 E-COM-NET.COM , All Rights Reserved.
<!--            <a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">京ICP备09083238号</a><br>-->
        </div>
    </div>
</footer>
<!-- 代码高亮 -->
<script type="text/javascript" src="/static/syntaxhighlighter/scripts/shCore.js"></script>
<script type="text/javascript" src="/static/syntaxhighlighter/scripts/shLegacy.js"></script>
<script type="text/javascript" src="/static/syntaxhighlighter/scripts/shAutoloader.js"></script>
<link type="text/css" rel="stylesheet" href="/static/syntaxhighlighter/styles/shCoreDefault.css"/>
<script type="text/javascript" src="/static/syntaxhighlighter/src/my_start_1.js"></script>





</body>

</html>