We don't handle ref="ns:type" in schema code.

RESOLVED FIXED

Status

RESOLVED FIXED
14 years ago
a year ago

People

(Reporter: doronr, Assigned: doronr)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

14 years ago
nsSchemaElementRef::Resolve simply calls mSchema->GetElementByName(mRef,
getter_AddRefs(mElement));, and doesn't take ns:type as a ref value into
consideration.
(Assignee)

Comment 1

14 years ago
Created attachment 182406 [details] [diff] [review]
patch - store the namespace in nsSchemaElementRef
Attachment #182406 - Flags: superreview?(peterv)
(Assignee)

Comment 2

14 years ago
Found this working on complex type validation.  It would throw an exception when
trying to call nsISchemaParticle->GetName() for example.
Comment on attachment 182406 [details] [diff] [review]
patch - store the namespace in nsSchemaElementRef

>Index: extensions/webservices/schema/src/nsSchemaLoader.cpp
>===================================================================

>@@ -992,8 +993,36 @@
>   aElement->GetAttribute(NS_LITERAL_STRING("ref"), ref);
>   if (!ref.IsEmpty()) {
>     nsSchemaElementRef* elementRef;
>-    
>-    elementRef = new nsSchemaElementRef(aSchema, ref);
>+    nsAutoString refNS;
>+
>+    if (ref.FindChar(':') != kNotFound) {

I didn't really find in the spec if there's a default namespace (for unprefixed
ref attribute values), do you know?
I think we should always call CheckQName and only look up the namespace URI if
colon is non-null, what do you think?
Attachment #182406 - Flags: superreview?(peterv) → superreview+
(Assignee)

Comment 4

14 years ago
(In reply to comment #3)
> (From update of attachment 182406 [details] [diff] [review] [edit])
> >Index: extensions/webservices/schema/src/nsSchemaLoader.cpp
> >===================================================================
> 
> >@@ -992,8 +993,36 @@
> >   aElement->GetAttribute(NS_LITERAL_STRING("ref"), ref);
> >   if (!ref.IsEmpty()) {
> >     nsSchemaElementRef* elementRef;
> >-    
> >-    elementRef = new nsSchemaElementRef(aSchema, ref);
> >+    nsAutoString refNS;
> >+
> >+    if (ref.FindChar(':') != kNotFound) {
> 
> I didn't really find in the spec if there's a default namespace (for unprefixed
> ref attribute values), do you know?

From what I can tell, it seems to imply that no ns: means current schema
document.  The samples and schema files I have seen seem to impyl this as well.

> I think we should always call CheckQName and only look up the namespace URI if
> colon is non-null, what do you think?
> 

You are probably right, FindChar in the case of no ns: means it has to walk the
whole string.  And if ns: exists, we go through some part of the string and then
through it again in CheckQName() probably.

Do I need a r= for this as well?
Status: NEW → ASSIGNED
Comment on attachment 182406 [details] [diff] [review]
patch - store the namespace in nsSchemaElementRef

r/sr=peterv with change to always call CheckQName.
Attachment #182406 - Flags: review+

Comment 6

14 years ago
Comment on attachment 182406 [details] [diff] [review]
patch - store the namespace in nsSchemaElementRef

a=mkaply
Attachment #182406 - Flags: approval1.8b2+
(Assignee)

Comment 7

14 years ago
checked in!
Status: ASSIGNED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → FIXED

Updated

a year ago
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.