adityasirohi
Programmer
HI Friends,
I am having some trouble with parsing though the XML file. I want to use the element time inside eventList tag and store each time attribute in a different variable, for example "04" should be stored in hour, "39" should be stored in minutes, "07" should be stored in sec and same way for other remaining attributes in time. I tried using xpath but had no success.
Can you guys guide me how to go about with this. I am calling this xml file in a javascript.
Thanks
Adi
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="eventList.xsl" type="text/xsl" title="main"?>
<ajax>
<eventList name="chili" barId="11" viewId="6" msg="1" time="04:39:07 PM EDT 05/28/2009" columns="all" limit="1000" limitset="1" page="1">
<addEvents>
<ae a="a144411" c="4" d="nobody" e="chili" f="09:48:49 AM EDT 05/28/2009" g="09:48:49 AM EDT 05/28/2009" h="10" i="" j="list due to loss of keep alive" k="Policy Server" l="1243518529000" m=""/>
<ae a="a144245" c="5" d="nobody" e="chili" f="04:20:00 AM EDT 05/28/2009" g="04:20:00 AM EDT 05/28/2009" h="1" i="" j="Host file system [/ccvob] rises above threshold: 95.0%; current usage: 95.1%" k="Policy Server" l="1243498800000" m=""/>
<ae a="a144125" c="4" d="nobody" e="chili" f="10:00:05 PM EDT 05/27/2009" g="12:51:46 AM EDT 05/28/2009" h="48" i="" j="Decreasing Adaptive Congestion Level to 0(0/100)" k="Policy Server" l="1243486306000" m=""/>
<ae a="a143918" c="4" d="nobody" e="chili" f="05:08:03 PM EDT 05/27/2009" g="12:48:53 AM EDT 05/28/2009" h="8714" i="" j="ERROR: Cache monitor unable to connect to db, " k="Policy Server" l="1243486133000" m=""/>
<ae a="a144122" c="4" d="nobody" e="chili" f="09:49:30 PM EDT 05/27/2009" g="09:49:30 PM EDT 05/27/2009" h="1" i="" j="Swap space usage exceeds threshold value 95.0%; current usage: 95.0%" k="Policy Server" l="1243475370000" m=""/>
</addEvents>
<deleteEvents/>
<users>
<us>ADD USER</us>
<us>cliadmn</us>
<us>admin3</us>
<us>Radius</us>
<us>admin2</us>
<us>admin</us>
<us>radius</us>
<us>test_remote</us>
</users>
</eventList>
</ajax>
I am having some trouble with parsing though the XML file. I want to use the element time inside eventList tag and store each time attribute in a different variable, for example "04" should be stored in hour, "39" should be stored in minutes, "07" should be stored in sec and same way for other remaining attributes in time. I tried using xpath but had no success.
Can you guys guide me how to go about with this. I am calling this xml file in a javascript.
Thanks
Adi
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="eventList.xsl" type="text/xsl" title="main"?>
<ajax>
<eventList name="chili" barId="11" viewId="6" msg="1" time="04:39:07 PM EDT 05/28/2009" columns="all" limit="1000" limitset="1" page="1">
<addEvents>
<ae a="a144411" c="4" d="nobody" e="chili" f="09:48:49 AM EDT 05/28/2009" g="09:48:49 AM EDT 05/28/2009" h="10" i="" j="list due to loss of keep alive" k="Policy Server" l="1243518529000" m=""/>
<ae a="a144245" c="5" d="nobody" e="chili" f="04:20:00 AM EDT 05/28/2009" g="04:20:00 AM EDT 05/28/2009" h="1" i="" j="Host file system [/ccvob] rises above threshold: 95.0%; current usage: 95.1%" k="Policy Server" l="1243498800000" m=""/>
<ae a="a144125" c="4" d="nobody" e="chili" f="10:00:05 PM EDT 05/27/2009" g="12:51:46 AM EDT 05/28/2009" h="48" i="" j="Decreasing Adaptive Congestion Level to 0(0/100)" k="Policy Server" l="1243486306000" m=""/>
<ae a="a143918" c="4" d="nobody" e="chili" f="05:08:03 PM EDT 05/27/2009" g="12:48:53 AM EDT 05/28/2009" h="8714" i="" j="ERROR: Cache monitor unable to connect to db, " k="Policy Server" l="1243486133000" m=""/>
<ae a="a144122" c="4" d="nobody" e="chili" f="09:49:30 PM EDT 05/27/2009" g="09:49:30 PM EDT 05/27/2009" h="1" i="" j="Swap space usage exceeds threshold value 95.0%; current usage: 95.0%" k="Policy Server" l="1243475370000" m=""/>
</addEvents>
<deleteEvents/>
<users>
<us>ADD USER</us>
<us>cliadmn</us>
<us>admin3</us>
<us>Radius</us>
<us>admin2</us>
<us>admin</us>
<us>radius</us>
<us>test_remote</us>
</users>
</eventList>
</ajax>