读取xml数据 [英] Reading xml data

查看:69
本文介绍了读取xml数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何导入以下列方式存储的数据?


< Restaurants>

- < Restaurant>

< Category>美国餐厅< / Category>

<名称> APPLEBEES< /名称>

<地址> 1273 HOOKSETT RD,HOOKSETT,NH 03106< ; /地址>

< StreetAddress> 1273 HOOKSETT RD< / StreetAddress>

< City> HOOKSETT< / City>

<州> NH< /州>

< Zip> 03106< / Zip>

< Phone>(603)000-0000< / Phone>

< Lon> -71.4363< / Lon>

< Lat> 43.0484< / Lat>

< / Restaurant>

- <餐厅>

<类别>美国餐厅< / Category>

<名称> APPLEBEES< /名称>

<地址> 14 MANCHESTER RD,DERRY,NH 03038< /地址>

< StreetAddress> 14 MANCHESTER RD< / StreetAddress>

&l t; City> DERRY< / City>

< State> NH< / State>

< Zip> 03038< / Zip>

< Phone>(603)000-0000< / Phone>

< Lon> -71.3298< / Lon>

< Lat> 42.8958< / Lat>

< / Restaurant>

< / Restaurants>

How should one import data that is stored in the following fashion?

<Restaurants>
- <Restaurant>
<Category>American Restaurants</Category>
<Name>APPLEBEES</Name>
<Address>1273 HOOKSETT RD, HOOKSETT, NH 03106</Address>
<StreetAddress>1273 HOOKSETT RD</StreetAddress>
<City>HOOKSETT</City>
<State>NH</State>
<Zip>03106</Zip>
<Phone>(603) 000-0000</Phone>
<Lon>-71.4363</Lon>
<Lat>43.0484</Lat>
</Restaurant>
- <Restaurant>
<Category>American Restaurants</Category>
<Name>APPLEBEES</Name>
<Address>14 MANCHESTER RD, DERRY, NH 03038</Address>
<StreetAddress>14 MANCHESTER RD</StreetAddress>
<City>DERRY</City>
<State>NH</State>
<Zip>03038</Zip>
<Phone>(603) 000-0000</Phone>
<Lon>-71.3298</Lon>
<Lat>42.8958</Lat>
</Restaurant>
</Restaurants>

推荐答案


http://msdn.microsoft.com/library/de...mlfromfile.asp


Ken

-------------------------

" pmclinn" < PE *** @ mclinn.com>在消息中写道

新闻:11 ********************* @ z14g2000cwz.googlegro ups.com ...

如何导入以下列方式存储的数据?


< Restaurants>

- < Restaurant>

< Category>美国餐厅< / Category>

<名称> APPLEBEES< /名称>

<地址> 1273 HOOKSETT RD,HOOKSETT,NH 03106< ; /地址>

< StreetAddress> 1273 HOOKSETT RD< / StreetAddress>

< City> HOOKSETT< / City>

<州> NH< /州>

< Zip> 03106< / Zip>

< Phone>(603)000-0000< / Phone>

< Lon> -71.4363< / Lon>

< Lat> 43.0484< / Lat>

< / Restaurant>

- <餐厅>

<类别>美国餐厅< / Category>

<名称> APPLEBEES< /名称>

<地址> 14 MANCHESTER RD,DERRY,NH 03038&l t; /地址>

< StreetAddress> 14 MANCHESTER RD< / StreetAddress>

< City> DERRY< / City>

< ;州> NH< /州>

< Zip> 03038< / Zip>

< Phone>(603)000-0000< / Phone>

< Lon> -71.3298< / Lon>

< Lat> 42.8958< / Lat>

< / Restaurant>

< / Restaurants>
Hi,

http://msdn.microsoft.com/library/de...mlfromfile.asp

Ken
-------------------------
"pmclinn" <pe***@mclinn.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
How should one import data that is stored in the following fashion?

