Results 1 to 6 of 6

Thread: Parse An XML File

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    9

    Question File Transer and Conversion [2005]

    I have what seems like a simple problem, but am not sure as of yet, since I am still relatively new to .Net 2.0.

    The scenario: I need to retrive an xml file via the http protocol, using just a form and a button. The form would get the file and send it back to a network folder. I have an understanding of this part of it. What I am not sure of is this: The xml file needs to be converted into a some type of a dilimited csv file in the process of being saved. Make sense?

    If there is anyone out there who could lend some much needed assistance, I would be extremely grateful.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: File Transer and Conversion [2005]

    You can read the XML file using and XmlDocument, although there may well be better ways. I'm not too experienced with XML. You may be better to use an XmlNodeReader or an XmlTextReader. I've never used either so you'd have to read up on each method. Once you have the data you can use a StreamReader to write your CSV file, or else something like My.Computer.FileSystem.WriteAllText.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    9

    Re: File Transer and Conversion [2005]

    Ok, here is a better explanation (please bear with me on this):

    The following is sample xml from an xml file. Following you see what needs to be done:

    <?xml version="1.0" encoding="UT-8" ?>
    <Available Batch>
    <Available>
    <Part>AABBCC</Part>
    <Location>20</Location>
    <Qty>500</Qty>
    <Available>
    <Available>
    <Part>AABBCC</Part>
    <Location>60</Location>
    <Qty>0</Qty>
    <Available>
    <Available>
    <Part>AABBCC</Part>
    <Location>100</Location>
    <Qty>0</Qty>
    <Available>
    </Available Batch>
    </xml>
    *********************************************************
    Ok, here is the fun part:

    I need to add the quantitys of locations 20 and 100, but ignore location 60
    I need to have the ending numbers to have 20 blank characters
    I need to have the quantity set as zero-filled
    I need to have the information sent via ftp to a server every 30 minutes

    So, basically, it should strip out all of the remaining xml content, and have only three fields: Part, Location, and Qty.

    Not exactly sure how to manage this. I can get the file and stream it back, which is not a huge issue. However, the conversion of the xml is what I don't quite understand.

    As this is extremely urgent, any assistance would be absolutely wonderful.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: XML conversion and print software

    Here's the problem with that. XML data by it;s nature is heirarchical.... flat files are not. So it makes it difficult to genericaly say, this is how you should do it.

    You may want to start a new thread.... this one is 4 years old.... and is in the Classic VB forum.... you'll want to post int he VB.NET forums...

    =-tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    9

    Re: File Transer and Conversion [2005]

    For anyone willing to write the app, I would be willing to talk about some type of compensation.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Parse An XML File

    Split from this thread, moved to VB.NET

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width