Results 1 to 3 of 3

Thread: txt to xml for use as annotation object

  1. #1
    Join Date
    Dec 2011

    txt to xml for use as annotation object

    Hi, i've got kind of an embarrassing question, but i'll swallow my pride and ask anyway. I have a txt file that has all the info i need, but i'm having trouble getting it into the correct format (xml, etc.). It was suggested i use a php script to do this, but that's sadly a bit out of my league. The txt file looks like this:

    "incident_id:INTEGER sex:STRING race:STRING age:INTEGER fname:STRING
    lname:STRING 7 M B 26 Samuel Schley 8 M B 28 Allan Atkins 9 M B 17 Kenny
    Mcclinton 10 M B 31 Kendrick Brewley 12 M B 20 Shawn Halliburton 14 M B"


    Is there a simple way to get this formatted into xml or sqlite? A complex way would be fine too.....


  2. #2
    Join Date
    Jun 2013
    Text is one of the most commonly used annotation objects to highlight and note certain image and document information or view contents better. With a mature text annotation add-on, we can draw, add, remove and burn text shape object with simple methods and codes.

  3. #3
    Join Date
    Mar 2014
    This looks like it may need a bit of cleansing. You could do a sub_str and indexOf to try and insert some commas and linebreaks to make it into a csv, then you can put it in excel or whathaveyou and dick around with it better.

    Or you could put the new lines where they need to and build up the xml, but that will be a bit of dicking around given it is just flat text with not very many unique identifiers - at least you have the field names.

    basic js regex

    var regex = /\w \d{0,2} [MF]{1} /g;
    var result = str.match(regex);

    that will look for a word followed by a max of a 2digit number then a single M or F character

    have that as some kind of vague pointer.. i quite like string manipulations..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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