• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 438
  • Last Modified:

Loading XML file from a Web Server.

Greetings to all,

I have what I hope will be a quick question.   I have and OWC Pivot Table on a web page.  I am saving the layout to the server using the XMLData property.  This part is working fine.  Now, I am trying to load the saved file and bind it to the Pivot Table.   I know how I need to bind the data once I retrieve it from the server.  However, I am not sure of the syntax to retrieve the file.   The following is my code that I used to save the layout:

Client Side HTML:                

   {
      myStr = pivot.XMLData
      var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      xmlhttp.Open("POST", "http://Reports.Alro.Com/SaveXML.asp", false);
      xmlhttp.Send(myStr);
            
   }


Server Side ASP:

<%
      
dim xml
set xml = Server.CreateObject("Msxml2.DOMDocument")

xml.load(Request)

xml.Save("E:\Sites\reports.alro.com\DailySales_STD.xml")


%>

I'm guessing that the ASP file has to load the document and pass it back to the Web page.  I'm a definite XML noobie and just don't have my head around this yet.

Thanks in advance for your help.

Keith
0
kdwood
Asked:
kdwood
  • 3
  • 3
1 Solution
 
rdcproCommented:
If all you want is to save, then send the same XML back to the client, you can do it like:

<%
     
dim xml
set xml = Server.CreateObject("Msxml2.DOMDocument")

xml.load Request

xml.Save "E:\Sites\reports.alro.com\DailySales_STD.xml"

xml.Save Response

%>

Regards,
Mike Sharp
0
 
kdwoodAuthor Commented:
Greetings Mike,

I think you are 99% percent where I need to be.  The only difference is that the XML that will be sent back to the Pivot Table will be chosen from a pick list and would not happen in the same Post operation as you show above.   So for instance, as a user, you would work with the Pivot Table and save your layout to an XML file.  At a later date, you would be able to select one of your saved configurations.

So I just need to know how to load a saved XML file from an ASP page and send the XML as a string back to the HTML web page?  Then I would use the myPivot.XMLDATA = "myXMLString" to recall the Pivot Table Layout.

Thanks for your response and help,

Keith
0
 
rdcproCommented:
Ok, that's easy enough.  If you're using virtual paths, make sure you use Server.MapPath:


<%
     
dim xml
set xml = Server.CreateObject("Msxml2.DOMDocument")

xml.load Server.MapPath("Virtual/Path/To/XML.xml")

xml.Save Response

%>

However, this might not even be needed, if the XML files can be downloaded directly.  For example:

http://myserver/Virtual/Path/To/XML.xml

would do the same thing.  They would, of course, need to be on the same domain.

Regards,
Mike Sharp
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kdwoodAuthor Commented:
Greeting Mike,

Geezzz I making you work hard for this one.   Ok...I am so close, I think it is down to my Client side code.   Just to verify that I am retrieving the proper file I would like to display what is returned from your ASP example above.   I am a bit confused on the Post vs. Get operation and how the ASP file responds.  

This is what I have:


function GetXML()

{

var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

xmlhttp.Open("Get", "http://Reports.Alro.Com/LoadRPT.asp", false);
xmlhttp.Send();

divDisplay.innerHTML=xmlhttp.responseText;

}
0
 
rdcproCommented:
Well, since the returned text is XML, it's not going to get displayed in the browser.  Try creating a textarea and writing the innerHTML to that.

<textarea id="taDisplay"></textarea>

taDisplay.innerHTML=xmlhttp.responseText;

Regards,
Mike Sharp
0
 
kdwoodAuthor Commented:
Mike,

I decided not to put much time into displaying the results to the browser.  

However, using your direction I was able to bind the PivotTable.XMLDATA to the XMLHTTP.responseText and it worked like a charm.

Thanks for all of your help.

Keith
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now