Accesing version controlled files using asp scripts

T

tarundevnani

I have a file named file1.xml also under C:/tarun/file1.xml

file1.xml looks like:-

<?xml version="1.0" encoding="UTF-8" ?>
- <elemNames>
<name>elem1</name>
</elemNames>

Method 1:

ASP Script

set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("C:/tarun/file1.xml")
NumberOfBuilds = xmlDoc.getElementsByTagName("name").length

Response.write(NumberOfBuilds)

The return value from the previous statement is 1 as there is an
element named 'elem1' with tagName 'name' in file1.xml

Method 2:

I version controlled 'file1.xml' using 'Rational Clear Case' on some
server. (Say the name of the server is 'abc.xyz.com'). I have a file
under 'tarun/file1.xml' on it.

I am able to open the file, file.xml in the broswer (IE) using the
following link:
http://abc.xyz.com/tarun/file1.xml

ASP Script:-

set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("http://abc.xyz.com/tarun/file1.xml")
NumberOfBuilds = xmlDoc.getElementsByTagName("name").length

Response.write(NumberOfBuilds)

The retun value from the previous statement is 0 but I expect it to be
1 as there is an element named 'elem1' with tagName 'name' in
file1.xml

Question:
What is the issue with Method 2. Can any one help?
 
A

Anthony Jones

I have a file named file1.xml also under C:/tarun/file1.xml

file1.xml looks like:-

<?xml version="1.0" encoding="UTF-8" ?>
- <elemNames>
<name>elem1</name>
</elemNames>

Method 1:

ASP Script

set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("C:/tarun/file1.xml")
NumberOfBuilds = xmlDoc.getElementsByTagName("name").length

Response.write(NumberOfBuilds)

The return value from the previous statement is 1 as there is an
element named 'elem1' with tagName 'name' in file1.xml

Method 2:

I version controlled 'file1.xml' using 'Rational Clear Case' on some
server. (Say the name of the server is 'abc.xyz.com'). I have a file
under 'tarun/file1.xml' on it.

I am able to open the file, file.xml in the broswer (IE) using the
following link:
http://abc.xyz.com/tarun/file1.xml

ASP Script:-

set xmlDoc=Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async="false"
xmlDoc.load("http://abc.xyz.com/tarun/file1.xml")
NumberOfBuilds = xmlDoc.getElementsByTagName("name").length

Response.write(NumberOfBuilds)

The retun value from the previous statement is 0 but I expect it to be
1 as there is an element named 'elem1' with tagName 'name' in
file1.xml

Question:
What is the issue with Method 2. Can any one help?

Try this:-


Set xmlDoc = Server.CreateObject("MSXML2.DOMDocument.3.0")
xmlDoc.setProperty "ServerHTTPRequest", True
xmlDoc.async = False
xmlDoc.load "C:/tarun/file1.xml"

If xmlDoc.parseError.errorCode = 0 Then
Response.Write xmlDoc.getElementsByTagName("name").length
Else
Response.Write xmlDoc.parseError.reason
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top