• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 209
  • Last Modified:

XML parsing using javascript

What I am trying to do is validate XML string in JavaScript. OK. I
have the XML string which has the DTD information also in it.

<?xml version = '1.0'?><!DOCTYPE DataFlowControl SYSTEM
'C:\\Inetpub\\wwwroot\\XMLCreate\\bin\\DFCRules3.dtd'><DataFlowControl
Name=\"ss\" Threads=\"2\" DFCType=\"KeepAlive\" BatchTime=\"sss\"
PerfMon=\"on\"></DataFlowControl>

Now when I write following in JavaScript:

xmlDoc.loadXML(createform.saveStr.value);
               if (xmlDoc.readyState==4)
                       alert("XML file loaded!");
               if(xmlDoc.parseError != 0)
               {
                       alert("errorCode: " + xmlDoc.parseError.errorCode + "\n" +
                                 "filepos: " + xmlDoc.parseError.filepos + "\n" +
                 "line: " + xmlDoc.parseError.line + "\n" +
                 "linepos: " + xmlDoc.parseError.linepos + "\n" +
                 "reason: " + xmlDoc.parseError.reason + "\n" +
                 "srcText: " + xmlDoc.parseError.srcText + "\n" +
                 "url: " + xmlDoc.parseError.url);

                       return false;
               }
               else
               {
                       alert("Valid XML file ready to save");
                       return true;
               }

The first line itself ie: xmlDoc.loadXML(createform.saveStr.value);
gives a runtime error saying "msxml3.dll: Access is denied. Error
processing resource
'C:\\Inetpub\\wwwroot\\XMLCreate\\bin\\DFCRules3.dtd'"

I do not know why this error is appearing. This DFCRules3.dtd is there
in the directory. If I give a wrong file name it gives another error
saying "resource not found". Which means that it is trying to access
the corrct file. I guess it is some IUSER_MACHINE NAME permission
problem. Please let me know.
0
praneetha
Asked:
praneetha
  • 3
  • 2
1 Solution
 
b1xml2Commented:
if you are access it via the web server, you cannot use the physical path,
use a virtual path....
relative to the xml file...
0
 
praneethaAuthor Commented:
'C:\\Inetpub\\wwwroot\\XMLCreate\\bin\\DFCRules3.dtd' u talking about that...

there is no xml file..its just a xml string...
<?xml version = '1.0'?><!DOCTYPE DataFlowControl SYSTEM
'C:\\Inetpub\\wwwroot\\XMLCreate\\bin\\DFCRules3.dtd'><DataFlowControl
Name=\"ss\" Threads=\"2\" DFCType=\"KeepAlive\" BatchTime=\"sss\"
PerfMon=\"on\"></DataFlowControl>
0
 
b1xml2Commented:
if u are trying to validate thru javascript, is it sitting inside a HTML file or instantiated by a HTML file. If so, you cannot use the actual physical path. You have to use the url. Otherwise, the DTD cannot be loaded,,
0
 
praneethaAuthor Commented:
hey thank u that worked.

0
 
b1xml2Commented:
no problems =)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now