CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Hybrid View

  1. #1
    Join Date
    Nov 2006
    Posts
    32

    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.

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,473

    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.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured