Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Ajax ISBN: 978-0-471-77778-6
This is the forum to discuss the Wrox book Professional Ajax by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780471777786
Important: For the new 2nd edition of this book, please post here instead: [url="http://p2p.wrox.com/forum.asp?FORUM_ID=307"]http://p2p.wrox.com/forum.asp?FORUM_ID=307[/url]
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax ISBN: 978-0-471-77778-6 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 10th, 2006, 01:06 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to kaos_frack
Default having problem with zXmlDom

hello everyone
i was creating an ajax based file manager for managing remote files.
at home i have installed apache and php on windows and test my php scripts there
it is working fine on my pc at home
but when i uploaded to my hosting space it is causing some errors
to check the error i have put an alert statement:
Code:
var oXmlDom = zXmlDom.createDocument();
oXmlDom.loadXml(sResponseText);
alert(oXmlDom.childNodes[1]); // alerting 'null'
and here's the content of sResponseText:
Code:
<?xml version="1.0" encoding="utf-8"?>
<response>
†††<msg>bla bla bla</msg>
†††<cd>bla bla bla</cd>
†††<listing>
    ††<item>
        †<name>.</name>
        †<size>[DIR]</size>
        †<perms>755</perms>
        †<path>/home/sumtin/public_html</path>
    ††</item>
    ††<item>
        †<name>..</name>
        †<size>[DIR]</size>
        †<perms>755</perms>
        †<path>/home/sumtin/public_html</path>
    ††</item>
†††</listing>
</response>
again at home i'm testing on windows my server is probably linux
but i don't think this matters
Reply With Quote
  #2 (permalink)  
Old May 10th, 2006, 07:03 AM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

It could be wrong, but I believe your case is wrong. It should be loadXML(), not loadXml(). That may be your problem.

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
  #3 (permalink)  
Old May 10th, 2006, 07:30 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to kaos_frack
Default

oh sorry actually i've written it correctly in my file manager
i mistyped it here, in this thread
and as i said it is working fine on my home pc
Reply With Quote
  #4 (permalink)  
Old May 10th, 2006, 07:40 AM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

In that case, I'm not sure what the problem may be. Are you sure that sResponseText actually returns something on your server? Perhaps you're missing the XML file you're trying to load?

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
Reply With Quote
  #5 (permalink)  
Old May 10th, 2006, 07:45 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to kaos_frack
Default

actually xml is echoed by php
the script reads the directory and prints the xml
it is really strange that it is not working
i'm loading the page with the same browser and version
ok, when i find out the problem i'll let you know if you want

Reply With Quote
  #6 (permalink)  
Old May 11th, 2006, 08:22 PM
jmcpeak's Avatar
Wrox Author
Points: 361, Level: 6
Points: 361, Level: 6 Points: 361, Level: 6 Points: 361, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 77
Thanks: 0
Thanked 12 Times in 12 Posts
Default

Is the Content-type header set to text/xml in your PHP code?

------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
Reply With Quote
  #7 (permalink)  
Old May 11th, 2006, 11:40 PM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to kaos_frack
Default

yes
header("Content-Type: text/xml");

Reply With Quote
  #8 (permalink)  
Old May 12th, 2006, 08:56 AM
jmcpeak's Avatar
Wrox Author
Points: 361, Level: 6
Points: 361, Level: 6 Points: 361, Level: 6 Points: 361, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 77
Thanks: 0
Thanked 12 Times in 12 Posts
Default

Have you tried seeing what value responseText has?

------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
Reply With Quote
  #9 (permalink)  
Old May 14th, 2006, 11:28 PM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to kaos_frack
Default

yes
the response text was valid xml
as i've posted in the first post
finally i've decided to get the response text and parse through it
instead of using xmldom

Reply With Quote
  #10 (permalink)  
Old May 17th, 2006, 10:05 AM
jmcpeak's Avatar
Wrox Author
Points: 361, Level: 6
Points: 361, Level: 6 Points: 361, Level: 6 Points: 361, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2005
Location: , Texas, USA.
Posts: 77
Thanks: 0
Thanked 12 Times in 12 Posts
Default

Heh. I need to learn to read.

If I may ask, why are you using the childNodes list to test the document? In all of my tests oXmlDom.childNodes[1] returns undefined. Did you try oXmlDom.documentElement (both at home and on your live server)?

Lastly, is there a URL we can look at. It's one thing to be told how it is; it's another to see it. I know you're parsing it now, but using the DOM's much easier ;)

------------------------
Jeremy McPeak
Author, Professional Ajax
http://www.wdonline.com
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
ch5 Fooreader zxmlDom is undefined razzzzer BOOK: Professional Ajax ISBN: 978-0-471-77778-6 2 February 8th, 2007 04:01 AM



All times are GMT -4. The time now is 10:48 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.