Project

General

Profile

Actions

Bug #5956

closed

rexml - パース時のnamespaceチェックでのエラーについて

Added by m-hiramatsu (Miho Hiramatsu) about 12 years ago. Updated about 12 years ago.

Status:
Closed
Target version:
ruby -v:
ruby 1.9.3p0 (2011-10-30 revision 33570) [i686-linux]
Backport:
[ruby-dev:45169]

Description

添付のプログラムを実行すると以下のエラーとなります。
(実行環境:CentOS6)

The 'xml' prefix must not be bound to any other namespace (http://www.w3.org/TR/REC-xml-names/#ns-decl)
Line: 7
Position: 477

XMLデータ内の以下の記述に対して、
xmlns:xml="http://www.w3.org/XML/1998/namespace"
「属性"xmlns:xml"のnamespaceが"http://www.w3.org/XML/1998/namespace"でなければエラーとする」というチェックを
/rexml/parsers/baseparser.rb line:386付近
で実行しているようですが、以下は誤りではないでしょうか。

[baseparser.rbのline:386付近を抜粋]
   ...略
attrs.each { |a,b,c,d,e|
if b == "xmlns"
if c == "xml"
if d != "http://www.w3.org/XML/1998/namespace"
msg = "The 'xml' prefix must not be bound to any other namespace "+
"(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
raise REXML::ParseException.new( msg, @source, self )
end
   ...略

if d != "http://www.w3.org/XML/1998/namespace"

本来"d"ではなく"e"と比較すべきではないでしょうか。


Files

rexml_sample.rb (841 Bytes) rexml_sample.rb m-hiramatsu (Miho Hiramatsu), 02/01/2012 03:47 PM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0