• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to output in italics and underline parts of a text file content.

 
Benjamin Mulder
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My idea:
I want to write a simple flat text database that spits content in APA style.
It will store the names of all the books I've/will read and other information such as author, publication year, and so on. Then I do a search that author, and then the program spits it out in a formatted APA style reference.
example: <author>. <year>. <i><title</i>. <date>, <U><http://www....></U>.
I think I can handle the write and search part to the flat text file.
But How do I get some of the output in italics and other underlined on the text file like in the example above?
Can you give me an example?

Fox.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not up on APA ... Is the output you showed XML? If so, it probably has a typo with an unmatched < in front of title and extra <> around URL?. And I take it "APA Style" specifies what XML tags you should use.
Anyhow, to the question of display ... how are you displaying your results? I'm thinking maybe a Swing app, a web browser, console? Each of those would have different answers for how to show italics. (The console answer is SOL)
I'll take just one combination - you produce XML output and want to display it in a web browser or HTML Swing component. Take a look at XSLT which can translate XML into HTML (or nearly anything else). The HTML can use font or style tags to show italics. XSLT is a rather intimidating technology but there is an XML forum further down the ranch with folk who can get you going.
Oh, and WELCOME TO THE RANCH on your first post! But ... you WILL get spanked for an obvious phoney name. You might try to visit your profile, review the rules and change it before that happens!
[ March 14, 2004: Message edited by: Stan James ]
 
Benjamin Mulder
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks on the tip on updating my profile. My last name is Mulder so I just put Fox just because. Now I put my real name.
anyway..
The application will start up as a plain console, command prompt type of application. Then after I get all the details worked out I'll make a GUI.
But for starters, I'll launch and execute the app from console. Write and search records from a text file database. Then after I found the one I want, I select the record and display it in APA style.
application <==> flat text file (database) => output in APA (HTML or text format).
I just want to get it done in the simplest possible way I guess to start up, then after I get the concept I can explore new ways of doing it.

Any ideas? How would you approach the situation? Again, at first I just want to get functional.
thanks bro,
b. mulder
 
Benjamin Mulder
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Like for example, somebody posted this sample code in this forum...I believe it was you...
I'm wondering, How can I make the "my output" part in italics and underlined?

 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just writing to the console I think you're out of luck. Back in DOS days you could install an ANSI.SYS driver and send special character sequences for colors and bold. I'm not sure if you can do that nowadays in Windows or ever in any other OSs. When you get to HTML it's pretty easy to add font tags. And if you go to Swing you can use HTML or RTF for even more formatting options.
 
Benjamin Mulder
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry dude, I don't know anything about windows or DOS...so you lost me on that one man.
I was a full-on UNIX user until '93 when I switched to Linux. Happy user ever since!
Check this out...I just hacked a little the piece of code above, and now I get italics and underlined on the output file.
I think I got the basics down now but thanks for your tips.

Mulder.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So - where was the problem?
You may not display the output in underlined/ italics on the console, may you?
But - as comment to Stan/ ansi.sys:
Yes, it's possible for at least Win95, 98 and 2000 (though the latter one doesn't contain an ansi.sys, but older ones work well and you have to load them of course to your command.com/ cmd.exe).
And these Ansi-Escape-Sequences behave nearly the same on linux and windows.
But it's not easy, to adopt the tagging from html, xml. (I don't know the expression APA-style too.)
Try this:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!