SQL XML DELETE
--A. 从存储在非类型化的 xml 变量中的文档中删除节点
DECLARE @myDoc xml
SET @myDoc = '<?Instructions for=TheWC.exe ?>
<Root>
<!-- instructions for the 1st work center -->
<Location LocationID="10" LaborHours="1.1" MachineHours=".2" >
Some text 1
<step>Manufacturing step 1 at this work center</step>
<step>Manufacturing step 2 at this work center</step>
</Location>
</Root>'
SELECT @myDoc
-- delete an attribute
SET @myDoc.modify('
delete /Root/Location/@MachineHours
')
SELECT @myDoc
-- delete an element
SET @myDoc.modify('
delete /Root/Location/step[2]
')
SELECT @myDoc
-- delete text node (in <Location>
SET @myDoc.modify('
delete /Root/Location/text()
')
SELECT @myDoc
-- delete all processing instructions
SET @myDoc.modify('
delete //processing-instruction()
')
SELECT @myDoc
--B. 从存储在非类型化的 xml 列中的文档中删除节点
delete XML DML 语句从存储在列中的文档中删除 <Features> 的第二个子元素。
CREATE TABLE #T (i int, x xml)
go
INSERT INTO #T VALUES(1,'<Root>
<ProductDescription ProductID="1" ProductName="Road Bike">
<Features>
<Warranty>1 year parts and labor</Warranty>
<Maintenance>3 year parts and labor extended maintenance is available</Maintenance>
</Features>
</ProductDescription>
</Root>')
go
-- verify the contents before delete,query返回Features元素下的所有节点,以XML格式返回
SELECT x.query('//ProductDescription/Features')
from #T
-- delete the second feature
UPDATE #T
SET x.modify('delete /Root/ProductDescription/Features/*[2]')
-- verify the deletion
SELECT x.query(' //ProductDescription/Features')
from #T
DROP TABLE #T
C. 从非类型化的 xml 列中删除节点
create table #T(ProductModelID int primary key,
Instructions xml )
go
insert #T
select ProductModelID, Instructions
from Prod
相关文档:
function init() {
var viewChartID = 0;
var viewChartSum = "" ;
reportName = document.getElementById("reportName").value;
xmlDoc=loadXMLDoc("./charreport/xml/viewChart.xml");
x=xmlDoc.getElementsByTagName('viewChart')[0].childNodes;
for (i=0;i<x.length;i++ ......
创建XML文件:
public boolean createXML(){
try{
Document doc = DocumentHelper.createDocument();
Element root = doc.addElement("root");
Element personNode = root.addElement("person");
Element sonNode = personNode ......
如何在VC环境下编写程序读取XML文件?清提供源代码.谢谢.
#import <msxml3.dll> named_guids //导入动态库,装了IE5就有
using namespace MSXML2; //引用命名空间,一般可以把命名空间理解成类和接口的集合,呵呵,对不对我也不知道了
#include <vector>
using na ......
把xml拖到IE里就找到错在哪里了
如下:
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
文档的顶层无效。处理资源 'file:///D:/Tomcat 5.5/webapps/myapp/WEB-INF/web.xml' 时出错。第 1 行,位置: 44 ......
string str = System.Configuration.ConfigurationManager.AppSettings["strconn"];
string sqlpwd = "select password from bg_user where username='" + username + "'";
MySqlConnection conn = new MySqlConnection(str);
MySqlCommand cmd=new MySqlCommand(sqlpwd,conn);
MySqlDataAdapter adr = new MySqlDataA ......