XML Parse - WINSCP
Hey All,
Got a question about the XML logging and how to parse these to readable text
This is for example my output: test.xml
<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="https://winscp.net/schema/session/1.0" name="test@127.0.0.1" start="2009-07-24T09:30:19.531Z">
<download>
<filename value="/\test\/test_script.txt" />
<destination value="c:\test\test_script.txt" />
<result success="true" />
</download>
</session>
Here is my XML parser i use: xml_parser.html
<html>
<body>
<script type="text/javascript">
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e) {alert(e.message)}
}
try
{
xmlDoc.async=false;
xmlDoc.load("test.xml");
document.write("xmlDoc is loaded, ready for use");
}
catch(e) {alert(e.message)}
document.write("<table border='1'>");
var x=xmlDoc.getElementsByTagName("download");
for (i=0;i<x.length;i++)
{
document.write("<tr><td>");
document.write(x[i].getElementsByTagName("filename")[0].childNodes[0].nodeValue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("result")[0].childNodes[0].nodeValue);
document.write("</td></tr>");
}
document.write("</table>");
</script>
</body>
</html>
This is not gonna work because the xml_parse.html expects a </filename> and a </result> If i edit the xml file with this it works....
How can i fix this ?
And how can i see after parse only the false results what's in my test.xml ?
So the value result is false and not true.
Thanks in advance,
Jappie
WinSCP version: 2.2.0.105
OS: Win XP Sp3
Got a question about the XML logging and how to parse these to readable text
This is for example my output: test.xml
<?xml version="1.0" encoding="UTF-8"?>
<session xmlns="https://winscp.net/schema/session/1.0" name="test@127.0.0.1" start="2009-07-24T09:30:19.531Z">
<download>
<filename value="/\test\/test_script.txt" />
<destination value="c:\test\test_script.txt" />
<result success="true" />
</download>
</session>
Here is my XML parser i use: xml_parser.html
<html>
<body>
<script type="text/javascript">
try //Internet Explorer
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
catch(e)
{
try //Firefox, Mozilla, Opera, etc.
{
xmlDoc=document.implementation.createDocument("","",null);
}
catch(e) {alert(e.message)}
}
try
{
xmlDoc.async=false;
xmlDoc.load("test.xml");
document.write("xmlDoc is loaded, ready for use");
}
catch(e) {alert(e.message)}
document.write("<table border='1'>");
var x=xmlDoc.getElementsByTagName("download");
for (i=0;i<x.length;i++)
{
document.write("<tr><td>");
document.write(x[i].getElementsByTagName("filename")[0].childNodes[0].nodeValue);
document.write("</td><td>");
document.write(x[i].getElementsByTagName("result")[0].childNodes[0].nodeValue);
document.write("</td></tr>");
}
document.write("</table>");
</script>
</body>
</html>
This is not gonna work because the xml_parse.html expects a </filename> and a </result> If i edit the xml file with this it works....
How can i fix this ?
And how can i see after parse only the false results what's in my test.xml ?
So the value result is false and not true.
Thanks in advance,
Jappie
WinSCP version: 2.2.0.105
OS: Win XP Sp3