Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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>

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.
Posted
Updated 21-Jul-11 0:34am
v2

1 solution

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
 
Share this answer
 
Comments
mikcutu 22-Jul-11 3:29am    
this is very helpful but unfortunately I don't use Visual Studio 2008 or 2010.
my version is 2005. do you have an example for 2005, please?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900