Closed Bug 284351 Opened 19 years ago Closed 19 years ago

nsSchemaLoader doesn't handle xsd:complexType correctly.

Categories

(Core Graveyard :: Web Services, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: doronr, Assigned: doronr)

Details

Attachments

(2 files, 2 obsolete files)

So I have a schema file with:

	<xsd:complexType name="MoneyLaundering">
		<xsd:annotation>
			<xsd:documentation>Electronic Money Laundering</xsd:documentation>
		</xsd:annotation>
		<xsd:sequence maxOccurs="unbounded">
			<xsd:element ref="ml:individual"/>
		</xsd:sequence>
	</xsd:complexType>

 http://lxr.mozilla.org/seamonkey/source/extensions/webservices/schema/src/nsSchemaLoader.cpp#1305
is called on the annotation node, and
http://lxr.mozilla.org/seamonkey/source/extensions/webservices/schema/src/nsDOMUtils.h#119
results in the mathml namespace.
Where does nsMathMLAtoms come in?  Is there a testcase that shows the bug?

Note that there is a nsMathMLAtoms::annotation_ atom that maps to the string
"annotation".  But that would be the tagname, not the namespace here...
I'm working on a testcase.  It seems the DOMElement for the xsd:annotation node
uses nsMathMLAtoms:Annotation for its mName.

I thought this was failing:
http://lxr.mozilla.org/seamonkey/source/extensions/webservices/schema/src/nsSchemaLoader.cpp#1323
since we seem to get into the last else{} but I am told that compating atoms who
define "annotation" should be equal.  I'll find out more tomorrow.

This bug was more of a reminder for me on what I found out and to include in my
status report :)
> It seems the DOMElement for the xsd:annotation node uses
> nsMathMLAtoms:Annotation for its mName.

That's fine, and the expected behavior under the circumstances.  Why is this a
problem?
Attached patch Correctly follow the schema spec (obsolete) — Splinter Review
Assignee: web-services → doronr
Status: NEW → ASSIGNED
Attachment #176047 - Attachment is obsolete: true
Spec is here:
http://w3.org/TR/xmlschema-1/#element-complexType

Oops, patch had tabs, going to fix that in a sec.
Summary: xsd:annotation becomes nsMathMLAtoms:Annotation → nsSchemaLoader doesn't handle xsd:complexType correctly.
Attached patch remove tabs.Splinter Review
Attachment #176049 - Attachment is obsolete: true
Attachment #176050 - Flags: superreview?(peterv)
The problem here was simple - if we hit annotation, we would bail, saying its
invalid, while all other items were processed:

  else if (tagName != nsSchemaAtoms::sAnnotation_atom) {
  } else {
  }

This patch follows the spec and bails on any item not allowed in the spec,
rather than trying to process ones we know aren't allowed.  Also, it handles
annotations and currently does nothing with them.
Comment on attachment 176050 [details] [diff] [review]
remove tabs.

You could remove all the else-after-break's too. But shouldn't we actually
continue looping after finding an annotation? With this patch we'll ignore the
simpleContent/complexContent/... coming after the annotations.
Attachment #176050 - Flags: superreview?(peterv) → superreview-
Ah, so just removing the break; from the annotation condition should do it, right?
Attachment #176737 - Flags: superreview?(peterv)
Comment on attachment 176737 [details] [diff] [review]
don't break when we find an annotation

Sure, but if you can, please remove the else's after a break, they're not
needed.
Attachment #176737 - Flags: superreview?(peterv)
Attachment #176737 - Flags: superreview+
Attachment #176737 - Flags: review+
checked in.
Status: ASSIGNED → 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: