Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

JavaScript and XMLDOM

Status
Not open for further replies.

kirthi97

Programmer
Jun 21, 2006
7
US
Hi

I am new to Java script and XMLDOM. I have an XML file on my local sever and I have to send it to a different company using HTTP post. They use XMLHTTP and XMLDOM to retrieve it.

I am a java programmer and I am trying to use Java script and XMLDOM and XMLHTTP to send the file. I know I can use XMLDOM and load the xml file. But I am not sure how to access the file on the local system and save it in XMLDOM.

I am struggling with this problem from the last three days and I really need help…

Can anyone help me with this??????

Thanks


 
I'd use Java for that.

Javascript has a security feature that forbids access to hard drive. You'd need to use an Activex control.

Cheers,
Dian
 
Thank you. I am really new to this stuff. Would you mind explaining me in a more detailed way about using Activex Control

Thanks
 
Here is the script I am using.. But this is not recognizing the note.xml file on my system.

<script type="text/javascript">
var xmlDoc
function loadXML()
{
//load xml file
// code for IE
if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load("C:\note.xml");
getmessage()
}
// code for Mozilla, etc.
else if (document.implementation &&
document.implementation.createDocument)
{
xmlDoc= document.implementation.createDocument("","",null);
xmlDoc.load("C:\note.xml");
xmlDoc.onload=getmessage
}
else
{
alert('Your browser cannot handle this script');
}
}
</script>
 
Well, this forum is plenty of examples from people that know much more than me about this. Use the search functionality.

What error are you getting?

Cheers,
Dian
 
kirthi97, can you give more detail about the steps you are trying to take? I do not quite understand all of what you want to accomplish.

You say the XML file is on your server and you want to send it to another company. You also say though that the other company retrieves the file with XMLHTTP and XMLDOM which sounds like conflicting information to me.

Is this to be an automated process or is it going to require you to post the file from your end?

Is the file on your web server or on a file server?
If a web server, what type of server and what server-side language do you have available?

It is possible to access the file with Javascript but how depends a lot on where the file resides and what you want to do with it.

Sorry I cannot be real specific because I do not understand your particular circumstances.
If the file resides on the web server you could automate the transfer with server-side script or just make the file available for retrieval if the other company has an automated retrieval method.


Google, you're my hero!
 
> xmlDoc.load("C:\note.xml");
[tt] xmlDoc.load("C:[red]\[/red]\note.xml");[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top