将XML与VB.NET集成 [英] integrate an XML with VB.NET

查看:73
本文介绍了将XML与VB.NET集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在阅读与XML与VB.NET集成相关的文章,但我遇到了一个问题.

本文中的示例在我的PC上运行正常,但我无法处理XML文件

hello,

I was reading the article related to integration of an XML with VB.NET but I was faced with a problem.

The example from the article works fine on my PC but I couldn''t handled with my XML file

<order>
  <HEADER>
    <bu>ITA</bu> 
    <order_no>4310003289</order_no> 
    <cust_grp_name>AMAZON</cust_grp_name> 
    <cust_grp_id>433622</cust_grp_id> 
  </HEADER>
  <lines>
    <line>
      <order_line_no>1</order_line_no> 
      <product_id>3000123</product_id> 
      <quantity>12</quantity> 
      <price>15.6</price> 
      <order_date>24052011</order_date> 
      <order_date_receipt>24052011</order_date_receipt> 
      <delivery_date>31052011</delivery_date> 
      <cust_id>A662</cust_id> 
      <delivery_address>Belgium,Bruxelles,St.Patrick str,no.12</delivery_address> 
      <delivery_address_id>2</delivery_address_id> 
    </line>
    <line>
      <order_line_no>2</order_line_no> 
      <product_id>3000124</product_id> 
      <quantity>2</quantity> 
      <price>15.6</price> 
      <order_date>24052011</order_date> 
      <order_date_receipt>24052011</order_date_receipt> 
      <delivery_date>31052011</delivery_date> 
      <cust_id>A662</cust_id> 
      <delivery_address>Belgium,Bruxelles,St.Patrick str,no.12</delivery_address> 
      <delivery_address_id>2</delivery_address_id> 
    </line>
    <line>
      <order_line_no>3</order_line_no> 
      <product_id>3000125</product_id> 
      <quantity>8</quantity> 
      <price>15.6</price> 
      <order_date>24052011</order_date> 
      <order_date_receipt>24052011</order_date_receipt> 
      <delivery_date>31052011</delivery_date> 
      <cust_id>A662</cust_id> 
      <delivery_address>Belgium,Bruxelles,St.Patrick str,no.12</delivery_address> 
      <delivery_address_id>2</delivery_address_id> 
    </line>
    <line>
      <order_line_no>4</order_line_no> 
      <product_id>3000300</product_id> 
      <quantity>120</quantity> 
      <price>0.25</price> 
      <order_date>24052011</order_date> 
      <order_date_receipt>24052011</order_date_receipt> 
      <delivery_date>31052011</delivery_date> 
      <cust_id>A662</cust_id> 
      <delivery_address>Belgium,Bruxelles,St.Patrick str,no.12</delivery_address> 
      <delivery_address_id>2</delivery_address_id> 
    </line>
    <line>
      <order_line_no>5</order_line_no> 
      <product_id>3000101</product_id> 
      <quantity>28</quantity> 
      <price>2.5</price> 
      <order_date>24052011</order_date> 
      <order_date_receipt>24052011</order_date_receipt> 
      <delivery_date>31052011</delivery_date> 
      <cust_id>A662</cust_id> 
      <delivery_address>Belgium,Bruxelles,St.Patrick str,no.12</delivery_address> 
      <delivery_address_id>2</delivery_address_id> 
    </line>
    <line>
      <order_line_no>6</order_line_no> 
      <product_id>3000102</product_id> 
      <quantity>45</quantity> 
      <price>3.2</price> 
      <order_date>24052011</order_date> 
      <order_date_receipt>24052011</order_date_receipt> 
      <delivery_date>31052011</delivery_date> 
      <cust_id>A662</cust_id> 
      <delivery_address>Belgium,Bruxelles,St.Patrick str,no.12</delivery_address> 
      <delivery_address_id>2</delivery_address_id> 
    </line>
  </lines>
</order>


我想将这些值添加到一些要从何处进入SQL表的变量中.
我的第一个问题是我无法成功获取< order_no>的值.变成变量.
有人可以帮我解释一下如何从XML文件中获取该值吗?

非常感谢,
Ionut Preda.


The values I want to be added into some variables from where to go into an SQL table.
My first problem is that I don''t succeed getting the value of <order_no> into a variable.
Can someone help me explaining how to get that value from my XML file, please?

Thanks a lot,
Ionut Preda.

推荐答案

该特定文章已过时.现在,您可以在VB.Net中使用XML文字. XML文字 [
That particular article is way out of date. You can now use XML literals with VB.Net. XML Literals[^] is an article by JPaulino on how to use XML with VB.

Hope this helps


这篇关于将XML与VB.NET集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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