XML output with WinRunner – 4
Root page: Service Functions – XML
Parent page: Service Functions – XML / WinRunner
Write single child XML node
public function xml_node_child_attr_write(in xml_file, in tag, in text, in attr_tag, in attr_value) {
auto rc, s_line;
if (xml_write_mode) {
rc = file_open(xml_file, FO_MODE_APPEND);
if (rc != E_OK) return(rc);
s_line = node_indent & " " & "<" & tag & " " & attr_tag & "=" & "\""& attr_value & "\""& ">" & xml_str_norm(text) & "</" & tag & ">";
file_printf(xml_file, "%s\r\n", s_line);
file_close(xml_file);
}
else {
s_line = node_indent & " " & "<" & tag & " " & attr_tag & "=" & "\""& attr_value & "\""& ">" & xml_str_norm(text) & "</" & tag & ">";
dump_printf("%s\r\n", s_line);
}
return(E_OK);
}
Write a pack of child XML nodes
public function xml_node_child_write(in xml_file, in tag1, in text1, in tag2, in text2, in tag3, in text3, in tag4, in text4, in tag5, in text5) {
auto rc, s_line;
if (xml_write_mode) {
rc = file_open(xml_file, FO_MODE_APPEND);
if (rc != E_OK) return(rc);
if (tag1 != "") {
s_line = node_indent & " " & "<" & tag1 & ">" & xml_str_norm(text1) & "</" & tag1 & ">";
file_printf(xml_file, "%s\r\n", s_line);
}
else {
file_close(xml_file);
return(E_OK);
}
if (tag2 != "") {
s_line = node_indent & " " & "<" & tag2 & ">" & xml_str_norm(text2) & "</" & tag2 & ">";
file_printf(xml_file, "%s\r\n", s_line);
}
else {
file_close(xml_file);
return(E_OK);
}
if (tag3 != "") {
s_line = node_indent & " " & "<" & tag3 & ">" & xml_str_norm(text3) & "</" & tag3 & ">";
file_printf(xml_file, "%s\r\n", s_line);
}
else {
file_close(xml_file);
return(E_OK);
}
if (tag4 != "") {
s_line = node_indent & " " & "<" & tag4 & ">" & xml_str_norm(text4) & "</" & tag4 & ">";
file_printf(xml_file, "%s\r\n", s_line);
}
else {
file_close(xml_file);
return(E_OK);
}
if (tag5 != "") {
s_line = node_indent & " " & "<" & tag5 & ">" & xml_str_norm(text5) & "</" & tag5 & ">";
file_printf(xml_file, "%s\r\n", s_line);
}
else {
file_close(xml_file);
return(E_OK);
}
file_close(xml_file);
}
else {
if (tag1 != "") {
s_line = node_indent & " " & "<" & tag1 & ">" & xml_str_norm(text1) & "</" & tag1 & ">";
dump_printf("%s\r\n", s_line);
}
else {
return(E_OK);
}
if (tag2 != "") {
s_line = node_indent & " " & "<" & tag2 & ">" & xml_str_norm(text2) & "</" & tag2 & ">";
dump_printf("%s\r\n", s_line);
}
else {
return(E_OK);
}
if (tag3 != "") {
s_line = node_indent & " " & "<" & tag3 & ">" & xml_str_norm(text3) & "</" & tag3 & ">";
dump_printf("%s\r\n", s_line);
}
else {
return(E_OK);
}
if (tag4 != "") {
s_line = node_indent & " " & "<" & tag4 & ">" & xml_str_norm(text4) & "</" & tag4 & ">";
dump_printf("%s\r\n", s_line);
}
else {
return(E_OK);
}
if (tag5 != "") {
s_line = node_indent & " " & "<" & tag5 & ">" & xml_str_norm(text5) & "</" & tag5 & ">";
dump_printf("%s\r\n", s_line);
}
else {
return(E_OK);
}
}
return(E_OK);
}

