jQuery UI Widgets Forums Dialogs and Notifications Window display "raw" xml in jqxwindow

This topic contains 3 replies, has 2 voices, and was last updated by  ivailo 8 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • display "raw" xml in jqxwindow #79230

    kathyl
    Participant

    I am displaying an xml file in a jqxwindow. The xml file is displayed with no carriage returns/newlines. If I display the file via an alert, it displays fine – with all the xml tags, etc, which is exactly what I want. I’d prefer to use jqxwindow though for lots of reasons.
    I currently get the data via ajax to display it:

    		$.ajax({
    			type: "GET",
    			url: value,
    			dataType: "xml",
    			success: function(data, status, jqXHR){  
    				$('#windowHeader').show();
    				$('#windowContent').show();					
    				$("#jqxwindow").jqxWindow('open');      			                      
    				var response = '';                        
    				response = jqXHR.responseText;                                                                     
            		$('#windowContent').text(response);

    I’ve tried wrapping the responseText in <textarea>, <xmp> and

     tags, all without luck.  Any ideas how I can display these files in jqxWindow?  Thanks-
    display "raw" xml in jqxwindow #79247

    ivailo
    Participant

    Hi kathyl,

    You can replace the new lines with <br /> tags.
    You can use RegExp similar to this:
    response.replace(new RegExp('\r?\n','g'), '<br />');

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

    display "raw" xml in jqxwindow #79422

    kathyl
    Participant

    unfortunately, all that does is display the text with <br /> in it…. Here is a sample:

    <?xml version="1.0"?><br /><!DOCTYPE nmaprun><br /><?xml-stylesheet href="file:///usr/bin/../share/nmap/nmap.xsl" type="text/xsl"?><br /><!-- Nmap 6.47 scan initiated Fri Dec 11 19:17:30 2015 as: nmap -PN -T5 -oX test.xml -vv --top-ports 280 xxxx.com --><br /><nmaprun scanner="nmap" args="nmap -PN -T5 -oX test.com.xml -vv --top-ports 280 ........

    And this is how I am calling it:

    $("#jqxwindow").jqxWindow('open');      			
    var response = '';                        
    response += jqXHR.responseText;  
    response = response.replace(/\r?\n/g, "<br  />");    
    $('#windowContent').text(response);
    display "raw" xml in jqxwindow #79439

    ivailo
    Participant

    Hi kathyl,

    This is a simplified demo of this approach.
    You can make the formatting more complex, depending of your needs.

    Best Regards,
    Ivailo Ivanov

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.