XML取节点名称与节点值实例
declare @x xml
set @x='
<ROOT>
<SM>
<SMID>88</SMID>
<SMCD>A5</SMCD>
<SMNM>刘洋</SMNM>
<NDS>
<ND>
<SF>3</SF>
<NDID>88</NDID>
<NDCD>A5</NDCD>
<NDNM>林林</NDNM>
<CDST>
<tR1>1</tR1>
<tR2>2</tR2>
<tR3>3</tR3>
<tR4>4</tR4>
<tR5>5</tR5>
<tR6>6</tR6>
<tR7>7</tR7>
<tR8>8</tR8>
<tR9>9</tR9>
<tt2>1</tt2>
<tt130>2</tt130>
<t132>3</t132>
<t155>4</t155>
</CDST>
</ND>
</NDS>
</SM>
<SM>
<SMID>84</SMID>
<SMCD>A6</SMCD>
<SMNM>陈真</SMNM>
<NDS>
<ND>
<SF>3</SF>
<NDID>84</NDID>
<NDCD>A6</NDCD>
<NDNM>陈真</NDNM>
<CDST>
<tR2>9</tR2>
<tR3>8</tR3>
<tR4>7</tR4>
<tR5>6</tR5>
<tR6>5</tR6>
<tR7>4</tR7>
<tR8>3</tR8>
<tR9>2</tR9>
<t12dd>1</t12dd>
<tt2>2</tt2>
<tt130>3</tt130>
<t132>4</t132>
<t155>5</t155>
</CDST>
</ND>
</NDS>
</SM>
<SM>
<SMID>45</SMID>
<SMCD>D1</SMCD>
<SMNM>曹曹</SMNM>
<NDS>
<ND>
<SF>3</SF>
<NDID>45</NDID>
<NDCD>D1
相关文档:
已知有一个XML文件(bookstore.xml)如下:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
<book genre="fantasy" ISBN="2-3631-4">
<title>Oberon's Legacy</title>
<author>Corets, Eva</author>
<price>5.95</price>
</book>
< ......
declare @XML XML
SET @XML='<root>
<OLDVALUE>
<H_Action id="1130">030</H_Action>
<D_Action>030</D_Action>
<OrderCompany>00220</OrderCompany>
<OrderNumber>10004035</OrderNumber> ......
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.XMLOutputter;
(1)使用JDOM首先要指定使用什么解析器。如:
SAXBuilder builder=new SAXBuilder(false) ......
原贴:http://topic.csdn.net/u/20100412/14/f6941844-e9bf-4ed7-a0c2-bef03d775783.html?70615
declare @data xml=
'<root>
<SaleMan>
<SaleManId>1</SaleManId>
<SaleManCode>001</SaleManCode>
<Nodes>
<Node>
< ......
扩展Struts2--自定义String和XML格式的Result
struts2虽然继承了webwork优秀的MVC分离,可是有很多地方让人百思不得其解!最让人离谱的是,返回的结果集中居然没有
String,xml这两种非常常用的类型。还是自己动手,丰衣足食:
第一种方式:使用“PlainText Result”
& ......