tags:

views:

67

answers:

2

I've recently been charged with creating a Android & iphone app for work. That being said, I'm a css/php designer-developer with a bit of javascript in the mix.

I need to write a bit of Java (not javascript) that will convert a table based layout into a div based layout so that I can then have control over positioning, padding, and what not.

I see many similar post, but these post involve more "designer" oriented goals rather than functional control over positioning, layout and so on.

A good resource would be greatly appreciated as I can't seem to google an appropriate search string. My searches tend to yield more "free javascript code", "Java tutorials about making flashing banners", "How to make fading menus" and countless other rabbit holes that lead to wonderland.

Oh, Currently using eclipse with Android SDK & ADT plugins installed.

+3  A: 

It would be much more easier if you have predefinied a set of rules how the conversion should actually be taken place. There is namely fairly a lot which needs to be taken into account. This is really not going to be a bit of Java.

If you're looking for an existing tool, in Adobe Dreamweaver you can do that by Modify > Convert > Tables to AP divs. But still, I question if those kind of tools provides exactly that what you need. As said, there's fairly a lot which needs to be taken into account and it's shooting in the dark without a clear set of rules/requirements.

BalusC
+1  A: 

you may have to write more than a bit of java. you will need parse the html (http://www.benmccann.com/dev-blog/java-html-parsing-library-comparison/) and walk the dom (http://stackoverflow.com/questions/672791/how-to-search-in-a-html-file-for-some-tags). that's fairly straightforward (assuming that your html is well formed), but i suspect that turning each table element into a div will require a moderate amount of code.

as BalusC pointed out, there may be tools that can get you part of the way, so you might try to do it in two passes.

Ray Tayek
Thanks for the responses. Indeed a fair amount of planning and certain requirements must be met. More than a bit. I do tend toward simplification. So...The requirements stated loosely:Take a existing .inc file containing the html tabled structure and convert said html content into a div based layout. Keeping in mind that the html content in the .inc file displays database content in an iframe (horror!) from a different domain and do this "above" the underlying code base which will not be altered. Again probably to simplifed.Ray Tayek. Thanks for linked resources to study.Cheers,Ostrava
Ostrava