Ticket #165 (new defect)

Opened 7 weeks ago

Last modified 7 weeks ago

Continue after parsing undefined namespace prefixes

Reported by: Astro Owned by: ser
Priority: normal Milestone:
Component: SAX2 Version: 3.1.7
Severity: major Keywords:
Cc: Ruby version: 1.8.6
Operating system: All

Description

REXML barks with UndefinedNamespaceException? in baseparser.rb:389 upon encountering an unbound namespace prefix.

However, in XMPP4R we have to parse such elements which not have been properly filtered by the server. This results in a stream disconnect.

Attachments

0001--ignore_undefined_namespaces.patch (1.7 kB) - added by Astro 5 weeks ago.
Optionally disable this functionality

Change History

Changed 7 weeks ago by ser

What is your suggested solution? The Namespaces in XML specification asserts that:

The Prefix provides the namespace prefix part of the qualified name, and must be associated with a namespace URI reference in a namespace declaration.The Prefix provides the namespace prefix part of the qualified name, and must be associated with a namespace URI reference in a namespace declaration.

According to the keyword definitions in RFC2119:

  1. MUST This word, or the terms "REQUIRED" or "SHALL", mean that the definition is an absolute requirement of the specification.1. MUST This word, or the terms "REQUIRED" or "SHALL", mean that the definition is an absolute requirement of the specification.

So, what you're describing is an invalid XML document, and REXML must generate an exception.

Changed 7 weeks ago by Astro

I understand. But when using REXML in a networked environment I would like to hint on Postel's Law: "... be liberal in what you accept from others." :-)

Changed 7 weeks ago by Rolle

It also breaks WSS4R because it parses xml fragments without valid namespace declarations. According to the specs REXML is right. I would see the alternative to "turn off" namespace validation as a feature and not as a breakage.

Changed 5 weeks ago by Astro

Optionally disable this functionality

Note: See TracTickets for help on using tickets.