Guest_imported
New member
- Jan 1, 1970
- 0
Hi.. I cant get my getElementbyId() method to work...
I have an XML file with a DTD declaration at the type.. defining several attributes as type 'ID'.. In the XML I try to get the elementname into a variable so i may do as I wish later.. i've tried everything I can think of... Following is the XML + DTD, and the javascript used to import it using w3c's DOM and ms's activex object...
The only thing im concerned with now is the getElementbyId.. not any other obvious errors that you may see.. lol... P.S.. I realize the code is simple... I have the same problem on a much larger section of code.. and am was just trying somethign smaller to eliminate all other errors... Thanks.. Joss
and the XML....
I have an XML file with a DTD declaration at the type.. defining several attributes as type 'ID'.. In the XML I try to get the elementname into a variable so i may do as I wish later.. i've tried everything I can think of... Following is the XML + DTD, and the javascript used to import it using w3c's DOM and ms's activex object...
The only thing im concerned with now is the getElementbyId.. not any other obvious errors that you may see.. lol... P.S.. I realize the code is simple... I have the same problem on a much larger section of code.. and am was just trying somethign smaller to eliminate all other errors... Thanks.. Joss
Code:
<script>
function xmltest()
{
var myXML, root, Name, Item, ProductNode, Title, Picture_Loc, Product_Description, Category, Cat_pic_loc, Price, Product, Ret
myXML=new ActiveXObject("Microsoft.XMLDOM")
myXML.async="false"
myXML.load("test.xml")
root = myXML.documentElement
Item = myXML.getElementById("_6")
a1.innerText = Item.firstChild.text //product-->id
//a2.innerText = Item.firstChild.text //product-->productheader
}
</script>
and the XML....
Code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE test [
<!ELEMENT test (product)>
<!ELEMENT product (#PCDATA)>
<!ATTLIST product id ID #REQUIRED>
]>
<test>
<product id="_6">hi</product>
</test>