• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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.
 
What does a metric clock look like? I bet it is nothing like this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic