parse xml file generated by googlevoice
Need some help to parse a xml file generated by https://www.google.com/voice/inbox/recent/sms
The part of the xml file of interest is
<div class="gc-message-sms-row">
<span class="gc-message-sms-from">+16233021034:</span>
<span class="gc-message-sms-text">Hey there, Wendy Haro is the president</span>
<span class="gc-message-sms-time">8:44 AM</span>
</div>
---------------------------------------------------------------------------------------------------------------
definition of xlm file of interest:
start_new_msg = <div class="gc-message-sms-row">
start_sms_from = <span class="gc-message-sms-from">
end_sms_from = </span>
start_sms_msg = <span class="gc-message-sms-text">
end_sms_msg = </span>
start_sms_time = <span class="gc-message-sms-time">
end_sms_time = </span>
end_new_msg = </div>
end_of_file = </response>
---------------------------------------------------------------------------------------------------------------
Since I am only interested in messages sent to me. Need to filter out messages sent by my googlevoice number. The idea I thought would parse the data into three arrays.
From[], message[], and time[] . Then loop thru to filter out.
usergvnumber = +16232521234:
for(int x=0; x<size; x++)
{
if((from[x] == 'Me:') || (from[x] == usergvnumber))
{
//get ride of element by shifting
from[x] = from[x+1];
from[size-1] =0;
message[x] = message[x+1];
message[size -1] =0;
time[x] = time[x+1];
time[size-1] =0;
}
}
If you help me out with this would be great, since most people would be interested. I don't want to recreate the wheel.
Re: parse xml file generated by googlevoice
Parsing XML is relatively easy with Java. I suggest you read one of the many online tutorials on parsing XML in Java.