易截截图软件、单文件、免安装、纯绿色、仅160KB

SQL Server SQL for xml auto 添加根节点


今天从数据库中查询出xml,同时添加一个根节点
做了如下测试:
create table TestXmlQuery(
ID int identity(1,1) not null,
Name varchar(10)
)
go
insert into [TestXmlQuery] (Name) values('测试1')
insert into [TestXmlQuery] (Name) values('测试2')
insert into [TestXmlQuery] (Name) values('测试3')
insert into [TestXmlQuery] (Name) values('测试4')
select t.ID as myID,t.Name as myName from [TestXmlQuery] as t for xml auto,type
得到如下结果:
<t myID="1" myName="测试1" />
<t myID="2" myName="测试2" />
<t myID="3" myName="测试3" />
<t myID="4" myName="测试4" />
select t.ID as myID,t.Name as myName from [TestXmlQuery] as t for xml auto,elements
得到如下结果:
<t>
<myID>1</myID>
<myName>测试1</myName>
</t>
<t>
<myID>2</myID>
<myName>测试2</myName>
</t>
<t>
<myID>3</myID>
<myName>测试3</myName>
</t>
<t>
<myID>4</myID>
<myName>测试4</myName>
</t>
select t.ID as myID,t.Name as myName from [TestXmlQuery] as t for xml raw
得到如下结果:
<row myID="1" myName="测试1" />
<row myID="2" myName="测试2" />
<row myID="3" myName="测试3" />
<row myID="4" myName="测试4" />
select t.ID as myID,t.Name as myName from [TestXmlQuery] as t for xml raw,elements
得到如下结果:
<row>
<myID>1</myID>
<myName>测试1</myName>
</row>
<row>
<myID>2</myID>
<myName>测试2</myName>
</row>
<row>
<myID>3</myID>
<myName>测试3</myName>
</row>
<row>
<myID>4</myID>
<myName>测试4</myName>
</row>
select t.ID as myID,t.Name as myName from [TestXmlQuery] as t for xml raw,elements,


相关文档:

flex中xml转化为array实例

本文共两个文件:translate.mxml 和 mapmarking.xml
1、translate.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="librar ......

java读取xml配置文件

xml文件如下 配置功能开关
<Configurations>
    <Samples>true</Samples>
    <Excepts>true</Excepts>
    <CheckFace>false</CheckFace>
    <ThumbNail>false</ThumbNail>
  &nbs ......

C#生成XML文件的 函数

protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
         &nbs ......

ASP遍历XML节点


遍历XML文档
对于下面的一段XML代码:
XML文档实例books.xml,如下所示:
<?xml version="1.0" encoding="gb2312" ?>
<books>
<book status="已售完">
<author>破破</author>
<title>XML入门</title >
</book>
<book statu ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号