473,396 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

writing xml to a ModalDialog window

1
I am trying to display xml content in a modaldialog window using window.showModalDialog(), but a blank modaldialog window is displayed.

can anyone help me with this. Any other way present to display xml in modal dialog window and also to dispaly both html and xml content in a single modaldialog.

Any help would be appreciated.

Thanks in advance.
Praan
Aug 29 '06 #1
6 3099
mione
4
I am trying to display xml content in a modaldialog window using window.showModalDialog(), but a blank modaldialog window is displayed.
I am having the same problem - does anyone have an answer?

------------ Example---------------------
eg01.xml
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <?xml-stylesheet type="text/xsl" href="eg01.xsl" ?>
  3. <catalog>
  4.   <cd>
  5.     <title>Empire Burlesque</title>
  6.     <artist>Bob Dylan</artist>
  7.     <country>USA</country>
  8.     <company>Columbia</company>
  9.     <price>10.90</price>
  10.     <year>1985</year>
  11.   </cd>
  12. </catalog>
  13.  
eg01.xsl
Expand|Select|Wrap|Line Numbers
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <xsl:stylesheet version="1.0"
  3. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  4. <xsl:template match="/">
  5.   <html>
  6.   <body>
  7.     <h2>My CD Collection</h2>
  8.     <table border="1">
  9.     <tr bgcolor="#9acd32">
  10.       <th align="left">Title</th>
  11.       <th align="left">Artist</th>
  12.     </tr>
  13.     <xsl:for-each select="catalog/cd">
  14.     <tr>
  15.       <td><xsl:value-of select="title"/></td>
  16.       <td><xsl:value-of select="artist"/></td>
  17.     </tr>
  18.     </xsl:for-each>
  19.     </table>
  20.   </body>
  21.   </html>
  22. </xsl:template>
  23. </xsl:stylesheet>
  24.  
TestModalXML.html
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <TITLE class="title">
  4. Testing XML via Modal dialog
  5. </TITLE>
  6. </head>
  7. <body>
  8. <INPUT TYPE="BUTTON" NAME="xxx" VALUE="show modal dialog" onClick="showModalDialog('http://xxx.xxx/eg01.xml',1,'dialogWidth:1024px; dialogHeight:768px; center:yes')">
  9. </body>
  10. </html>
  11.  
Aug 1 '07 #2
acoder
16,027 Expert Mod 8TB
showModalDialog only works in IE. Try to use a standard window.open instead.
Aug 1 '07 #3
mione
4
showModalDialog only works in IE. Try to use a standard window.open instead.
1) I only need it to work in IE
(users access the intranet site I'm working on via locked down PC's)

2) I idealy need the XML to be displayed in a modal dialog, as opposed to just displaying it in a new window
Aug 1 '07 #4
acoder
16,027 Expert Mod 8TB
1) I only need it to work in IE
(users access the intranet site I'm working on via locked down PC's)

2) I idealy need the XML to be displayed in a modal dialog, as opposed to just displaying it in a new window
I can suggest you this link. Let me know if it works.
Aug 1 '07 #5
mione
4
I can suggest you this link. Let me know if it works.
A useful link, Thanks :)

It doesn't solve my problem unfortunately as the url I want to pass as an argument to the showModalDialog returns the XML I'm trying to display thus I can't pass the xml to the ModalDialog as a dialogArgument as their example does.

It also doesn't explain why
Expand|Select|Wrap|Line Numbers
  1. showModalDialog("http://xxx.xxx/eg01.xml")
  2.  
doesn't work but
Expand|Select|Wrap|Line Numbers
  1. window.open("http://xxx.xxx/eg01.xml")
  2.  
does.

It has given me some ideas for a possible work around though, which I'm going to persue
Aug 2 '07 #6
mione
4
I can suggest you this link. Let me know if it works.
The link turned out to be very useful thanks!!!

1) Based on what I've seen looking at this issue I think that the problem stems from the modal dialog ignoring the mime type and treating the xml as html

2) The solution I've got working, if not particularly tidily, relies on javascript loading the xml into an html page on load.......

change the url passeed to the modal dialog in TestModalXML.html
Expand|Select|Wrap|Line Numbers
  1. ...showModalDialog('http://xxx.xxx/eg01.html'....
  2.  
eg01.html
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.  
  4. <XML id="eg01xml">
  5. <catalog>
  6.   <cd>
  7.     <title>Empire Burlesque</title>
  8.     <artist>Bob Dylan</artist>
  9.     <country>USA</country>
  10.     <company>Columbia</company>
  11.     <price>10.90</price>
  12.     <year>1985</year>
  13.   </cd>
  14. </catalog>
  15. </XML>
  16.  
  17. <XML id="eg01xsl">
  18. <xsl:stylesheet version="1.0"
  19. xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  20.  
  21. <xsl:template match="/">
  22.   <html>
  23.   <body>
  24.     <h2>My CD Collection</h2>
  25.     <table border="1">
  26.     <tr bgcolor="#9acd32">
  27.       <th align="left">Title</th>
  28.       <th align="left">Artist</th>
  29.     </tr>
  30.     <xsl:for-each select="catalog/cd">
  31.     <tr>
  32.       <td><xsl:value-of select="title"/></td>
  33.       <td><xsl:value-of select="artist"/></td>
  34.     </tr>
  35.     </xsl:for-each>
  36.     </table>
  37.   </body>
  38.   </html>
  39. </xsl:template>
  40.  
  41. </xsl:stylesheet>
  42. </XML>
  43.  
  44. <script type="text/javascript">
  45.  function testLoad() {
  46. var xmldom = new ActiveXObject("msxml2.DOMDocument");
  47. xmldom.async = false;
  48. xmldom.resolveExternals = false;
  49. xmldom.loadXML(eg01xml.innerHTML);
  50. var xsldom = new ActiveXObject("msxml2.DOMDocument");
  51. xsldom.async = false;
  52. xsldom.resolveExternals = false;
  53. xsldom.loadXML(eg01xsl.innerHTML);
  54. var outputdom = new ActiveXObject("msxml2.DOMDocument");
  55. outputdom.async = false;
  56. outputdom.resolveExternals = false;
  57. xmldom.transformNodeToObject(xsldom, outputdom);
  58. divTarget.innerHTML = outputdom.xml;
  59.  }
  60.  
  61. </script>
  62. </head>
  63. <body onLoad="testLoad()">
  64. <div id="divTarget"></div>
  65. </body>
  66. </html> 
  67.  
Aug 3 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Dan Stromberg | last post by:
I'd like to examine what's involved in writing a screensaver for linux (xscreensaver) using python, and who-knows-what GUI toolkit. I looked over pygtk2, pygame, and wxpython, but none seem able...
7
by: Miktor | last post by:
At the minute I am using the following rather unwieldy function to prevent the console window in Dev C++ from closing before I can see the output from my program: // function to prevent the...
2
by: laks | last post by:
Hi I'm opening an aspx page with javascript: window.showModalDialog("mypage.aspx", "", "status:no"); In mypage.aspx I've got a button which shall first save the displayed record in the C# code...
5
by: Rabia | last post by:
I am using the window.open() with modal=yes to simulate the pop up window as modalDialog in mozilla/firefox. The pop-up window (child) has a few options which the user selects and then click the...
0
by: Manpreet | last post by:
Hi, I have a web part page with a toolbar webpart and a grid webpart. In the toolbar, I have menu-items to update a field. For selecting the value of the field I have another asp.net webform...
0
gchq
by: gchq | last post by:
Hi there Is it possible to halt the execution of code to allow a ModalDialog window to open and return a value?
1
fayazmd
by: fayazmd | last post by:
Hi, I am creating a webpage having GridView. In GridView i have a column Accolades, a link button column. On clicking of Accolades, a modal window is opened. That modal window has a gridview,...
1
by: Ramachand | last post by:
Actually I have to call a dialog window "Dwin1" from a Parent Window. From Dwin1, I have to call another Dialog Window "Dwin2".if user close the Dialog Window "Dwin2", i have to refersh the Dwin1....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.