www.webdeveloper.com
Results 1 to 4 of 4

Thread: Variable substitution in XML - IE parsing.

  1. #1
    Join Date
    Apr 2012
    Posts
    17

    Variable substitution in XML - IE parsing.

    Hello everyone.
    I used javascript code to read a simple and specific xml file into html. I just accomplished that with no sweat. But after awhile I became aware of alot of redundancy within the text, so I've tried entities to lightweight a bit the xml files. Entities can act as variables in XML: The following code works 100% on Firefox, Opera, Chrome and Safari:
    Code:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE info [
    <!ENTITY asjc "Walter Rodder Fairy">
    <!ENTITY em "craigwerteston@aol.au">
    <!ENTITY au "Craig Werteston">
    ]>
    <info>
    	<pais id="NZ">
    		<ref nr="1">
    			<lic>0</lic>
    			<titl>&asjc;</titl>
    			<mail>&em;</mail>
    			<aut>&au;</aut>
    			<data>March of  2012</data>
    			<desc>Description stuff, blah, blah</desc>
    		</ref>
    	</pais>
    </info>
    And there's IE and why so many people think it sucks . I am using IE8 for testing and after reading the XML file somehow it doesn't understand the entity var and parses a NULL value. The other text which is not an entity it goes well. Can somebody know some good solution for this? I have been told that IE9 works fine, but didn't checked it. Thanks.

  2. #2
    Join Date
    Oct 2009
    Posts
    658
    Not sure what you see on IE8 but running IE9 with IE8 Standards and IE8 Browser Mode seems ok. Just in case did you turn on the feed view?

  3. #3
    Join Date
    Apr 2012
    Posts
    17
    Quote Originally Posted by ssystems View Post
    Not sure what you see on IE8 but running IE9 with IE8 Standards and IE8 Browser Mode seems ok. Just in case did you turn on the feed view?
    Thanks for answering ssystems. Yes, feed view is turned on in my IE8.
    What I see is the following, according with the XML data above:

    Code:
    0
    null
    null
    null
    March of 2012
    Description stuff, blah, blah
    On the other hand, all the other major browsers write the variable instead of null.

  4. #4
    Join Date
    Oct 2009
    Posts
    658
    That's interesting. IE9's IE8 mode is not accurate after all. Too lazy to setup a VM for an IE8 (which I probably should considering the new info)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles