[Gambas-user] help with some simple parsing
Sergio A. Hernandez
info.geex at ...626...
Thu May 7 05:53:22 CEST 2009
Opps i uploaded the wrong file.
Sorry.
On Wed, May 6, 2009 at 9:50 PM, Sergio A. Hernandez <info.geex at ...626...> wrote:
> Try the following. It is a complete different approach using the XML Writer.
> Try it as a console project, just make sure you the gb.xml is selected under
> PROJECT\PROPERTIES\COMPONENTS
>
> ' Gambas module file
> PUBLIC SUB Main()
> DIM docXML AS XmlWriter
>
> docXML = NEW XmlWriter
> 'this line is to save the xml document in your home folder
> docXML.Open(User.Home & "/DoctorRicky.html", TRUE)
>
> 'This part is the fancy CSS styling only is not important
> docXML.StartElement("style", ["type", "text/css"])
> docXML.Text("table.fancyTable {padding: 2pt; widht:100%;}")
> docXML.Text("th {font-weight: bold; background-color: #cccc99;
> color: #000000}")
> docXML.Text("tr.evenRow {background-color: #f5f5dc; text-align: center}")
> docXML.Text("tr.oddRow {background-color: #ffffff; text-align: center}")
> docXML.EndElement
>
> docXML.StartElement("table", ["class", "fancyTable"])
> '<th /> is the HTML tab for the headers
> docXML.Element("th", "Test")
> docXML.Element("th", "Date 1")
> docXML.Element("th", "Date 2")
> docXML.Element("th", "Date 3")
> '<tr /> is the tag for the rows
> docXML.StartElement("tr", ["class", "oddRow"])
> '<td /> is the tag for the colums
> ' number of <td /> elements must be the same as the number of <th
> /> elements
> docXML.Element("td", "LDL Fraction")
> docXML.Element("td", "50 ml/dl")
> docXML.Element("td", "100 ml/dl")
> docXML.Element("td", "150 ml/dl")
> docXML.EndElement()
>
> 'On the real life you'll prefer to handle this with a Loop Control Structure
> docXML.StartElement("tr", ["class", "evenRow"])
> docXML.Element("td", "HDL Fraction")
> docXML.Element("td", "50 ml/dl")
> docXML.Element("td", "75 ml/dl")
> docXML.Element("td", "100 ml/dl")
> docXML.EndElement()
> docXML.EndElement()
> 'PRINT Xml.EndDocument
> END
>
> On Wed, May 6, 2009 at 7:01 AM, richard terry <rterry at ...1946...> wrote:
>> See the attached file for the data. Unfortunately I'm brain dead when it comes
>> to simple logic.
>>
>> In one of my hl7 messages in the Free Text segment under an actual pathology
>> result, there is a list of sequential bood test results representing previous
>> results of the same type - , separated by tabs which I need to display
>> properly. as I've re-constructed the result as html, the tabs simply
>> disappear in the result, so I've been looking for a solution, and to start I
>> thought maybe I could split this up into lines and then later put it into a
>> table embedded in the html to keep it aligned.
>>
>> Perhaps there is a simple way out, but this is what I've done so far.
>>
>>
>> So I started with this:
>>
>> 1) Split this into lines
>>
>> Dim bits as string[]
>> dim a_line as string
>>
>> bits = split(the_text_in_the_file,"<BR>,"", TRUE)
>>
>> for each a_line in bits
>> print a_line
>> next
>>
>> Problem with this is that the \t (I presume tab character) gets in the way,
>> and it dosn't split properly with the results of the bits[] as shown in the
>> picture. Interestingly an occasional letter is lost off the test names.
>>
>> Any help appreciated.
>>
>> richard
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
>> production scanning environment may not be a perfect world - but thanks to
>> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
>> Series Scanner you'll get full speed at 300 dpi even with all image
>> processing features enabled. http://p.sf.net/sfu/kodak-com
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
>
More information about the User
mailing list