Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

convert from one text format to other  RSS feed

 
Meir Yan
Ranch Hand
Posts: 599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Helllo all
i have some project that i need convert from one text format say html page to xml page
it will run on allot of pages ( 600...) and it need to be flex for me to add more pre defines tag
that is open file go line by line and parse every html tag to xml tag the formats will be
predefined. now i dont want to invade the wheel , im sure there is some patterns and ideas
that are agreed for task like this , can you the experts give me some links or ideas? how can
i approce to this kind of task?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your HTML is also well formed XML (it could happen!) you could use XSL for a rapid conversion. Or maybe you wouldn't need conversion in the first place.

I use the Quiotix HTML Parser to parse HTML into a DOM. It does a neat job of fixing up the oddities of HTML. The DOM supports a Visitor interface that might be real slick for generating XML. They have a sample visitor that generates HTML again that would probably be a good inspiration. It might even generate that well formed XML version of HTML.
 
Meir Yan
Ranch Hand
Posts: 599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was thinking about more general tool , the html to xml is just an
example .. in fact i need it for internal use for converting one format to other , i need some Algorithms , ideas and such like this example :
http://www.cs.wlu.edu/~levy/courses/cs112-03/lectures/07_FEB_2003.pdf
 
Joe Ess
Bartender
Posts: 9429
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use Open Office for doing .DOC to HTML and HTML to PDF.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frank's Friki Wiki has a pretty general purpose string transformer thing going on. I'll pretend I just didn't give it enough time, but I couldn't figger it out well enough to apply it to a new problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!