Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Monday, January 19, 2009

HTML/CSS: Table inside table getting out containing cell with IE

Consider this table with a width: 100% displayed inside a table cell:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<table style="width:100%; border: 1px solid red">
<tr>
<td>
<div style="padding-left: 3em;
padding-right: 3em">
<table style="width: 100%;
border: 1px solid blue">
<tr>
<td>Gaga</td>
</tr>
</table>
</div>
</td>
</tr>
</table>

</body>
</html>

With IE, the table "gets out" of its containing cell. Notice that it is as if the width of the inner table was calculated without taking the padding into account, but its position inside the cell was taking the padding into account:
HTML_CSS_ Table inside table getting out containing cell with IE - Google Docs.png
The expected result is rather:
ff-ok-1.png
There are two ways to fix this:

The clean way – Switch the rendering from quirks mode to strict mode by changing the doctype. If you can, I'd recommend you do this. This means that in the above code, you would just replace the doctype declaration with:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

The workaround way – Instead of defining the padding on a div, you put it directly on the outer cell, and remove the div, which gives you the following code.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<table style="width:100%; border: 1px solid red">
<tr>
<td style="padding-left: 3em; padding-right: 3em">
<table style="width: 100%;
border: 1px solid blue">
<tr>
<td>Gaga</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

Friday, January 25, 2008

Reformat XML with XML Spy

If you wouldn't think of IntelliJ when looking for an XML editor, think again: IntelliJ is a great XML editor. As a matter of fact, it has been my XML editor of choice many year now.

But I have to admit: IntelliJ isn't perfect; in particular, it is very slow at reformatting XML on large files. Say you have a document that weighs a few MB and you want to reformat it to make it more readable. This happens to me frequently when dealing with XML generated by Microsoft Word, which likes to put pretty much everything on a single line. Going through a few MB of XML all in one single line not what I would describe as an enjoyable experience. So here is the trick:

  1. Open your large XML file in XML Spy, reformat it, and save it.
  2. Open the newly formatted file in IntelliJ (or your favorite editor).
XML Spy is able to reformat large XML files in a breeze. So refreshing!

Monday, December 03, 2007

URIs Validation in IntelliJ

IntelliJ checks that URI in your XML files are valid. This is a nice feature, except in those cases where you know a URI is valid, but IntelliJ think it isn't and reports an error. For instance, IntelliJ wouldn't know about URIs such as oxf:/apps/myapp/myfile.xml we are using in Orbeon Forms.

Starting with 7.0.2, you can tell IntelliJ to ignore specific URIs you know to be valid:

A preview of 7.0.2 was released just a few days ago, and you can download it from their EAP site. If you are on 7.0.1, you will also get a good number of bug fixes.

Saturday, April 10, 2004

Features we need in Eclipse


  • Ability to define shortcuts to activate views, e.g. the Navigator view

  • Ability to define shortcut for contextual menu (right click) actions, including actions contributed by plugins

  • Highlight occurence of a given text in file (IntelliJ's "Highlight usages in file"). For instance here the word "XML" is highlighted this way in IntelliJ:



  • Completely remove the toolbar - who needs a toolbar? ;)

  • Option to show the complete full path of currently edited file in Eclipse window title

  • Editor: copy and cut work as if the current line was selected when nothing is selected

  • Editor: action to duplicate selection

  • Automatic "save all" when swtiching to another application

  • Mouse wheel does not scroll window under cursor but active window

  • IntelliJ's live templates

  • Every time the Search dialog is opened, it seems to go to the same tab (XPath search, as I have XML Buddy installed). I would like it to go the last tab I used. (Could this problem be caused by XML Buddy?)

  • All the log4j plugins I got a chance to try seems to be broken under M8. What's the deal?



Issues or questions with solutions:


  • The shape of the caret is, well, original (see on the right). Solution: This is because the editor is in "smart insert" mode.