Namespace prefixes in XForms and discrepant results

In exploring very simple uses of namespace prefixed elements I have turned up 
different behaviour from X-Smiles 0.71 and the Novell XForms Preview.

I will present the longest version of the code, then suggest how it be 
selectively modified to illustrate different namespace scenarios and will 
briefly describe each set of the results on X-Smiles and Novell respectively.

The code isn't complete. At this stage I am simply comparing output from the 
two XForms processors.

Here is the code:

<?xml version="1.0"?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html 
 xmlns="http://www.w3.org/1999/xhtml" 
 xmlns:ev="http://www.w3.org/2001/xml-events"
 xmlns:xforms="http://www.w3.org/2002/xforms/cr"
 xmlns:xmml="http://www.xmml.com"
 lang="en" xml:lang="en">
 <link href="SimpleLogin.css" rel="stylesheet" type="text/css"></link>

<head>
<title>Simple XForms Login Example</title>
<xforms:model>
 <xforms:submission localfile="DumpData.xml" method="postxml"/>
 <xforms:instance xmlns=""
  xmlns:xmml="http://www.xmml.com">
 <LoginData>
  <Name>Your Name</Name>
  <Password>Your password</Password>
  <xmml:Name >Your QName</xmml:Name>
  <xmml:Password></xmml:Password>
 </LoginData>
 </xforms:instance>
</xforms:model>
</head>
<body xmlns:xmml="http://rubbish"> 
 <xforms:input ref="/LoginData/xmml:Name">
  <xforms:label>Enter your name:</xforms:label>
 </xforms:input>
 <xforms:secret ref="/LoginData/Password" style="width:100pt">
  <xforms:label>Enter your password:</xforms:label>
 </xforms:secret>
<p/>
<xforms:submit>
 <xforms:label>Login by clicking here</xforms:label>
</xforms:submit>
</body> 
</html>

The SimpleLogin.css file is here:
body { font-style: normal; font-weight: 500; background-color: #EEEEFF; 
color: red;}
input, secret {width: 200pt; color:black; background-color: #FFFFFF; 
border:green;}
label {color:red}

With the above XHTML the results are as follows:
X-Smiles - gives an input binding failed error
Novell - displays but doesn't find the text inside <xmml:Name>

If the xmlns:xmml="http://rubbish" namespace declaration on <body> is 
removed:
X-Smiles - works
Novell - usually works (the text in the first <xforms:input> sometimes 
doesn't display but is there if you click on it)

If the xmlns:xmml="http://www.xmml.com" on <html> is removed:
X-Smiles: java.langNullPointerException
Novell: two error messages re failing to bind xmml

If the binding expressions on <xforms:input> are modified to remove the 
namespace prefixes from xmml:Name and xmml:Password then the original form 
"works" despite the fact that the namespace declarations for unprefixed 
elements are different in the two locations.

When prefixed element nodes with different namespace declarations (original 
code above) are processed then X-Smiles fails and Novell produces a sort of 
half-way house.

I hope I have explained that clearly enough for readers to follow.

Thoughts?

What should be displayed for each of these four variants on this pretty 
simple code?

Andrew Watt

Received on Saturday, 8 March 2003 14:58:40 UTC