views:

29

answers:

1

I'm having an issue using multiple XML namespaces in a XHTML document. Specifically, I'm trying to use Wicket and Nitobi in the same document.

The code looks something like this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd"
      xmlns:ntb="http://www.nitobi.com"&gt;

... blah blah blah ...

<wicket:extend>
  <div wicket:id="gridContainer">
    <wicket:panel>
      <ntb:grid wicket:id="grid" id="grid14" width="660" height="600" mode="livescrolling"> 
      </ntb:grid>
    </wicket:panel>
  </div>
</wicket:extend>

... blah blah blah ...

There is also code in the header that invokes Nitobi's grid initialization code which basically attempts to grab the ntb:grid XML. However, when I step through that initialization with Firebug, I see that Firefox pukes on the XML parsing with this error:

Parsing Error: prefix not bound to a namespace 
Location: http://localhost:8080/foo/bar 
Line Number 1, Column 1:
<ntb:grid xmlns:ntb="http://www.nitobi.com" mode="livescrolling" height="600" width="660" id="grid14" wicket:id="grid">
</ntb:grid>

What am I doing wrong? I have a feeling the issue has to do with how the <ntb> tags are nested within the <wicket> tags.

+1  A: 

I discovered that the issue was being caused by having a wicket:id on the ntb:grid element. The workaround was to strip the wicket: namespaced tags from the page as outlined here:

https://cwiki.apache.org/WICKET/how-to-remove-wicket-markup-from-output.html

Here are the pertinent parts:

private boolean stripTags;

public TestPage() {
    stripTags =  getApplication().getMarkupSettings().getStripWicketTags();
}

@Override
protected void onBeforeRender() {
    getApplication().getMarkupSettings().setStripWicketTags(true);
}

@Override
protected void onAfterRender() {
    getApplication().getMarkupSettings().setStripWicketTags(stripTags);
}
cdmckay