Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 11 of 11
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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!

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    966
    Thanks
    19
    Thanked 211 Times in 209 Posts

  • #3
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #4
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    There is a "try it yourself>" link, and the code did not work in w3Cshools webpage either?

    see the attachment..
    Attached Thumbnails Attached Thumbnails displaying xml in a html page-capture.jpg  

  • #5
    Regular Coder
    Join Date
    Aug 2010
    Posts
    966
    Thanks
    19
    Thanked 211 Times in 209 Posts
    You are not using IE browser,
    the xml data island is IE only.

  • #6
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #7
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,224
    Thanks
    10
    Thanked 269 Times in 268 Posts
    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

  • #8
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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..

  • #9
    Regular Coder
    Join Date
    Aug 2010
    Posts
    966
    Thanks
    19
    Thanked 211 Times in 209 Posts
    The browser pictured in the
    attatchment is not IE, it
    looks like chrome to me.

  • #10
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #11
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    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.
    Last edited by AndrewGSW; 12-23-2012 at 05:59 PM.
    "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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •