DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: Whats wrong with w3 schools example?

  1. #1
    Join Date
    Dec 2006
    Posts
    8

    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

  2. #2
    Join Date
    Jan 2005
    Posts
    413
    How can we find the error without seeing the code?

  3. #3
    Join Date
    Dec 2006
    Posts
    8
    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.

  4. #4
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    And what is the problem in the code ?

    Use "Tryit editor" and test yourself the code .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  5. #5
    Join Date
    Dec 2006
    Posts
    8
    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.

  6. #6
    Join Date
    Dec 2006
    Posts
    8
    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.

  7. #7
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    Your note.xml must be some thing like that :

    Code:
      <body>Don't forget me this weekend!</body>
    In your example it must be :

    Code:
      <?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 .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  8. #8
    Join Date
    Dec 2006
    Posts
    8
    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.

  9. #9
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    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 .
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

Similar Threads

  1. Can't find error, whats wrong here?
    By Neutron in forum Java
    Replies: 1
    Last Post: 12-20-2005, 03:50 AM
  2. Crystal Report displays wrong value.
    By Shilpa in forum VB Classic
    Replies: 0
    Last Post: 12-13-2005, 03:59 AM
  3. What's wrong with this?
    By Alan Bell in forum .NET
    Replies: 1
    Last Post: 04-01-2002, 11:02 PM
  4. please tell me i'm wrong!
    By mark in forum .NET
    Replies: 9
    Last Post: 03-31-2002, 11:14 AM
  5. arguments are of the wrong type
    By Richard Kalis in forum VB Classic
    Replies: 1
    Last Post: 03-20-2002, 12:31 PM

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center