Ticket #159 (new defect)
Opened 5 months ago
When there is no encoding attribute, REXML cannot throw an exception.
| Reported by: | hoge | Owned by: | ser |
|---|---|---|---|
| Priority: | low | Milestone: | |
| Component: | DOM | Version: | 3.1.7 |
| Severity: | normal | Keywords: | |
| Cc: | Ruby version: | 1.9.x | |
| Operating system: | Windows |
Description
If REXML read a XML file in UTF-8 with some multi-byte characters in a tag which did not have encoding attribute: encoding="UTF-8", it does not throw an exception, and waits in the readline. But, in REXML 3.1.6 with ruby 1.8.7 we can processed the file.
LOGS:(ctrl+c)
/usr/local/pkg/ruby-1.9.0-2/lib/ruby/1.9.0/rexml/source.rb:246:in `readline': Interrupt
from /usr/local/pkg/ruby-1.9.0-2/lib/ruby/1.9.0/rexml/source.rb:246:in `
current_line'
from /usr/local/pkg/ruby-1.9.0-2/lib/ruby/1.9.0/rexml/parseexception.rb:
44:in `line'
from /usr/local/pkg/ruby-1.9.0-2/lib/ruby/1.9.0/rexml/parseexception.rb:
28:in `to_s'
from /usr/local/pkg/ruby-1.9.0-2/lib/ruby/1.9.0/rexml/parsers/treeparser
.rb:95:in `message'
from /usr/local/pkg/ruby-1.9.0-2/lib/ruby/1.9.0/rexml/parsers/treeparser
.rb:95:in `rescue in parse'
from /usr/local/pkg/ruby-1.9.0-2/lib/ruby/1.9.0/rexml/parsers/treeparser
.rb:20:in `parse'
from /usr/local/pkg/ruby-1.9.0-2/lib/ruby/1.9.0/rexml/document.rb:205:in
`build'
from /usr/local/pkg/ruby-1.9.0-2/lib/ruby/1.9.0/rexml/document.rb:42:in
`initialize'
from -e:1:in `new' from -e:1:in `<main>'
XML file: <?xml version="1.0"?> <rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns="http://www.owl-ontologies.com/unnamed.owl#"
xml:base="http://www.owl-ontologies.com/unnamed.owl"> <owl:Ontology rdf:about="" /> <owl:Class rdf:ID="警察官">
<rdfs:subClassOf>
<owl:Class rdf:ID="警察署"/>
</rdfs:subClassOf>
</owl:Class>
</rdf:RDF>
Code: #!/bin/ruby # -*- encoding: utf-8 -*-
require "rexml/document"; f=open("hoge.xml","r"); owl = rexml::Document.new(f);'
