DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: opening a new window as *.xml using JavaScript

  1. #1
    Join Date
    Aug 2006
    Posts
    2

    opening a new window as *.xml using JavaScript

    Hello,

    I am new to this site so appologies for any convention exception.

    I have an XML response from server, I am displaying it in a textarea.
    I want to display the result in a new window, which will contain the server response in a xml display, in a java Script + HTML only.

    HTML:
    <TEXTAREA rows="10" cols="100" name="SoapResponse" type="Text"></TEXTAREA>
    <INPUT type="button" Value="View As XML" onClick="ViewXMLResult();" id=button19 name=button19>

    Calling ViewXMLResult - something like:

    function ViewXMLResult() // Displays the response as XML
    {
    strResult = document.all('SoapResponse').value;
    if (strResult.indexOf("HTML")>0)
    strResult=xmlRequest.substring(6,strResult.length);
    //alert (strResult);

    window.open("strResult".xml, "window", "width=640, height=430, menubar=no, resizable=yes, scrollbars=yes, status=yes");
    }

    This is of course not the way, I am looking for the right way to do that so in case the server response is:
    <?xml version="1.0" encoding="UTF-8"?>
    <GET_COUNT COUNT="6"><Game ID="38634"/></GET_COUNT>

    The new window will show:
    - <GET_COUNT COUNT="6">
    <Game ID="38634" />
    </GET_COUNT>

    in a xml manner.

    Thanks for any help !!!

    Tomer90.

  2. #2
    Join Date
    Aug 2003
    Posts
    313
    If you navigate to the page directly (instead of through your script), do you get the correct results? It kinda sounds like the server is sending a content type of something other than text/xml (which is what is needed if you want to view as xml).

    Hope this helps.
    ~evlich

  3. #3
    Join Date
    Aug 2006
    Posts
    2
    Thanks evlich,
    How do you know the content is wrong, if I take the response from Server, paste it in a notepad, and saves as XML, it is opened perfectly in a browser, so the problem is all mine.
    any reposnse starts with :
    <?xml version="1.0" encoding="UTF-8"?>
    <ROOT STATUS="OK"/>

  4. #4
    Join Date
    Nov 2006
    Posts
    1
    Hi tomer90

    I'm also trying to do same thing you were trying, Can you please share with me how to dispaly the XML Response from server to the screen in XML format?

  5. #5
    Join Date
    Aug 2003
    Posts
    313
    When the HTTP server responds to a request, it passes a content type along with the file. Normally it is a configuration option and by default text/xml is sent with files ending in a .xml extension.

    To check the response from the server you can look at your browser and find something called 'Page info'. At least that is what it is called in Firefox. Navigate to the URL, right click and click 'View Page Info'. The dialog box that pops up will list the content type that was received.

    Hope this helps.
    ~evlich

Similar Threads

  1. Regarding closing a pop window
    By Usha.R in forum ASP.NET
    Replies: 1
    Last Post: 02-14-2006, 04:30 AM
  2. ---Re: changing window size with javascript
    By Harish Kumar in forum ASP.NET
    Replies: 0
    Last Post: 11-22-2001, 06:49 AM
  3. javascript window problem
    By john in forum Web
    Replies: 4
    Last Post: 08-22-2001, 07:58 AM
  4. child window - is it or isn't it?
    By TC in forum VB Classic
    Replies: 8
    Last Post: 09-26-2000, 02:34 AM
  5. child window - is it or isn't it?
    By TC in forum VB Classic
    Replies: 0
    Last Post: 09-25-2000, 09:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center