These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

Getting ship description from data dump

Author
Yokomaki
Imperial Academy
Amarr Empire
#1 - 2013-10-19 13:44:45 UTC
Has anyone parsed a ship's description in the invType table? Did you just use regex or is there a more elegant way? It's filled with html mark up.

KL1
The Dirty Alpaca Fur Traders
The Last Alpaca
#2 - 2013-10-19 14:08:27 UTC
Strip the HTML tags, php has a function , other languages might have same function
Yokomaki
Imperial Academy
Amarr Empire
#3 - 2013-10-19 14:25:40 UTC
You just end up with a blob of text at that point.

http://wiki.eveuniversity.org/Naga

Is an example of the end result I'm looking for with the description set apart from the ship bonuses etc. I would figure out some regex but it appears not all the ship descriptions use the same format?
Vogue
A Blessed Bean
Pandemic Horde
#4 - 2013-10-19 15:14:34 UTC  |  Edited by: Vogue
As well as HTML markup in the description field of a ship in table invTypes there is also, invisible to the eye as a SQL select query result in Microsoft SQL Server Management Studio, carriage return, line feed and tab characters.

'Notepad++' windows text editor has an option to view hidden carriage return, line feed, tab characters. It is also good for examining XML files.
Rob Crowley
State War Academy
#5 - 2013-10-19 15:50:20 UTC
KL1 wrote:
Strip the HTML tags, php has a function , other languages might have same function
This. However, I would suggest replacing br-tags with other linebreaks first. The description texts have a rather messy mix of LFs, CRLFs and br-tags for linebreaks.
Yokomaki
Imperial Academy
Amarr Empire
#6 - 2013-10-19 16:17:45 UTC
Thanks guys, I got it with a combination of:
str_replace - replacing \r\n with br tags
strip_tags - allowing br tags