Ad Widget

Collapse

How can I parsing my xml file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • karzer
    Member
    • Mar 2010
    • 61

    #1

    How can I parsing my xml file

    Hello There,

    I have an xml file. I can not parse it as I want. Can you help me. File example as below.

    I tested with xmllint but couldn't find the right method.


    xmllint --xpath '//feature[@name="Sophos"]' status


    <feature name="Sophos" time_remaining="50920647"


    I want it to appear without tags. Only data should appear.


    Thank you very much in advance


    ---------------------------------------------------------------------------------------------------------------------------------------------

    <?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>

    <status build="phoebe 13.0.0-375" hostname="erg.abcd.local" timestamp="20200909182231">
    <birth_time timestamp="20200428211755 (133d 21h 4m 36s)"/>
    <last_counter_reset timestamp=""/>
    <system status="online" />
    <oldest_message secs="254534" mid="21123212" />
    <features>
    <feature name="External Threat Feeds" time_remaining="50920647" />
    <feature name="Sophos" time_remaining="50920647" />
    <feature name="Bounce Verification" time_remaining="49624647" />
    <feature name="IronPort Anti-Spam" time_remaining="50920647" />
    <feature name="Incoming Mail Handling" time_remaining="50986939" />
    <feature name="Outbreak Filters" time_remaining="50920647" />
    </features>
    <counters>
    <counter name="inj_msgs"
    reset="20661684"
    uptime="5657544"
    lifetime="20661684" />
    <counter name="inj_recips"
    reset="23360625"
    uptime="6410997"
    lifetime="23360625" />



    ---------------------------------------------------------------------------------------------------------------------------------------------

    Click image for larger version

Name:	Screenshot from 2020-09-12 22-29-53.png
Views:	1272
Size:	2.4 KB
ID:	408979













  • dimir
    Zabbix developer
    • Apr 2011
    • 1080

    #2
    Code:
    //feature[@name="Sophos"]/@time_remaining

    Comment

    Working...