Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
|
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 11th, 2008, 09:36 AM
Authorized User
 
Join Date: Jun 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default load XML issue

following code does not work for me.

xmlDoc=document.implementation.createDocument(""," ",null);
xmlDoc.async=false;
xmlDoc.onload= Test();
xmlDoc.load("books.xml");

function Test()
{
    alert('tested');
}

 If any one having any idea then please give me a chance of thanks.

 
Old March 11th, 2008, 09:48 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

You need to assign a function to be called to an event handler, not function call so try
Code:
xmlDoc.onload = Test;
 
Old March 11th, 2008, 10:00 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

First, it really helps to say what technology you are using. This could be Java, C#, Javascript, you name it. It could be running on the server or in the client. Actually I seem to recognize the "async" and "onload" properties from the MSXML product, and I also recognize the tendency of Microsoft users to assume that everyone else is a Microsoft user - so perhaps that gives me a clue.

Secondly, don't tell us "it doesn't work". Tell us what it actually does and what you hoped it might do. We can't extrapolate your requirements simply by looking at incorrect code.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
 
Old March 13th, 2008, 01:41 AM
Authorized User
 
Join Date: Jun 2006
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for ur Time Martin Honnen!
   Issue has been resolved.But now there is error msg
     "Error: uncaught exception: Permission denied to call method
      Location.toString"
      on line
          "xmlDoc.load".
      Not on same Domain but on Cross Domain Only.

 
Old March 13th, 2008, 04:02 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Your questions might be better asked on a Javascript forum as they don't actually have anything to do with XML.

Obviously there is an error trying to call the onload method you've set up, which I'm guessing is no longer called 'Test'. Without seeing your new code it would be hard to make a guess.

/- Sam Judson : Wrox Technical Editor -/
 
Old March 13th, 2008, 09:43 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Inside the browser the same origin policy prevents your script from loading resources from a different origin than the document with your script comes from.
In Firefox 3.0 there will be ways to allow that, see http://developer.mozilla.org/en/docs...XMLHttpRequest






Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I load this xml to a dataset? chepla C# 2005 1 August 11th, 2008 08:51 AM
Can not load XML kolucoms XML 50 May 28th, 2008 05:25 AM
load issue on tomcat nidhik Pro JSP 0 November 17th, 2005 04:13 AM
Load Xml From String ffbalota J2EE 0 January 24th, 2004 06:30 PM
Load Xml From String ffbalota Apache Tomcat 0 January 24th, 2004 06:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.