An xml data island work around that work for both IE and NS6+.
support@webapplikations.com

Print Node Names and Node Values   XML Data Island - Works for both NS6+ & IE

  I have written this script to help all those developers who have been bummed by
  the IE specific element <xml></xml>, which is used to create an xml data island
  in IE browsers. The work around below works perfectly in both IE and NS6+ browsers,
  hence solving a pain in the neck issue for NS developers.
  I have not spent allots of time on finding out if there are any standardization issues
  with this approach therefore a feedback is welcome to further refine this approach.

  In IE browsers an IE specific element <xml> is used to create a data island, below is the
  syntax.
  <xml id="xmlIsland" src="someXmlFile.xml"></xml>
  Once this is done then we create an object referring this xml elements id in this manner..
  var xmlDoc = document.all("testXML").XMLDocument;
  Up to this point we did not have any solution for NS browsers, this is solved in the example
  below.
  What I have done is declared a custom element <xml></xml>
  and the "someXMLFile.xml" is copied between the <xml></xml> elements.
  Please refer to the right column of the table below.
  Then assigned an id attribute just as we would in IE and set its visibility to hidden since we
  do not want it to be displayed in the page.
   <xml id="xmlIsland" style="visibility:hidden;"> 

  from this point on rest of the JavaScript/DOM accessing code is same for IE or NS.
  I hope it helps you all out there.

  Cheers

  Khalid Ali


        <xml id="xmlIsland" style="visibility:hidden;">
          <employees>
            <employee>
              <name>Name</name>
              <job>Job</job>
              <department>Department</department>
              <cubicle>Cubicle</cubicle>
            </employee>
            <employee>
              <name>Khalid</name>
              <job>Software Developer</job>
              <department>Engineering</department>
              <cubicle>9E</cubicle>
            </employee>
            <employee>
              <name>Joe</name>
              <job>Programmer</job>
              <department>Engineering</department>
              <cubicle>5E</cubicle>
            </employee>
            <employee>
              <name>Erin</name>
              <job>Designer</job>
              <department>Marketing</department>
              <cubicle>9M</cubicle>
            </employee>
            <employee>
              <name>Melissa</name>
              <job>Designer</job>
              <department>Human Resources</department>
              <cubicle>8H</cubicle>
            </employee>
            <employee>
              <name>Craig</name>
              <job>Administrator</job>
              <department>Engineering</department>
              <cubicle>4E</cubicle>
            </employee>
            <employee>
              <name>Danielle</name>
              <job>Programmer</job>
              <department>Engineering</department>
              <cubicle>12E</cubicle>
            </employee>
            <employee>
              <name>Frank</name>
              <job>Salesperson</job>
              <department>Marketing</department>
              <cubicle>17M</cubicle>
            </employee>
            <employee>
              <name>Corinne</name>
              <job>Programmer</job>
              <department>Technical Support</department>
              <cubicle>19T</cubicle>
            </employee>
          </employees>
        </xml>
      

This script is intentionaly optimised for NS6+ and IE5+ browsers.
If you are one of those who still are using lesser browsers,you may find
some parts of these applications breaking on you here and there.:-)
Too bad.

Home ]   [ About Us ]   [ Services ]   [ Support ]   [ Computers ]   [ Policy ]   [ Contact Us ]  

© webapplikations.com 2002-2003