Click to See Complete Forum and Search --> : How do I import data ?
craigbryan2003
10-09-2003, 08:59 AM
Hello Everyone,
I am very new to XML and I have never written XML code before. At work I maintain an internal website that provides information to our agents on the phones in a large call center. I wanted to create an XML file that updates itself twice daily with data from a seperate text file. For example, I want it to display foreign exchange rates twice daily. I wanted the rates to be in a simple text file that the XML file can import it from.
First, I wanted to know if this can be done or should I be approaching this in a different manner. Second, is there somewhere I can download a similar example that I can modify to my liking?
Thank-you for feedback you may have.
Khalid Ali
10-11-2003, 09:38 AM
you will have to understand that XML itself is nothing but a fancy text file,to make it work as you desire,you will need some complimentory technologies
such as java or any other programming language.
You will need to write a program that will read the text fiel and update the xml file.
I am sure this is not what you'd expected as an answer.;)
Exactly Khalid, the XML wont do it by itself, insetad you will have to make someone-something to do it eg: Java, Javascript etc etc...
:D
craigbryan2003
10-14-2003, 07:55 AM
So you are saying that I need a Javascript file, (since I have some experience with this language), to read the text file, and I would use a XML file to display the info from the text file on my web page ? Is this correct ?
Khalid Ali
10-14-2003, 08:28 AM
Not quite,
because JavaScript can not read /write fiels on any given system.
to read XML/JavaSCript capabilities read this (http://www.webreference.com/programming/javascript/xml/)
Again you will need some other hard core programming language to read and write to fiels.
welll here are a few directions to read frm a text file and store in XML...
1.using the FileSystemObject in Javascript u would be able to read the file and assign data to a variable.....
2. Use that variable in XMLDOM object and the function LoadXML()....
3. Now save it....see..its simple :D
Lotus
10-31-2003, 05:29 AM
...Or you could just use an HTML page to display the contents of your XML file... Here's an example:
XML FILE:
<?xml version="1.0">
<exchange>
<usa>5</usa>
<canada>3</canad>
</exchange>
HTML FILE:
<html>
<head>
<title>HTML_FILE</title>
<script language=JavaScript>
<!--
var RootElement1;
var xmlDoc1=new ActiveXObject("microsoft.xmldom");
xmlDoc1.load("xml_file.xml");
function StartUp()
{
if(xmlDoc1.readyState=="4")
{
StartLoading();
}
else
{
alert("Loading operation could not start");
}
}
function StartLoading()
{
RootElement1=xmlDoc1.documentElement;
usadata.innerText=RootElement1.childNodes(0).text;
canadadata.innerText=RootElement1.childNodes(1).text;
}
//-->
</script>
</head>
<body>
USA: <span id=usadata>/span><br>
CANADA: <span id=canadadata></span>
</body>
</html>
This is just a simple example... but... uuh... yes, that's true, you use JavaScript to display it, so this reply was unnecessary.