Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-14-2012, 03:03 PM   PM User | #1
jetus
New to the CF scene

 
Join Date: Dec 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jetus is an unknown quantity at this point
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!
jetus is offline   Reply With Quote
Old 12-14-2012, 03:11 PM   PM User | #2
DaveyErwin
Regular Coder

 
Join Date: Aug 2010
Posts: 806
Thanks: 12
Thanked 168 Times in 166 Posts
DaveyErwin is on a distinguished road
Look at this ...
http://www.w3schools.com/xml/xml_dont.asp
DaveyErwin is offline   Reply With Quote
Old 12-15-2012, 02:24 AM   PM User | #3
jetus
New to the CF scene

 
Join Date: Dec 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jetus is an unknown quantity at this point
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 is offline   Reply With Quote
Old 12-15-2012, 02:28 AM   PM User | #4
jetus
New to the CF scene

 
Join Date: Dec 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jetus is an unknown quantity at this point
There is a "try it yourself>" link, and the code did not work in w3Cshools webpage either?

see the attachment..
Attached Thumbnails
Click image for larger version

Name:	Capture.jpg
Views:	28
Size:	46.0 KB
ID:	11802  
jetus is offline   Reply With Quote
Old 12-15-2012, 12:21 PM   PM User | #5
DaveyErwin
Regular Coder

 
Join Date: Aug 2010
Posts: 806
Thanks: 12
Thanked 168 Times in 166 Posts
DaveyErwin is on a distinguished road
You are not using IE browser,
the xml data island is IE only.
DaveyErwin is offline   Reply With Quote
Old 12-15-2012, 03:40 PM   PM User | #6
jetus
New to the CF scene

 
Join Date: Dec 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jetus is an unknown quantity at this point
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...
jetus is offline   Reply With Quote
Old 12-15-2012, 03:56 PM   PM User | #7
tracknut
Regular Coder

 
Join Date: Aug 2006
Posts: 891
Thanks: 4
Thanked 205 Times in 204 Posts
tracknut is an unknown quantity at this point
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
tracknut is offline   Reply With Quote
Old 12-15-2012, 04:20 PM   PM User | #8
jetus
New to the CF scene

 
Join Date: Dec 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jetus is an unknown quantity at this point
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..
jetus is offline   Reply With Quote
Old 12-15-2012, 07:11 PM   PM User | #9
DaveyErwin
Regular Coder

 
Join Date: Aug 2010
Posts: 806
Thanks: 12
Thanked 168 Times in 166 Posts
DaveyErwin is on a distinguished road
The browser pictured in the
attatchment is not IE, it
looks like chrome to me.
DaveyErwin is offline   Reply With Quote
Old 12-16-2012, 03:26 AM   PM User | #10
jetus
New to the CF scene

 
Join Date: Dec 2012
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
jetus is an unknown quantity at this point
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.
jetus is offline   Reply With Quote
Old 12-21-2012, 08:55 AM   PM User | #11
rajdeep01
New Coder

 
Join Date: Dec 2012
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
rajdeep01 can only hope to improve
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.
rajdeep01 is offline   Reply With Quote
Old 12-23-2012, 05:55 PM   PM User | #12
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Quote:
Originally Posted by rajdeep01 View Post
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.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS

Last edited by AndrewGSW; 12-23-2012 at 05:59 PM..
AndrewGSW is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:05 PM.


Advertisement
Log in to turn off these ads.