Last Comment Bug 445285 - An instance with an empty default namespace inherits the namespace of the parent document.
: An instance with an empty default namespace inherits the namespace of the par...
: fixed1.8.1.17
Product: Core Graveyard
Classification: Graveyard
Component: XForms (show other bugs)
: unspecified
: x86 Linux
: -- normal with 2 votes (vote)
: ---
Assigned To: aaronr
Depends on:
  Show dependency treegraph
Reported: 2008-07-14 23:27 PDT by Swithun Crowe
Modified: 2016-07-15 14:46 PDT (History)
5 users (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---

Shows issue is not with namespace construction, but with serialization; removes Ubiquity script reference (2.42 KB, application/xhtml+xml)
2008-07-17 11:51 PDT, Leigh L. Klotz, Jr.
no flags Details
patch (6.15 KB, patch)
2008-07-19 02:07 PDT, aaronr
no flags Details | Diff | Splinter Review
patch2 (3.10 KB, patch)
2008-07-26 14:23 PDT, aaronr
bugs: review+
doronr: review+
Details | Diff | Splinter Review
testcase w/ diff echo server (2.44 KB, application/xhtml+xml)
2008-07-26 14:25 PDT, aaronr
no flags Details

Description Swithun Crowe 2008-07-14 23:27:16 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20080416 BonEcho/
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20080416 BonEcho/

The XHTML document has a default XHTML namespace. An inline instance has a non-default namespace and an empty default one. On submission, the instance's default namespace has become the XHTML one.

Reproducible: Always

Steps to Reproduce:
1. Load form like
2. Submit
3. Check output
Actual Results:  
The submitted instance is:

<?xml version="1.0" encoding="UTF-8"?>
<foo:Foo xmlns:foo="" xmlns="" 
xmlns:xf="" xmlns:ev="" xmlns:xlink="" xmlns:xsd="" xmlns:xsi=""/>

Expected Results:  
Ideally, you would get:

<?xml version="1.0" encoding="UTF-8"?>
<foo:Foo xmlns:foo=""/> 

Formsplayer produces the desired result. From what the W3C says about inheriting/overriding default namespaces (, I would say that the XForms plugin isn't handling this correctly.
Comment 1 Nick Van den Bleeken 2008-07-16 23:43:44 PDT
Someone (Swithun Crowe) raised this issue also on the www-forms mailinglist of w3c, I informed him that it is a bug in the Mozilla XForms implementation.
Comment 2 Leigh L. Klotz, Jr. 2008-07-17 11:41:52 PDT
Possibly related to #330557 
Comment 3 Leigh L. Klotz, Jr. 2008-07-17 11:50:38 PDT
I believe the issue is serialization, not construction of the InfoSet.
The attached updated namespace2.xhtml shows that the the instance has child nodes of foo:Foo in the xmlns="" namespace.

Also, the attached example removes the Ubiquity script reference; it appeared to make no difference.
Comment 4 Leigh L. Klotz, Jr. 2008-07-17 11:51:39 PDT
Created attachment 330075 [details]
Shows issue is not with namespace construction, but with serialization; removes Ubiquity script reference
Comment 5 aaronr 2008-07-17 12:17:48 PDT
Not really related to bug 330557.  The fact that we are serializing by hand and possibly missing namespaces from some ancestor elements is what bug 330557 is about.  If we can figure out how to serialize namespaces through mozilla and eliminate the need for serializing by hand, then we can get rid of the code that contains this bug.
Comment 6 aaronr 2008-07-19 02:07:58 PDT
Created attachment 330356 [details] [diff] [review]

added a parameter to AddNameSpaces to allow us to remember whether to ignore the default namespace as we search up our ancestor tree
Comment 7 Olli Pettay [:smaug] 2008-07-21 01:38:11 PDT
Comment on attachment 330356 [details] [diff] [review]

>     nsAutoString XMLNSAttrValue;
>+    PRBool ignoreDefaultNS = PR_FALSE;
>     submDocElm->GetAttributeNS(kXMLNSNameSpaceURI, NS_LITERAL_STRING("xmlns"),
>                                XMLNSAttrValue);

Should we actually test HasAttributeNS? It is ok to have empty value.

>     if (XMLNSAttrValue.IsEmpty() && (!prefixHash ||
>         !prefixHash->Get(NS_LITERAL_STRING("#default"), nsnull))) {
>       submDocElm->RemoveAttributeNS(kXMLNSNameSpaceURI,
>                                     NS_LITERAL_STRING("xmlns"));
>+      ignoreDefaultNS = PR_TRUE;
>     }
Comment 8 aaronr 2008-07-21 10:06:31 PDT
On this thread,, the W3C said that it doesn't matter if we serialize an empty default namespace or not, but as of Friday morning things were leaning toward not serializing it as a preference.  More arguments have come up since then, though.

I'm fine with serializing the empty default namespace.  If you feel the same, then I'll just do it and we'll be done with it.
Comment 9 Olli Pettay [:smaug] 2008-07-22 05:47:25 PDT
I think the default namespace should be serialized.
Comment 10 aaronr 2008-07-26 14:23:50 PDT
Created attachment 331441 [details] [diff] [review]

Changed per Olli to export the default namespace.  No real consensus on the W3C side whether it should be serialized or not, either, so I guess if the author bothered to put it there, we should serialize it.
Comment 11 aaronr 2008-07-26 14:25:15 PDT
Created attachment 331442 [details]
testcase w/ diff echo server

same testcase as before but using the echo server (which seems to always be up and the other one doesn't)
Comment 12 aaronr 2008-08-07 13:29:35 PDT
checked into cvs trunk
Comment 13 aaronr 2008-08-07 14:05:14 PDT
checked into 1.8 branch

Note You need to log in before you can comment on or make changes to this bug.