?
Solved

Loading XML file from a Web Server.

Posted on 2005-03-07
6
Medium Priority
?
431 Views
Last Modified: 2012-05-05
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
Comment
Question by:kdwood
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 26

Expert Comment

by:rdcpro
ID: 13482635
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
 
LVL 10

Author Comment

by:kdwood
ID: 13486886
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
 
LVL 26

Expert Comment

by:rdcpro
ID: 13490166
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
Interactive Way of Training for the AWS CSA Exam

An interactive way of learning that will help you visualize core concepts so that you can be more effective when taking your AWS certification exam.  Built for students by a student to help them understand the concepts that they are being taught.

 
LVL 10

Author Comment

by:kdwood
ID: 13490870
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
 
LVL 26

Accepted Solution

by:
rdcpro earned 2000 total points
ID: 13490988
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
 
LVL 10

Author Comment

by:kdwood
ID: 13495330
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

Basic Security of Your VPC

So, you’ve got this shiny new VPC and a fancy new application configured on your EC2 servers ready to go. This application is only accessible from your computer, which is great for security, but you need your users to be able to access it! So, what’s the easiest way to do this?

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question