Ray Lasher

Greenhorn
+ Follow
since Mar 03, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ray Lasher

William Brogden wrote:StaX only knows about taking an XML document apart into a sequence of elements. It is a single purpose toolkit.






Thanks Bill,

I'll look into it.
Can you suggest me a way to implement the logic of changing dates after I parse them using StaX?

William Brogden wrote:

I've to parse this, using StaX API



Note that SAX and StaX ....

Bill




Hi Bill,

I"m able to parse the xml using StaX any idea how do I insert this parsed content into a hsql database using StaX itself?
oh Thanks Ritchie. Can you tell me where to move it please.
Hi, I'm completely new to java and have to solve this problem. Will really appreciate if I can get any help regarding how I can divide this problem and in designing a blue print to solve it.

This is the XML file
<?xml version="1.0" encoding="UTF-8"?><ROOT DATE_CREATED="2011-09-15 13:33:45.804+0000" CREATED_BY="iMIS Collector" CLIENT_NAME="IDMSERVER" COMPANY_ID="13">
<Event Name="TXTDRV_TRACE"><Time>2011-09-15 11:03:45:834+0000</Time><Description><![CDATA[Test ERROR 1]]></Description></Event>
<Event Name="TXTDRV_TRACE"><Time>2011-09-15 13:53:45:834+0000</Time><Description><![CDATA[Test ERROR 2]]></Description></Event>
<Event Name="TXTDRV_TRACE"><Time>2011-09-15 14:13:45:834+0000</Time><Description><![CDATA[Test ERROR 3]]></Description></Event>
<Event Name="TXTDRV_TRACE"><Time>2011-09-15 15:35:45:834+0000</Time><Description><![CDATA[Test ERROR 4]]></Description></Event>
<Event Name="TXTDRV_TRACE"><Time>2011-09-15 17:34:45:834+0000</Time><Description><![CDATA[Test ERROR 5]]></Description></Event>
<Event Name="TXTDRV_TRACE"><Time>2011-09-15 19:38:45:834+0000</Time><Description><![CDATA[Test ERROR 6]]></Description></Event>
</ROOT>

I've to parse this, using StaX API and then Store it in HSQL DB. ( How do I parse it, what should be the rows and columns, no idea)

Then After storing this in DB. I've to

1) Calculate the max time stamp on the data. (Time is in GMT)
2) Figure out the difference between the max time and current time.
3) Replace the max time with current time (2011-09-15 19:38:45:834+0000 becomes current time)
4) Calculate the difference between the max time(before changing it) and the second max time and replace second max time by current time-difference (For example 2011-09-15 17:34:45:834+0000 becomes current time - 2hr 4 min
5) Repeat this till all the time slots are done.

We can have multiple XML files.

This has to be done using maven built (no idea what that is).

I use a Mac and I've maven installed in my system

Any Help will greatly be appreciated...


Currently I'm searching for algorithms on how to sort the date and change the times. If anyone can give me a blue print on how a fresher can approach this problem, I'll really appreciate it.

Thank you