New to xml writing analysis

(imported topic written by sam_milby91)

Hi Guys,

I’m really new here and wanted to know how to create analysis through xml.

My simple goal which I can’t do is output the value of “logfilepath” which is “c:\logs” else “audit fail”. The file is named config.xml and it should also be validated existing under c:\configs directory.

c:\logs

\c:\reports

(imported comment written by jessewk)

Hi Sam,

You’ll want to make a new analysis with a retrieved property that has the following relevance definition:

node values of child nodes of xpaths “/CLASS/FILEPATH/LOGFILEPATH” of xml documents of files “c:\config\config.xml”

That expression will return the log file path if it exists. If there is an error such as the file not existing, or the XML not formated in the same way the result will be blank.

If you’d prefer to output “audit failed” instead of just returning nothing, you can use this slightly more complicated expression:

if
(
exists node values of child nodes of xpaths “/CLASS/FILEPATH/LOGFILEPATH” of xml documents of files “c:\config\config.xml”
)
then
node values of child nodes of xpaths “/CLASS/FILEPATH/LOGFILEPATH” of xml document of file “c:\config\config.xml"
else
"Audit Failed”