add a node to XMLDocument

P

Peter Morris

Hi, I'm new to XML programming.

I'm writing a program in Visual Basic.Net that retrieves XML data
from eBay. I want to store the results of a query in an xmlDocument.

Here is an example, I pass an item number, and get back XML information
about that listing. Response format here.
http://developer.ebay.com./DevZone/shopping/docs/CallRef/GetSingleItem.html#Response

I have an XML document that keeps a list of information about various items.
I only
use a few of the fields there.


<?xml version="1.0" encoding="utf-8"?>
<ItemList>
<Item>
<ItemNo>2375439067</ItemNo>
<Title>iPod shuffle</Title>
<Price>5.67</Price>
<Bids>4</Bids>
<Autobid>12.00<Autobid>
<Shipping>2.45</Shipping>
<TimeLeft>15mins</TimeLeft>
</Item>
<Item>
<ItemNo>2123490678</ItemNo>
<Title>Video Recorder</Title>
<Price>7.99</Price>
<Bids>5</Bids>
<Autobid>10.00<Autobid>
<Shipping>7.50</Shipping>
<TimeLeft>1hr 12</TimeLeft>
</Item>
</ItemList>

Note - the autobid element isn't from eBay, I set it myself, it's the
maximum
amout I'm willing to bid for that item.

When I retrieve data for an item from eBay, I want to do the following:
1) create a new item node.
2) copy the information from the eBay XML to my node, and set the AB amount
3) add the new node to my xmlDocument.


What is the code to do this?

Let's suppose that I have the response stream from eBay, and have extracted
the XML from it into an XMLDocument called ebay_item_XML , my list of
items is loaded into an XMLDocument called list_of_items, and I want to
set an autobid of 23.99



Dim item_list as XMLDocument
' load item_list from file

...

Dim eBay_item_xml as XMLDocument
Dim sr As New StreamReader(incoming_stream)
' get the incoming stream into an XML document
eBay_item_xml.LoadXml(sr.ReadToEnd())
sr.Close()
incoming_stream.Close()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top