Closed Bug 445285 Opened 16 years ago Closed 16 years ago

An instance with an empty default namespace inherits the namespace of the parent document.

Categories

(Core Graveyard :: XForms, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: swithun, Assigned: aaronr)

References

()

Details

(Keywords: fixed1.8.1.17)

Attachments

(2 files, 2 obsolete files)

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.
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
Possibly related to #330557 
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.
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.
Attached patch patch (obsolete) — Splinter Review
added a parameter to AddNameSpaces to allow us to remember whether to ignore the default namespace as we search up our ancestor tree
Assignee: nobody → aaronr
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #330356 - Flags: review?(Olli.Pettay)
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;
>     }
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.
I think the default namespace should be serialized.
Attached patch patch2Splinter 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.
Attachment #330356 - Attachment is obsolete: true
Attachment #331441 - Flags: review?(Olli.Pettay)
Attachment #330356 - Flags: review?(Olli.Pettay)
same testcase as before but using the xformstest.org echo server (which seems to always be up and the other one doesn't)
Attachment #330075 - Attachment is obsolete: true
Attachment #331441 - Flags: review?(doronr)
Attachment #331441 - Flags: review?(doronr) → review+
Attachment #331441 - Flags: review?(Olli.Pettay) → review+
checked into cvs trunk
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Whiteboard: xf-to-branch
checked into 1.8 branch
Keywords: fixed1.8.1.17
Whiteboard: xf-to-branch
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: