> I need to do the following in a web app
> 1. Allow user to select XML file they want to upload
> 2. Make this file (or its contents) accessible to server
> side ASP as either a recorset or via DOM
> 3. Loop through each record and use a stored procedure to
> validate its contents and populate a SQL table.
> Is there a method to copy the XML file from client to
> server or should I pass the XML string via a text area? I
> tried the later and was getting an error parsing the XML -
> "Invalid at top of document" I think
The easiest way to achieve this would probably be to get the document on the
client side and then do a http post of the document to the server.
So to do this you are going to need to create some client side script that
will open the XML document the user specifies. It's been awhile since I've
done any serious client side scripting, but I'm pretty sure you will run
into some security issues on this. You may just have to instruct the user
that you are going to access his file and to click ok if any warning pop up.
Once you have loaded the XML into a DOM object, you can then use the XMLHTTP
object to post it to the server. Just specify the DOMDocument.xml as the
text to send.
Once it has been sent to the server you will need to use an ASP page to
accept the document. You can load it into another DOM object via the
DOMDocument.load function by passing it the Request object. From there you
can pass the xml to a stored procedure using ADO. The stored procedure can
then load the XML and parse it using OPENXML, and then insert it into the
Of course this is all just a conceptual idea of how this could be done. If
you need more specific help post your specific questions.