CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   XML (http://www.codingforums.com/forumdisplay.php?f=3)
-   -   displaying xml in a html page (http://www.codingforums.com/showthread.php?t=284140)

jetus 12-14-2012 03:03 PM

displaying xml in a html page
 
Hello,

I am brand new to learning html.

I am trying to display an simple xml file in a webpage for the first time.

I used the following..

<Xml id=msg SRC="saleinfo.xml" ></xml>

Nothing displays. The xml file is in the same directory, and I can view the xml page in a browser. The xml file has just one record in it.

Thanks in advance for your help!

DaveyErwin 12-14-2012 03:11 PM

Look at this ...
http://www.w3schools.com/xml/xml_dont.asp

jetus 12-15-2012 02:24 AM

Hi Davey;

I re-created the xml and html files from the w3schools link you provided. I still get a blank screen...

It is almost like IE is blocking the xml file from running?? Is there a setting in IE that I should be turning off?

Again thanks for your post!

jetus 12-15-2012 02:28 AM

1 Attachment(s)
There is a "try it yourself>" link, and the code did not work in w3Cshools webpage either?

see the attachment..

DaveyErwin 12-15-2012 12:21 PM

You are not using IE browser,
the xml data island is IE only.

jetus 12-15-2012 03:40 PM

Sorry Davey,

I'm no closer to understanding why or how to display xml code within a html file...

The IE browser is what I am using to open the html file...:confused:

tracknut 12-15-2012 03:56 PM

What version of IE are you using? There was a patch that disabled the XML island functionality on early (IE5-7) browsers for security reasons - maybe it's been disabled on your version? The W2Schools demo works for me in IE9.

But this is really not a good way to import XML, it is IE-specific and dependent on your client's browsers. Using PHP via the SimpleXML interface, or directly through the DOM, or even using JavaScript is a better answer.

Dave

jetus 12-15-2012 04:20 PM

I am using ie9, but thanks for pointing me to SimpleXML, I will look there.

I have a pretty simple situation, and was happy using ie9, and was hoping that it would have worked..

DaveyErwin 12-15-2012 07:11 PM

The browser pictured in the
attatchment is not IE, it
looks like chrome to me.

jetus 12-16-2012 03:26 AM

Davey;

I understand now, you are right! I opened up your link in Chrome by default, then clicked on the "try it yourself", and it did not work. But when I did it in ie9 it worked... Thanks for pointing that out.

When I copied their html code, and xml data file into a sub-directory, I still could not get their example to work on my machine using ie9...
I'll post that in their forums and see what they suggest.
Thanks again for your input.

AndrewGSW 12-23-2012 05:55 PM

Quote:

Originally Posted by rajdeep01 (Post 1301485)
I'd like to display a XML document inside a HTML page as a nicely pretty printed tree structure. I'd like to be able to expand and collapse tree branches. For example Firefox browser does this when you load a plain XML file.

The simplest way would be to load the XML document into an iframe. You are relying on the user's browser to display the collapse/expand tree structure, but this has got to be better than trying to build these yourself. (The user could always copy the XML to an XML-viewer.)

Added: Of course, the XML has to come from the same domain.

Apparently there is an issue with Chrome displaying XML in an iframe.


All times are GMT +1. The time now is 10:25 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.