<Restaurants>
- <Restaurant>
<Category>American Restaurants</Category>
<Name>APPLEBEES</Name>
<Address>1273 HOOKSETT RD, HOOKSETT, NH 03106</Address>
<StreetAddress>1273 HOOKSETT RD</StreetAddress>
<City>HOOKSETT</City>
<State>NH</State>
<Zip>03106</Zip>
<Phone>(603) 000-0000</Phone>
<Lon>-71.4363</Lon>
<Lat>43.0484</Lat>
</Restaurant>
- <Restaurant>
<Category>American Restaurants</Category>
<Name>APPLEBEES</Name>
<Address>14 MANCHESTER RD, DERRY, NH 03038</Address>
<StreetAddress>14 MANCHESTER RD</StreetAddress>
<City>DERRY</City>
<State>NH</State>
<Zip>03038</Zip>
<Phone>(603) 000-0000</Phone>
<Lon>-71.3298</Lon>
<Lat>42.8958</Lat>
</Restaurant>
</Restaurants>


pmclinn,


这是一个数据集,所以

\\\

dim ds作为新数据集

ds.readXML("文件路径)

datagrid1 .datasource = ds.tables(0)

///

将在数据网格中显示它。


我希望这个帮助?


Cor
pmclinn,

This is a dataset so
\\\
dim ds as new dataset
ds.readXML("path to the file")
datagrid1.datasource = ds.tables(0)
///
Will show it in a datagrid.

I hope this helps?

Cor


" pmclinn" < PE *** @ mclinn.com>在消息中写道

news:11 ********************* @ z14g2000cwz.googlegro ups.com ...
"pmclinn" <pe***@mclinn.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
如何导入以下列方式存储的数据?

<餐厅>
- <餐厅>
<类别>美国餐厅< / Category> ;
<名称> APPLEBEES< /名称>
<地址> 1273 HOOKSETT RD,HOOKSETT,NH 03106< /地址>
< StreetAddress> 1273 HOOKSETT RD< / StreetAddress> < br&>< City> HOOKSETT< / City>
< State> NH< / State>
< Zip> 03106< / Zip>
< Phone>(603)000 -0000< / Phone>
< Lon> -71.4363< / Lon>
< Lat> 43.0484< / Lat>
< / Restaurant>
- < ;餐厅>
<类别>美国餐厅< / Category>
<名称> APPLEBEES< /名称>
<地址> 14 MANCHESTER RD,DERRY,NH 03038< / Address>
< StreetAddress> 14 MANCH ESTER RD< / StreetAddress>
< City> DERRY< / City>
<状态> NH< /状态>
< Zip> 03038< / Zip>
< ;电话>(603)000-0000< /电话>
< Lon> -71.3298< / Lon>
< Lat> 42.8958< / Lat>
< / Restaurant> ;
< / Restaurants>
How should one import data that is stored in the following fashion?

<Restaurants>
- <Restaurant>
<Category>American Restaurants</Category>
<Name>APPLEBEES</Name>
<Address>1273 HOOKSETT RD, HOOKSETT, NH 03106</Address>
<StreetAddress>1273 HOOKSETT RD</StreetAddress>
<City>HOOKSETT</City>
<State>NH</State>
<Zip>03106</Zip>
<Phone>(603) 000-0000</Phone>
<Lon>-71.4363</Lon>
<Lat>43.0484</Lat>
</Restaurant>
- <Restaurant>
<Category>American Restaurants</Category>
<Name>APPLEBEES</Name>
<Address>14 MANCHESTER RD, DERRY, NH 03038</Address>
<StreetAddress>14 MANCHESTER RD</StreetAddress>
<City>DERRY</City>
<State>NH</State>
<Zip>03038</Zip>
<Phone>(603) 000-0000</Phone>
<Lon>-71.3298</Lon>
<Lat>42.8958</Lat>
</Restaurant>
</Restaurants>




取决于导入真正的...

导入意味着数据库在我的脑海里。

以防万一你的意思。


如果你在说sql server那么sqlxmlbulkload将导入大的xml文件
并且您可以使用vbscript DTS来执行此操作。


否则,您已经有一些像xmlreader这样的答案。



Depends on import to what really...
Import implies to database to my mind.
Just in case that''s what you mean.

If you''re talking sql server then sqlxmlbulkload will import big xml files
and you could use a vbscript DTS to do so.

Otherwise, you already have a couple answers like xmlreader.

这篇关于读取xml数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