Results 1 to 3 of 3

Thread: XML To Database - Databse to XML

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    Canton, GA
    Posts
    487

    XML To Database - Databse to XML

    I need to write an online store for a customer that needs to grab a XML files from a URL at set times daily. I am new to XML so I really need some advice!

    For example this is the data from the vendor:

    Code:
    There are three different "batch" XML updates you can get.  The updates
    will come in an email that will contain a link to the XML file.  The XML
    files will persist for at least 48 hours.
    
    The first batch update is an "available" batch that will be sent several
    times per day.  It looks like:
    
            <AvailableBatch>
                <Detail>n</Detail>
                <Date>mm/dd/yyyy</Date>    <!-- for the batch! -->
    
                <!--        This will be repeating blocks of <available> -->
                <Available>
                    <Sku>####</Sku>
                    <Loc>###</Loc>   {optional, only if not combined}
                    <Qty>###</Qty>
                    <Time>hh:mm:ss</time>    <!-- (military)-->
                </Available>
            <AvailableBatch>
    
    The second is also an "available" batch but contains more detail.  It will
    be sent once a week.
    
            <AvailableBatch>
                <Detail>y</Detail>
                <Date>mm/dd/yyyy</Date>    <!-- for the batch! -->
    
                <!--        This will be repeating blocks of <available> -->
    
                <Available>
                    <Sku>####</Sku>
                    <Loc>###</Loc>   {optional, only if you gave it to me}
                    <Qty>###</Qty>
                    <Detail>
                        <Desc>########</Desc>
                        <Weight>####</Weight>
                        <Price>###</Price>
                    <Detail>
                    <Time>hh:mm:ss</time>    <!-- (military)-->
                </Available>
            <AvailableBatch>
    
    
    The third is a daily batch of open orders likely to be run in the middle of
    the night.
    
            <OpenOrders>
                <date>mm/dd/yyyy</date>    <!-- for the batch! -->
                <Time>hh:mm:ss</time>
                            <!-- repeating block -->
                <Order>
                    <po>###</po>
                    <OrderNum>###</OrderNum>
                    <Status>###</Status>    <!-- Open or Picking -->
                </Order>
            <OpenOrders>
    ok here is my plan... I plan to create the database for the online store... but what I need is a way to write a script or application that will grab those XML files and update my database at specific times...

    Is there an existing application that will run on the server that can handle this? or should I write my own? or does anyone have a different suggestion?

    The one thing to take into consideration is that they will send me email notification of when these are available to download... so I assume I need a way to check when the email has been recieved and parse the information...

    for example when an order is processed I will recieve an email that will contain the following: Notice it says an email with a link to the XML file...

    Code:
            You will get a batch reply back via email. The email will be a link to the
    XML results.  You will need to download it.
    
    <BatchStatus>
        <Order>                        <!-- repeating block  -->
            <po>##</po>
            <Status>##</Status>
            <Text>blah blah blah</Text> <!-- optional, only if not OK -->
        </Order>
        <Status>##</Status>
        <Text>blah blah blah</Text>    <!-- optional, only if not OK -->
        <Date>mm/dd/yyyy</Date>
        <Time>hh:mm:ss</Time>          <!-- military -->
    </BatchStatus>
    
    
        Possible status:  OK            (in this case Text may not appear)
                          Warning       (got it, liked some of it, see orders)
                          Rejected      (got it, did not like it, your fault :-)
                          Failed        (got it, system error, my fault :-)
            (your/my is not personal comment, indicates which system had error)
    
    
             <OrderDetail>
                <Order>         <!-- block repeats for POs with splits/multi -->
                    <Status>###<Status>
                               <!-- values: invoiced, shipped -->
                               <!-- invoice & shipped have mm/dd/yyyy appended -->
                    <Header>
                        <OrderNum>###</OrderNum>
                        <InvoiceNum###<InvoiceNum>
                        <Location>###</Location>
                        <Shipment>###</Shipment>  <-- zero means no shipments -->
                        <po>###</po>
                                <! optional tags only if shipped and non-zero -->
                        <InvAmt>###.##</InvAmt>
                        <ChargeAmt>###.##</ChargeAmt>
                        <DiscAmt>###.##</DiscAmt>
                        <Shipping>###.##</Shipping>
                        <Tax>###.##</Tax>
                                <! optional tag only if NOT shipped -->
                        <Total>###.##</Total>
    
                        <Terms>##-#####</Terms>  <! -- numeric code dash desc -->
                        <Via>##-#####</Via>  <! -- numeric code dash desc -->
    
                        <BillTo>
                            <Address>
                                <Line1>####</Line1>
                                <Street1>###</Street1>
                                <Street2>###</Street2>  <!-- optional if not blank -->
                                <City>###</City>
                                <State>###</State>
                                <Zip>###</Zip>
                                <Country>###</Country>  <!-- optional, if not USA -->
                                <Residential>#</Residential> <!-- optional Y/N, default Y -->
                            </Address>
                        </BillTo>
    
                        <ShipTo>
                            <Address>
                                <Line1>####</Line1>
                                <Street1>###</Street1>
                                <Street2>###</Street2>  <!-- optional if not blank -->
                                <City>###</City>
                                <State>###</State>
                                <Zip>###</Zip>
                                <Country>###</Country>  <!-- optional, if not USA -->
                                <Residential>#</Residential> <!-- optional Y/N, default Y -->
                            </Address>
                        </ShipTo>
                    </Header>
                    <Line>            <!-- repeats for every line item -->
                        <No>##</No>   <!-- line number -->
                        <Sku>##</Sku>
                        <Location>##</Location>  <!-- optional if not same as Header -->
                        <Ordered>###</Ordered>
                        <Ship>###</Ship>         <!-- optional if shippable/shipped -->
                        <Backorder>###</Backorder>     <!-- optional if NOT shippable/shipped -->
                    </Line>
                                     <!-- optional blocks on UPS only shipments -->
                    <Box>            <!-- repeats for every box if shipped -->
                        <No>##</No>
                        <TrackNum>##</TrackNum>
                    </Box>
                                    <!-- optional tag on NON-UPS shipments if shipped -->
                    <UntrackedBoxes>###</UntrackedBoxes>  <! -- qty -->
                </Order>
                <Date>mm/dd/yyyy</Date>
                <Time>hh:mm:ss</time>    <!-- (military) -->
            </OrderDetail>
    Thanks!! Advice is greatly appreciated!!

    Anjari
    Last edited by Anjari; Jul 3rd, 2005 at 03:00 PM.

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: XML To Database - Databse to XML

    Couldn't you just use the ReadXML method of the dataset object?

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2002
    Location
    Canton, GA
    Posts
    487

    Re: XML To Database - Databse to XML

    Im still new to ASP so I will have to look into that...

    Thanks,

    Anjari

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