Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

Jappie

ok....then i think i'm stuck.....
martin

Jappie wrote:

Can't find either the log.xml you are using with youre guide to advanced scripting, where can i download it so i can try it on mine and then edit it with youre code you give me.

It's not available for download. It is just an example.
Jappie

Hmmm, understand what you mean, but can't translate it at the moment to get it work in my example....
Can't find either the log.xml you are using with youre guide to advanced scripting, where can i download it so i can try it on mine and then edit it with youre code you give me.
martin

//w:download/w:filename/@value
//w:download/w:result[@success='false']

I haven't tried them though.
Jappie

Thnx for response, i tried the Xpath, but dunno exactly how this works with the XML log. I got it working but it's the same as my first post.
See <invalid hyperlink removed by admin> what i did.

Can you give the right commands for Parsing my example ?
martin

Re: XML Parse - WINSCP

I do not know JavaScript enough to know what's wrong about your code. Though there's nothing wrong about the XML. <filename></filename> and <filename /> are equivalent in XML.

Please see guide to advanced scripting for example for to use XPath to retrieve information from XML.
Jappie

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