sending XML to asp
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: sending XML to asp

  1. #1
    Senior Member
    Join Date
    Oct 2000
    Posts
    519
    This may be a basic question but it has me stuck. I would like to use the send and load function with an asp script but I don't know how to code the asp to unravel the incoming XML. I'm OK with sending the XML back out again. But what is the equivalent of Request.Form etc when the incoming data is XML??

    Any code snippets or links to tutorials much appreciated.

  2. #2
    Junior Member
    Join Date
    Apr 2001
    Posts
    2
    The ASP should use the Microsoft XML Parser to read the XML elements and traverse the tree.

    To get the XML in, try assigning the whole post data to a variable.

    Dim strXML
    Dim objXML

    strXML = Request.Form
    Set objXML = Server.CreateObject("Microsoft.XMLDOM")
    ' Do manipulation here
    Set objXML = Nothing ' Free it after use


    Here is a userful link

    http://www.w3schools.com/dom/dom_parser.asp

    ---
    Andrew Papierowski
    Online Application Developer

    Ask our Avatar B.O.B at http://avatar.kmpinternet.com/

    kmpinternet.com - E Business Architects
    Manchester London New York Perth

  3. #3
    Senior Member
    Join Date
    Oct 2000
    Posts
    519
    Thanks for the reply, but I'm still a bit confused.

    The code you supplied doesn't seem to explain how srtXML (which holds the whole Form) relates to objXML (the XMLDOM object).

    I've seen the following type of code to actually associate the Form data with the XML object:

    Set objXML = Server.CreateObject("Microsoft.XMLDOM")
    objXML.load(Request)

    ...then manipulate the objXML object

    Is this correct?

    Thanks again.


  4. #4
    Junior Member
    Join Date
    Apr 2001
    Posts
    2
    Flash sends the entire XML object as a string via POST.

    So setting a variable to equal that should get the whole XML string.

    strXML = Request.Form

    The XML Loading method is different depending on where the XML is coming from.

    If the XML is to be loaded form a URL use the .load function.

    objXML.load("http://www.site.com")

    If you have a string or variable, use the loadXML function:

    objXML.loadXML(strXML)

    To Check that you have the XML in that variable from the post do

    Response.Write strXML

    REMEMBER that IE will try and render that XML, so you may get a blank page or the XML tree, in either case a VIEW SOURCE will show you the correct stuff

  5. #5
    Senior Member
    Join Date
    Oct 2000
    Posts
    519
    Cool thanks.

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


HTML5 Development Center

Poll by Flashkit.com