• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

parsing plain file into html

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I have a plan file that looks something like this:


This is how file looks in plain form and this is how html source code looks if I view the source code in the browser. Of course when I view the page in the browser it does not look like this because there is no spacing between columns and fields because there is no formatting.
Before I start to write my own parser, is there a parser out there already that can create an html file from this file using tables? I have one approach to replace all spaces with  , but it's not very elegant.
Any help is appreciated!

thanks,
Alex

[ August 31, 2005: Message edited by: Alex Dubin ]
[ August 31, 2005: Message edited by: Alex Dubin ]
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For your input I think this will be a manual process, not something you'll find already written.

HTML tables are the easiest way to align columns. So you want to generate:

How will you parse the id, name and phone out of each row of your file? It looks like they are in fixed positions so you can use substring. Does that give you some ideas?

I said there is probably not a general solution, but in fact Wiki sites render plain text into HTML for a living. Tables usually have some special delimiter to help:

Full Wiki markup is non-trivial but fascinating. Look at the source for Fit or Fitnesse for an education.
 
Alex Dubin
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks man!
This is exectly what I need!

Alex
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The <PRE> tag is also meant to preserve the formatting of the text in between its opening and closing tags, so that might help you.
 
Screaming fools! It's nothing more than a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic