Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Logicaly selecting a section of XML

Logicaly selecting a section of XML

Scheduled Pinned Locked Moved XML / XSL
questionjavascripthtmltoolsxml
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Haun the 2nd
    wrote on last edited by
    #1

    Ok so I made an XML data sheet that works fine, but i know i will need the data. So i need to be able to make the XML display the correct info according to the id="" How do I do this? script.js: //parser start var xmlDoc; function loadXML(){ //load xml file // code for IE if (window.ActiveXObject) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("product_info.xml"); getmessage(); } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xmlDoc=document.implementation.createDocument("","",null); xmlDoc.load("product_info.xml"); xmlDoc.onload=getmessage; } else { alert('Your browser cannot handle this script'); } } // Actual message maker function getmessage() { document.getElementById("name").innerHTML=xmlDoc.getElementsByTagName("name")[0].childNodes[0].nodeValue; document.getElementById("file_size").innerHTML=xmlDoc.getElementsByTagName("file_size")[0].childNodes[0].nodeValue; document.getElementById("summary").innerHTML=xmlDoc.getElementsByTagName("summary")[0].childNodes[0].nodeValue; document.getElementById("version").innerHTML=xmlDoc.getElementsByTagName("version")[0].childNodes[0].nodeValue; } //parser end function dio(){ window.open("dio.html") } dio.html: Product Info

    Product Information

    File Name:
    File Size:
    File Summary:
    File Version:

    product_info.xml: Bustin' Blox 2 Mb Our version of Brick. Only One Level (Kinda Sucks) 1.0.0

    H 1 Reply Last reply
    0
    • H Haun the 2nd

      Ok so I made an XML data sheet that works fine, but i know i will need the data. So i need to be able to make the XML display the correct info according to the id="" How do I do this? script.js: //parser start var xmlDoc; function loadXML(){ //load xml file // code for IE if (window.ActiveXObject) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async=false; xmlDoc.load("product_info.xml"); getmessage(); } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xmlDoc=document.implementation.createDocument("","",null); xmlDoc.load("product_info.xml"); xmlDoc.onload=getmessage; } else { alert('Your browser cannot handle this script'); } } // Actual message maker function getmessage() { document.getElementById("name").innerHTML=xmlDoc.getElementsByTagName("name")[0].childNodes[0].nodeValue; document.getElementById("file_size").innerHTML=xmlDoc.getElementsByTagName("file_size")[0].childNodes[0].nodeValue; document.getElementById("summary").innerHTML=xmlDoc.getElementsByTagName("summary")[0].childNodes[0].nodeValue; document.getElementById("version").innerHTML=xmlDoc.getElementsByTagName("version")[0].childNodes[0].nodeValue; } //parser end function dio(){ window.open("dio.html") } dio.html: Product Info

      Product Information

      File Name:
      File Size:
      File Summary:
      File Version:

      product_info.xml: Bustin' Blox 2 Mb Our version of Brick. Only One Level (Kinda Sucks) 1.0.0

      H Offline
      H Offline
      Haun the 2nd
      wrote on last edited by
      #2

      hallo? Any one there?

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups