Closed Bug 268285 Opened 20 years ago Closed 19 years ago

Support includenamespaceprefixes attribute on xforms <submission> element.

Categories

(Core Graveyard :: XForms, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: darin.moz, Assigned: jhpedemonte)

References

Details

Attachments

(1 file, 1 obsolete file)

Support includenamespaceprefixes attribute on xforms <submission> element.
Blocks: 263086
Severity: normal → enhancement
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.8beta
taking
Assignee: darin → doronr
Status: ASSIGNED → NEW
The way to do this would probably be:

during the serialization process, where we walk the instance document and clone
nodes, we should create a hash table (assuming the attribute is set) and add all
used namespaces to it.

Probably a good intro bug.
Target Milestone: mozilla1.8beta1 → ---
Shouldn't be too tough.  See me or Doron if you have any questions about the
namespace serialization stuff.
Assignee: doronr → jhpedemonte
please also determine what our behavior should be if we have namespace prefixes
in the instance document that are NOT mentioned as a value in the
includenamespaceprefixes attribute.
Also, what does "in addition to those visibly utilized" mean?  As mentioned
under includenamespaceprefixes at:
http://www.w3.org/TR/xforms/index-all.html#structure-model-submission
Attached patch patch (obsolete) — Splinter Review
The term "visibly utilized" is defined here:
http://www.w3.org/TR/2002/REC-xml-exc-c14n-20020718/#sec-Terminology.  From
discussions with Doron, it seems that the |nsIDOMSerializer| automatically adds
the namespace declaration if it finds the namespace prefix used, taking care of
that requirement in the spec.

In this patch, I just created a hash set as suggested by Doron to hold the
namespace prefixes, then check for them in |AddNameSpaces()|.
Attachment #187543 - Flags: review?(doronr)
Attachment #187543 - Flags: review?(doronr) → review+
Attachment #187543 - Flags: review?(smaug)
Comment on attachment 187543 [details] [diff] [review]
patch


> 
>+nsStringHashSet*
>+nsXFormsSubmissionElement::GetIncludeNSPrefixesAttr()
>+{
>+  nsStringHashSet* prefixHash = new nsStringHashSet();

Handle OOM.

>+  prefixHash->Init(5);
>+
>+  nsAutoString prefixes;
>+  mElement->GetAttribute(kIncludeNamespacePrefixes, prefixes);
>+
>+  // Cycle through space-delimited list and populate hash set
>+  if (!prefixes.IsEmpty()) {
>+    PRInt32 start = 0, end;
>+
>+    do {
>+      end = prefixes.FindChar(' ', start);

Shouldn't we support also other whitespace characters?
Attachment #187543 - Flags: review?(smaug) → review-
Attached patch patch v1.1Splinter Review
This patch adds some error handling, and properly handles multiple consecutive
spaces.

+ Shouldn't we support also other whitespace characters?
Doesn't look like we need to.  I added tabs, newlines, and carriage returns to
my test case, but each time |GetAttribute()| returned a string that only
contained spaces for the whitespace.
Attachment #187543 - Attachment is obsolete: true
Attachment #187711 - Flags: review?(smaug)
(In reply to comment #8)
> Doesn't look like we need to.  I added tabs, newlines, and carriage returns to
> my test case, but each time |GetAttribute()| returned a string that only
> contained spaces for the whitespace.

Are you really sure about this. What happens if a script does something like
submissionElement.setAttribute('includenamespaceprefixes', 'foo \t\t\t\n bar');

Comment on attachment 187711 [details] [diff] [review]
patch v1.1

Though, adding tabs and
newlines using scripts doesn't sound too likely and I'm not sure if we really
have to handle that case.
r=me
Attachment #187711 - Flags: review?(smaug) → review+
> Are you really sure about this. What happens if a script does something like
> submissionElement.setAttribute('includenamespaceprefixes', 'foo \t\t\t\n bar');

Yes, you are correct.  With a script like that, I see those other whitespace
chars in the string returned from |GetAttribute()|.  So, just to be safe, I'll
change that line to |FindCharInSet(" \t\r\n", start)| when checking in.
Checked in.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
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: