0

I am working with some software that sends and receives XML... and for debugging purposes it's obviously helpful to look at what's getting passed back and forth. IE does a great job of word wrapping and formatting SINGLE xml files... but I am kinda stuck on how to apply the same functionality to iframes in an HTML page.

Load up an XML file in IE... I want to do this with dynamically generated XML (3 sometimes 4 or 5 xml files) inline for debugging purposes.

I tried the following:

<iframe width="800" height="600"><xml><node>stuff</node></xml></iframe>

But that just shows an empty iframe. I am also wrapping my XML in tags right now... and for some reason the XML just doesn't show up on the page.

Any suggestions better than copy/pasting the XML into a file and opening it in IE every time I want to look at my request/response XML?

DirtyBirdNJ
  • 574
  • 10
  • 26
  • the iframe must alays point to a file. As far as I'm aware, you can't just drop code into an iframe to view it. – Jamie Dixon Jun 17 '11 at 14:57

3 Answers3

1

iframe can have src element which may point to a file, so copy & pasta it programaticlly ( dump output to a file and point iframe to id )

Adam
  • 21
  • 2
  • I tried outputting the xml into the src="" attribute but that just made IE show the "page cannot be found" error. If I can avoid it I don't want to create a bunch of extra files I'll have to remember to delete later. – DirtyBirdNJ Jun 17 '11 at 14:59
0

If you're sending and receiving the XML over HTTP, I'd use a HTTP viewer (sniffer) to see the request and responses in real time.

I tend to use Fiddler for this kind of thing.

Jamie Dixon
  • 53,019
  • 19
  • 125
  • 162
  • Very cool freeware program I like it a lot... unfortunately this won't display XML nicely like IE does. I see a single request that generates all my xml... in the inspectors tab there's even an "XML" tab but because the response isn't 100% xml I guess it shows nothing. – DirtyBirdNJ Jun 17 '11 at 15:24
0

You may want to try some of the suggestions from this question: Pretty printing XML with javascript

Community
  • 1
  • 1
bronsoja
  • 799
  • 4
  • 8