怎样用XML技术对数据库进行操作
众所周知,XML文件是保存和传输数据的载体,数据库自然也可以用XML进行读取。那么怎样使用XML技术呢?Microsoft.Net提供了XmlDataDocument类来专门来操作数据库。
ataDocument是XmlDocument的一个子类,它可以去读取和操作数据库或Xml文件中的数据,它使用的是W3C Document Object(DOM)。DOM用带有层次的节点来描述数据。由于它实现了IxpathNavigable接口,所以它又可以被XslTransform使用。由于XmlDataDocument和DataSet有密切的联系,任何对XmlDataDocument的改动将映射到相应的DataSet上,反之亦然。
using System;
![](/Images/OutliningIndicators/None.gif)
using System.Data;
![](/Images/OutliningIndicators/None.gif)
using System.Xml;
![](/Images/OutliningIndicators/None.gif)
using System.Data.SqlClient;
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
public class WriteTo
![](/Images/OutliningIndicators/None.gif)
{
![](/Images/OutliningIndicators/InBlock.gif)
public static void Main()
![](/Images/OutliningIndicators/InBlock.gif)
{
![](/Images/OutliningIndicators/InBlock.gif)
DataSet ds = new DataSet();// 新建一个DataSet,也可以使用已存在的数据库。
![](/Images/OutliningIndicators/InBlock.gif)
DataTable dt = new DataTable("product");//新建一个表。
![](/Images/OutliningIndicators/InBlock.gif)
DataColumn dc1 = new DataColumn("Id",System.Type.GetType("System.Int32"));
![](/Images/OutliningIndicators/InBlock.gif)
DataColumn dc2 = new DataColumn("ProductName",System.Type.GetType("System.String"));
![](/Images/OutliningIndicators/InBlock.gif)
dt.Columns.Add(dc1);
![](/Images/OutliningIndicators/InBlock.gif)
dt.Columns.Add(dc2);
![](/Images/OutliningIndicators/InBlock.gif)
for(int i=1;i<5;i++)
![](/Images/OutliningIndicators/InBlock.gif)
{
![](/Images/OutliningIndicators/InBlock.gif)
DataRow dr = dt.NewRow();
![](/Images/OutliningIndicators/InBlock.gif)
dr["Id"] = i;
![](/Images/OutliningIndicators/InBlock.gif)
dr["ProductName"] = "Product"+i.ToString();
![](/Images/OutliningIndicators/InBlock.gif)
dt.Rows.Add(dr);
![](/Images/OutliningIndicators/InBlock.gif)
}
![](/Images/OutliningIndicators/InBlock.gif)
ds.Tables.Add(dt);
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
//Load the document with the DataSet.
![](/Images/OutliningIndicators/InBlock.gif)
XmlDataDocument doc = new XmlDataDocument(ds);
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
//Write data to a file.
![](/Images/OutliningIndicators/InBlock.gif)
XmlTextWriter writer = new XmlTextWriter(Console.Out);//这时我们将结果输出到Dos下以方便调试,也可以输出到一个XML文件中。
![](/Images/OutliningIndicators/InBlock.gif)
writer.Formatting = Formatting.Indented;//输出格式。
![](/Images/OutliningIndicators/InBlock.gif)
doc.WriteTo(writer);
![](/Images/OutliningIndicators/InBlock.gif)
doc.WriteContentTo(writer);
![](/Images/OutliningIndicators/InBlock.gif)
}
![](/Images/OutliningIndicators/InBlock.gif)
}
![](/Images/OutliningIndicators/None.gif)
<NewDataSet>
![](/Images/OutliningIndicators/None.gif)
<product>
![](/Images/OutliningIndicators/None.gif)
<Id>1</Id>
![](/Images/OutliningIndicators/None.gif)
<ProductName>Product1</ProductName>
![](/Images/OutliningIndicators/None.gif)
</product>
![](/Images/OutliningIndicators/None.gif)
<product>
![](/Images/OutliningIndicators/None.gif)
<Id>2</Id>
![](/Images/OutliningIndicators/None.gif)
<ProductName>Product2</ProductName>
![](/Images/OutliningIndicators/None.gif)
</product>
![](/Images/OutliningIndicators/None.gif)
<product>
![](/Images/OutliningIndicators/None.gif)
<Id>3</Id>
![](/Images/OutliningIndicators/None.gif)
<ProductName>Product3</ProductName>
![](/Images/OutliningIndicators/None.gif)
</product>
![](/Images/OutliningIndicators/None.gif)
<product>
![](/Images/OutliningIndicators/None.gif)
<Id>4</Id>
![](/Images/OutliningIndicators/None.gif)
<ProductName>Product4</ProductName>
![](/Images/OutliningIndicators/None.gif)
</product>
![](/Images/OutliningIndicators/None.gif)
</NewDataSet>
![](/Images/OutliningIndicators/None.gif)
<NewDataSet>
![](/Images/OutliningIndicators/None.gif)
<product>
![](/Images/OutliningIndicators/None.gif)
<Id>1</Id>
![](/Images/OutliningIndicators/None.gif)
<ProductName>Product1</ProductName>
![](/Images/OutliningIndicators/None.gif)
</product>
![](/Images/OutliningIndicators/None.gif)
<product>
![](/Images/OutliningIndicators/None.gif)
<Id>2</Id>
![](/Images/OutliningIndicators/None.gif)
<ProductName>Product2</ProductName>
![](/Images/OutliningIndicators/None.gif)
</product>
![](/Images/OutliningIndicators/None.gif)
<product>
![](/Images/OutliningIndicators/None.gif)
<Id>3</Id>
![](/Images/OutliningIndicators/None.gif)
<ProductName>Product3</ProductName>
![](/Images/OutliningIndicators/None.gif)
</product>
![](/Images/OutliningIndicators/None.gif)
<product>
![](/Images/OutliningIndicators/None.gif)
<Id>4</Id>
![](/Images/OutliningIndicators/None.gif)
<ProductName>Product4</ProductName>
![](/Images/OutliningIndicators/None.gif)
</product>
![](/Images/OutliningIndicators/None.gif)
</NewDataSet>
![](/Images/OutliningIndicators/None.gif)
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
![](/Images/OutliningIndicators/None.gif)
<xsd:element name="bookstore" type="bookstoreType"/>
![](/Images/OutliningIndicators/None.gif)
<xsd:complexType name="bookstoreType">
![](/Images/OutliningIndicators/None.gif)
<xsd:sequence maxOccurs="unbounded">
![](/Images/OutliningIndicators/None.gif)
<xsd:element name="book" type="bookType"/>
![](/Images/OutliningIndicators/None.gif)
</xsd:sequence>
![](/Images/OutliningIndicators/None.gif)
</xsd:complexType>
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
<xsd:complexType name="bookType">
![](/Images/OutliningIndicators/None.gif)
<xsd:sequence>
![](/Images/OutliningIndicators/None.gif)
<xsd:element name="title" type="xsd:string"/>
![](/Images/OutliningIndicators/None.gif)
<xsd:element name="author" type="authorName"/>
![](/Images/OutliningIndicators/None.gif)
<xsd:element name="price" type="xsd:decimal"/>
![](/Images/OutliningIndicators/None.gif)
</xsd:sequence>
![](/Images/OutliningIndicators/None.gif)
<xsd:attribute name="genre" type="xsd:string"/>
![](/Images/OutliningIndicators/None.gif)
</xsd:complexType>
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
<xsd:complexType name="authorName">
![](/Images/OutliningIndicators/None.gif)
<xsd:sequence>
![](/Images/OutliningIndicators/None.gif)
<xsd:element name="first-name" type="xsd:string"/>
![](/Images/OutliningIndicators/None.gif)
<xsd:element name="last-name" type="xsd:string"/>
![](/Images/OutliningIndicators/None.gif)
</xsd:sequence>
![](/Images/OutliningIndicators/None.gif)
</xsd:complexType>
![](/Images/OutliningIndicators/None.gif)
</xsd:schema>
![](/Images/OutliningIndicators/None.gif)
<!--sample XML fragment-->
![](/Images/OutliningIndicators/None.gif)
<bookstore>
![](/Images/OutliningIndicators/None.gif)
<book genre='novel' ISBN='10-861003-324'>
![](/Images/OutliningIndicators/None.gif)
<title>The Handmaid's Tale</title>
![](/Images/OutliningIndicators/None.gif)
<price>19.95</price>
![](/Images/OutliningIndicators/None.gif)
</book>
![](/Images/OutliningIndicators/None.gif)
<book genre='novel' ISBN='1-861001-57-5'>
![](/Images/OutliningIndicators/None.gif)
<title>Pride And Prejudice</title>
![](/Images/OutliningIndicators/None.gif)
<price>24.95</price>
![](/Images/OutliningIndicators/None.gif)
</book>
![](/Images/OutliningIndicators/None.gif)
</bookstore>
![](/Images/OutliningIndicators/None.gif)
/**
![](/Images/OutliningIndicators/InBlock.gif)
* System.Xml/XmlDataDocument class
![](/Images/OutliningIndicators/InBlock.gif)
* Author: wenjun
![](/Images/OutliningIndicators/InBlock.gif)
*/
![](/Images/OutliningIndicators/None.gif)
using System;
![](/Images/OutliningIndicators/None.gif)
using System.Data;
![](/Images/OutliningIndicators/None.gif)
using System.Xml;
![](/Images/OutliningIndicators/None.gif)
public class GetRowFromElement
![](/Images/OutliningIndicators/None.gif)
{
![](/Images/OutliningIndicators/InBlock.gif)
public static void Main()
![](/Images/OutliningIndicators/InBlock.gif)
{
![](/Images/OutliningIndicators/InBlock.gif)
XmlDataDocument doc = new XmlDataDocument();
![](/Images/OutliningIndicators/InBlock.gif)
doc.DataSet.ReadXmlSchema("store.xsd");
![](/Images/OutliningIndicators/InBlock.gif)
doc.Load("dataset.xml");
![](/Images/OutliningIndicators/InBlock.gif)
//Change the price on the first book.
![](/Images/OutliningIndicators/InBlock.gif)
XmlElement root = doc.DocumentElement;
![](/Images/OutliningIndicators/InBlock.gif)
DataRow row = doc.GetRowFromElement((XmlElement)root.FirstChild);
![](/Images/OutliningIndicators/InBlock.gif)
row["price"] = "18.95";//将第一column中的price值改掉
![](/Images/OutliningIndicators/InBlock.gif)
Console.WriteLine("Display the modified XML data
");
![](/Images/OutliningIndicators/InBlock.gif)
Console.WriteLine(doc.DocumentElement.OuterXml);
![](/Images/OutliningIndicators/InBlock.gif)
}
![](/Images/OutliningIndicators/InBlock.gif)
}
![](/Images/OutliningIndicators/None.gif)
<bookstore><book genre="novel" ISBN="10-861003-324"><title>The Handmaid's Tale</title><price>18.95</price></book><book genre="novel" ISBN="1-861001-57-5"><title>Pride And Prejudice</title><price>24.95</price></book></bookstore>
XmlD
下面我们用一个例子来说明怎样将一个DataSet输出到一个Xml文件中去。
WriteTo.cs
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
运行这个程序,我们发现结果如下:
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
我们可以看到一个数据库成功的输出成一个XML文件格式。
有了XmlDataDocument这个类,我们可以很轻松的对一个数据库进行操作,并且我们对XmlDataDocument所做的操作都会映射到数据库中去。
比如我们对一个XML文件操作(这个XML文件是DataSet产生的),相应的改变也会导致DataSet的改变。
下面我们以一个实例来说明这一点,需说明的一点是,这个实例还使用了XSD进行校验,以确保数据库传输和操作的正确性。
Store.xsd:
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
我们可以发现这个XSD文件控制的XML文件的格式,它定义了三个元素:title,author和price。
对应的DataSet.xml如下:
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
这个Xml文件可以向上例那样通过XmlDataDocument产生,数据库名是:bookstore,表名是book,column名是title和price,genre和ISBN也是当做column来处理。
针对这个Xml文件我们可以进行操作。
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/dot.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
![](/Images/OutliningIndicators/InBlock.gif)
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
运行这个程序,发现输出如下:
Display the modified XML data...
![](/Images/OutliningIndicators/None.gif)
我们可以发现price的值已改了过来。我们可以在查找相应数据库(bookstore),发现里面的值也跟着改了。