Help - Read XML file and make output from it

(imported topic written by imam91)

Hi All , i Want to create relevance / analysis from xml file , with output like this :

OS Win7 Installed : True

Service Pack Win7 Result : True

OS WinXP Installed : False

Patch Q2286198 Installed : False

Custom BigFix CustomC Installed : True

Sophos Anti-Virus 9.7 AVApp : True

The Result " true or false" is depend on the value of xml file @ Client

Below is sample xml file ,

  • <EF:CurrentAssessment xmlns:EF=“ENDFORCE” version=“3.0” lastAssessment=“09/22/2011 02:20:19 PM” lastComplianceState=“partial”>
  • <EF:Application type=“OS” name=“Win7” installed=“true”>

<EF:Capability type=“servicePack” name=“Win7” result=“true” />

</EF:Application>

<EF:Application type=“OS” name=“WinXP” installed=“false” />

<EF:Application type=“Patch” name=“Q2286198” installed=“false” />

<EF:Application type=“Custom” name=“BigFix CustomC” installed=“true” />

<EF:Application type=“AVApp” name=“Sophos Anti-Virus 9.7 AVApp” installed=“true” />

<EF:Application type=“Domain Security Applications” name=“HO - Domain Logon Check Domain Security ApplicationsC” installed=“true” />

</EF:CurrentAssessment>

I try this :

Q:preceding text of first “%22” of following text of firsts “<EF:Application type=“OS” name=“WinXP” installed” of lines of file “C:\temp\AssessmentResults.xml”

E: The operator “os” is not defined.

Q:lines whose (it contains “true”) of file “C:\temp\AssessmentResults.xml”

A: <EF:CurrentAssessment xmlns:EF=“ENDFORCE” version=“3.0” lastAssessment=“09/22/2011 02:20:19 PM” lastComplianceState=“partial”><EF:Application type=“OS” name=“Win7” installed=“true”><EF:Capability type=“servicePack” name=“Win7” result=“true”></EF:Capability></EF:Application><EF:Application type=“OS” name=“WinXP” installed=“false”></EF:Application><EF:Application type=“Patch” name=“Q2286198” installed=“false”></EF:Application><EF:Application type=“Custom” name=“BigFix CustomC” installed=“true”></EF:Application><EF:Application type=“AVApp” name=“Sophos Anti-Virus 9.7 AVApp” installed=“true”></EF:Application><EF:Application type=“Domain Security Applications” name=“HO - Domain Logon Check Domain Security ApplicationsC” installed=“true”></EF:Application></EF:CurrentAssessment>

T: 0.248 ms

Im Confused …Anyone can help ? :smiley:

(imported comment written by jeremylam)

Q:preceding text of first "%22" of following text of firsts "<EF:Application type="OS" name="WinXP" installed" of lines of file "C:\temp\AssessmentResults.xml"
E: The operator "os" is not defined.

It looks like the string you are looking for contains double quotes, which is confusing the debugger. You need to escape the quotes by replacing them with %22:

Q:preceding text of first "%22" of following text of firsts "<EF:Application type=%22OS%22 name=%22WinXP%22 installed" of lines of file "C:\temp\AssessmentResults.xml"

Or you can use the built-in XML inspectors, which I would recommend (since I like XPath):

http://forum.bigfix.com/viewtopic.php?id=8366

(imported comment written by imam91)

Hi Jeremy , thanks for help , ure relevance save my time :smiley: ,

q:(preceding text of position 5 of it) of following text of first “%22” of following text of firsts “<EF:Application type=%22Patch%22 name=%22Q2286198%22 installed” of lines of file “C:\temp\AssessmentResults.xml”

A: false

q:(exists true whose (if true then (exists ((preceding text of position 5 of it) of following text of first “%22” of following text of firsts “<EF:Application type=%22Patch%22 name=%22Q2286198%22 installed” of lines of file “C:\temp\AssessmentResults.xml”) whose (it as string as lowercase contains “true” as lowercase)) else false))

A: False

Thanks All … Terimakasih