Whats wrong with w3 schools example?
Hello, I am trying to get this w3 schools example working for what I need. Either one of their 2 examples on their page. It works fine in my browser viewing their page but when I put it in one of my own I can't get it to work. Instead of their local path to an xml document, I even use a full address just to make sure everything is working like it should. Are they just calling one one section of an xml document? If so can you tell which section it is? Or can someone try this and tell me what I am doing wrong?
Since I can view theirs that is a good sign at least, it tells me I should be able to use it once I figure out where my error is. Thank you very much. The link to their example page.
http://www.w3schools.com/e4x/e4x_why.asp
[757 byte] By [
Melanie] at [2007-11-11 9:58:09]

# 1 Re: Whats wrong with w3 schools example?
How can we find the error without seeing the code?
JPnyc at 2007-11-11 23:28:26 >

# 2 Re: Whats wrong with w3 schools example?
The code is right under the link I gave, its easier following their instructions. I tried both their versions with no luck. I put the full address to the xml file in both addresses on the first example.
# 3 Re: Whats wrong with w3 schools example?
And what is the problem in the code ?
Use "Tryit editor" and test yourself the code .
Amahdy at 2007-11-11 23:30:25 >

# 4 Re: Whats wrong with w3 schools example?
I tested both their examples like I said above. All I get is a blank page when I try it online viewing my page with their examples through different browsers. Yet the browsers view it fine when I look at w3's pages. Did it work for you? Thanks.
# 5 Re: Whats wrong with w3 schools example?
Ok i got their first example working sort of. Turns out their xml file here
http://www.w3schools.com/e4x/note.xml had a bunch of junk in the top that wasn't supposed to be there. But their first example wont work in opera or mozilla. On their second example that is supposed to be better, the don't say how to use it so I couldn't get it working at all. I tried between script tags, without script tags, in the head and in the body with no luck. If anyone ever tests these and figures it out, please tell me what you did to get them working. Thanks.
# 6 Re: Whats wrong with w3 schools example?
Your note.xml must be some thing like that :
<body>Don't forget me this weekend!</body>
In your example it must be :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<note time="12:03:46">
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>
put this xml near your html file it must work well.. I think the problem is with a simple built in xml editor in your web browser when you open the note.xml link .
Amahdy at 2007-11-11 23:33:27 >

# 7 Re: Whats wrong with w3 schools example?
Thanks, that helped a bit, using this
<body>Don't forget me this weekend!</body>
but mozilla and opera won't stop loading on their first example.
On their second example.
It says XML is undefined.
<html>
<head>
<script type="text/javascript">
var xmlDoc=new XML()
xmlDoc.load("http://website.com/note.xml")
document.write(xmlDoc.body)
</script>
</head>
<body onload="loadXML()">
</body>
</html>
Can anyone see what is undefined in the just above? Thanks.
# 8 Re: Whats wrong with w3 schools example?
Okey but It must also run with the second one with fully feautured xml file.
about the second one , tell me where is it exactly, your problem is with this line I think :
<body onload="loadXML()">
What is mising here ; check again or give me the link .
Amahdy at 2007-11-11 23:35:26 >
