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...
Status: RESOLVED FIXED
: 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
:
Mentors:
http://swithun.servebeer.com/namespac...
Depends on:
Blocks:
  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: ---


Attachments
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:1.8.1.14) Gecko/20080416 BonEcho/2.0.0.14
Build Identifier: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.14) Gecko/20080416 BonEcho/2.0.0.14

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 http://swithun.servebeer.com/namespace.xhtml
2. Submit
3. Check output
Actual Results:  
The submitted instance is:

<?xml version="1.0" encoding="UTF-8"?>
<foo:Foo xmlns:foo="http://www.example.com/#foo" xmlns="http://www.w3.org/1999/xhtml" 
xmlns:xf="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>

Expected Results:  
Ideally, you would get:

<?xml version="1.0" encoding="UTF-8"?>
<foo:Foo xmlns:foo="http://www.example.com/#foo"/> 

Formsplayer produces the desired result. From what the W3C says about inheriting/overriding default namespaces (http://www.w3.org/TR/REC-xml-names/#defaulting), 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.

http://lists.w3.org/Archives/Public/www-forms/2008Jul/0001.html
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]
patch

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]
patch


>     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, http://lists.w3.org/Archives/Public/www-forms/2008Jul/0001.html, 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]
patch2

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 xformstest.org 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.