473,804 Members | 3,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

converting xml to text file

12 New Member
I have an xml file, and I need to convert it into a text file.
xml:
<?xml version="1.0" encoding="UTF-8" ?>
- <po-response xmlns="http://seller.marketpl ace.sears.com/oms/v1" xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocat ion="https://seller.marketpl ace.sears.com//SellerPortal/s/schema/oms/purchaseorder-v1.xsd">
- <purchase-order>
<po-number>2180031</po-number>
<po-date>2009-12-27</po-date>
<expected-ship-date>2010-01-01</expected-ship-date>
- <shipping-detail>
<ship-to-name>WILLIAM BENTLEY</ship-to-name>
<city>INDIANAPO LIS</city>
<state>IN</state>
<zipcode>4622 1</zipcode>
<shipping-method>Ground</shipping-method>
</shipping-detail>
<customer-name>WILLIAM BENTLEY</customer-name>
- <po-line>
- <po-line-header>
<line-number>2</line-number>
<item-id>PRP2008</item-id>
<item-name>Kicker DSM60 6.5 Inch Coaxial 2-Way Speakers</item-name>
<item-sell-price>3900</item-sell-price>
<order-quantity>2</order-quantity>
</po-line-header>
- <po-line-detail>
<po-line-status>SHIPPED</po-line-status>
<quantity>2</quantity>
</po-line-detail>
</po-line>
- <po-line>
- <po-line-header>
<line-number>1</line-number>
<item-id>PRP2047</item-id>
<item-name>Kenwood KDC-138 AM/FM/CD-Receiver</item-name>
<item-sell-price>9437</item-sell-price>
<order-quantity>1</order-quantity>
</po-line-header>
- <po-line-detail>
<po-line-status>SHIPPED</po-line-status>
<quantity>1</quantity>
</po-line-detail>
</po-line>
<order-subtotal>172.37 </order-subtotal>
<sales-tax>13.54</sales-tax>
<shipping-fees>20.95</shipping-fees>
<order-total>206.86</order-total>
<po-status>CLOSED</po-status>
</purchase-order>

How can I convert this to a text file containing most of these fields?
Thank you.
Dec 31 '09 #1
2 2998
ThatThatGuy
449 Recognized Expert Contributor
you can use XmlReader or XmlDocument classes of .net to retrieve data out of any node... or to parse the whole file...

it would be messy afterwards though...
Jan 4 '10 #2
devquest
12 New Member
ok. thank you. I figured out how to convert it to a text document. I have a question. Some of the purchase orders have many addresses returned
example:
<purchase-order>
<po-number>111111</po-number>
<po-date>2010-01-31</po-date>
<expected-ship-date>2010-02-05</expected-ship-date>
- <shipping-detail>
<ship-to-name>John Doe</ship-to-name>
<address>addres s 1</address>
<address>addres s 2</address>
<address>addres s 3</address>
<address>addres s 4</address>
<address>addres s 5</address>
<city>NY</city>
<state>NY</state>
<zipcode>1111 1</zipcode>
<shipping-method>USPS</shipping-method>
</shipping-detail>
<customer-name>John Doe</customer-name>
- <po-line>
- <po-line-header>
<line-number>1</line-number>
<item-id>Ab123</item-id>
<item-name>Item Name</item-name>
<item-sell-price>47.25</item-sell-price>
<order-quantity>1</order-quantity>
</po-line-header>
- <po-line-detail>
<po-line-status>NEW</po-line-status>
<quantity>1</quantity>
</po-line-detail>
</po-line>
<order-subtotal>47.25</order-subtotal>
<sales-tax>0.0</sales-tax>
<shipping-fees>6.25</shipping-fees>
<order-total>53.5</order-total>
<po-status>New</po-status>
</purchase-order>
I only want 3 addresses. If there are more, I want to remove the rest of the addresses. How can this be done in vb.net?
Thank you.
Feb 4 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
3411
by: nanookfan | last post by:
Hi all, I'm having a bizarre problem converting XML files to HTML using an XSLT. The problem is only occuring in my Netscape 7.0 browser. What makes it more bizarre is that it is only happening when I put my XML files and the .xsl files on my ISP's system for my home page. If I try to open the XML files in Netscape 7.0 on my own machine (ie, not on the ISP's system), the pages convert file and the result is displayed in HTML.
1
2196
by: H. Kaya | last post by:
Hallo, I have a problem converting a XML file to a other. I have no idea how I can do this. I try it for a long time but I can not find a solution. Has anyone a Idea? Below you can find my Input XML Document, Output XML Document and my scratch XSLT file. At the end is my request Output XML. Greetings H. Kaya
7
2415
by: Jus! | last post by:
Hi. I am reading bits(1's & 0's) from a file and i wa wondering what is the most efficient method of converting these strings to individual int's? eg. File contains: 110001 010011 etc... Whats the best way to read in each line and break it up into individual ints?
2
2874
by: mike | last post by:
regards: I follow the following steps to converting from HTML to XHTML http://webpageworkshop.co.uk/main/xhtml_converting My parser is http://htmlparser.sourceforge.net/ Xhtml version is 1.0 from http://nds.nokia.com/uaprof/N6600r100.xml but nokia mobile browser cannot identify the converted file(XHTML1.0). Is there something wrong with my procedure.
3
3116
by: j.a. harriman | last post by:
Hi, On MSDN I know there is a JScript example (Upgrading Visual C++ Projects to Visual Studio .NET in Batch Mode) to upgrade VS6 C++ projects to .NET solutions. It converts the project files (*.dsp), but doesn't create the solution (*.sln) file. Is there an automated way to convert an existing VS6 C++ *.dsw to a .NET *.sln?
5
2527
by: Robert | last post by:
I have a series of web applications (configured as separate applications) on a server. There is a main application at the root and then several virtual directories that are independant applications. I am testing an upgrade of all of the sites and have converted the main root site...although not necessarily fixed any issues. I move on instead and converted one of the virtual roots that is a seperate
4
3097
by: Clark Stevens | last post by:
I have a program that I'm converting from VB6 to VB.NET. It reads in a text file containing barcode numbers and their corresponding descriptions. Then the user enters the barcode number and the program finds the matching barcode description. In VB6 I used an UDT to store the barcode number along with the description. Then I declared an array of the barcode UDT. I'm thinking of converting the UDT to a structure in VB.NET and doing...
1
2158
by: UKuser | last post by:
Hi Guys, I have a program which converts Excel spreadsheets to Javascript and allows interactivity. However it can't convert it to PHP, which is obviously better for users to view (in case J/S is turned off). How would I go about converting some of this created code (example JS below), or is there an easier way to get PHP to do the calculations itself? I am aware of an excel-server product but this is too expensive and doesnt actually...
10
2001
by: Ron | last post by:
I want to calculate the surface area of a sphere from an inputed radius with option strict on. I guess I am not converting something correctly. Here is what I am doing: I have a textbox txtradius that I enter a radius into. I then have a lable that I want the surface area to be displayed in called lblsurface
3
3621
by: Jone | last post by:
Hello, I have tried to convert a Mac text file to Windows using code below. Encoding Win = Encoding.GetEncoding("Windows-1252"); Encoding Mac = Encoding.GetEncoding("macintosh"); byte macBytes = Mac.GetBytes(Row);
0
10567
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10323
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7613
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6847
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5515
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5647
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4291
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2983
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.