Closed
Bug 413907
Opened 18 years ago
Closed 18 years ago
OpenSearch parser doesn't understand XML namespaces
Categories
(Camino Graveyard :: General, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
Camino1.6
People
(Reporter: stuart.morgan+bugzilla, Assigned: murph)
Details
(Keywords: fixed1.8.1.13)
Attachments
(3 files)
|
2.82 KB,
patch
|
stuart.morgan+bugzilla
:
review+
mikepinkerton
:
superreview+
|
Details | Diff | Splinter Review |
|
1.95 KB,
application/zip
|
Details | |
|
1.54 KB,
patch
|
mikepinkerton
:
superreview+
|
Details | Diff | Splinter Review |
The way the OpenSearch XML parser looks for specific elements doesn't account for the possibility of XML namespaces. I've encountered a plugin that looks like this (sorry, no link available, but making a testcase will be easy):
<Search Plugin xmlns:os="http://a9.com/-/spec/opensearch/1.1"...>
<os:ShortName>...
<os:Description>...
etc.
Because of the namespace prefix, the parser is rejecting the elements since they don't match the built-in list.
Given the very limited domain of things we need to parse, I bet we could get away with just throwing away <anything>: whenever we look at an element to decide what to do with it.
Flags: camino1.6?
| Assignee | ||
Comment 1•18 years ago
|
||
(In reply to comment #0)
> Given the very limited domain of things we need to parse, I bet we could get
> away with just throwing away <anything>: whenever we look at an element to
> decide what to do with it.
Sound like a good enough plan to me; doesn't hurt attempting to work with a wide range of possible input.
During the initial design I was wary of introducing anything related to namespaces, as NSXMLParser pre-10.4 supposedly does not support or handle them very well. I think the documentation is mainly referring to some of the specific delegate methods and arguments explicitly about namespaces, however, and the actual problem we're dealing with doesn't necessarily require using any of those features.
I made up a quick test case and debugged it, and it seems that the didStartElement... delegate method will just supply the namespace prefix along with the element name, as "os:ShortName", not trying to do anything special as far as breaking up the namespace from the element. Since that's the case, taking your route should be possible. I'll take a look at fixing it.
Also, nice catch noticing this problem; I mistakingly never managed to run into and test a plug-in using a namespace prefix.
Assignee: nobody → murph
| Assignee | ||
Comment 2•18 years ago
|
||
I decided to let XMLSearchPlugin parser handle the namespaces issue. The only problem with ignoring namespaces at this level is that if we ever have any parser subclasses that need to deal with them, it would be the wrong approach. If you think this will cause future trouble, I can move the behavior down into OpenSearchParser...
Attachment #302829 -
Flags: review?(stuart.morgan)
| Assignee | ||
Comment 3•18 years ago
|
||
Contains a test web page + OS definition.
| Reporter | ||
Comment 4•18 years ago
|
||
For trunk this should probably just use +[NSXMLNode localNameForName:]. I'll review this version for the branch when I get a chance though.
| Reporter | ||
Updated•18 years ago
|
Flags: camino1.6? → camino1.6+
Target Milestone: --- → Camino1.6
| Reporter | ||
Comment 5•18 years ago
|
||
Comment on attachment 302829 [details] [diff] [review]
Branch Patch
>+- (NSString *)simplifiedNameForElement:(NSString *)fullElementName;
For consistency with the 10.4+ method that it's re-imlementing, make this a class method and call it localNameForName:.
r=me for branch with that change (and r=me for a trunk version that doesn't have the new method, and uses NSXMLNode localNameForName: in the places this patch uses your new method)
Attachment #302829 -
Flags: review?(stuart.morgan) → review+
| Assignee | ||
Comment 6•18 years ago
|
||
Attachment #305414 -
Flags: superreview?(mikepinkerton)
| Assignee | ||
Updated•18 years ago
|
Attachment #302829 -
Flags: superreview?(mikepinkerton)
| Assignee | ||
Updated•18 years ago
|
Attachment #302829 -
Attachment description: Patch → Branch Patch
Comment 7•18 years ago
|
||
Comment on attachment 302829 [details] [diff] [review]
Branch Patch
sr=pink
Attachment #302829 -
Flags: superreview?(mikepinkerton) → superreview+
Comment 8•18 years ago
|
||
Comment on attachment 305414 [details] [diff] [review]
Trunk Patch
sr=pink
Attachment #305414 -
Flags: superreview?(mikepinkerton) → superreview+
| Reporter | ||
Comment 9•18 years ago
|
||
Landed on trunk and MOZILLA_1_8_BRANCH.
You need to log in
before you can comment on or make changes to this bug.
Description
•