Removes the XML declaration that breaks the parser with JRuby.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9534 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-04-26 17:57:49 +00:00
parent 8d73ddf73f
commit cb16661d36
3 changed files with 14 additions and 7 deletions

View File

@ -267,6 +267,13 @@ module Redmine
nil
end
end
def parse_xml(xml)
if RUBY_PLATFORM == 'java'
xml = xml.sub(%r{<\?xml[^>]*\?>}, '')
end
ActiveSupport::XmlMini.parse(xml)
end
end
class Entries < Array

View File

@ -135,7 +135,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
@summary = ActiveSupport::XmlMini.parse(output)['rhsummary']
@summary = parse_xml(output)['rhsummary']
rescue
end
end
@ -151,7 +151,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
ActiveSupport::XmlMini.parse(output)['rhmanifest']['repository']['manifest']
parse_xml(output)['rhmanifest']['repository']['manifest']
rescue
end
end
@ -199,7 +199,7 @@ module Redmine
end
begin
# Mercurial < 1.5 does not support footer template for '</log>'
ActiveSupport::XmlMini.parse("#{output}</log>")['log']
parse_xml("#{output}</log>")['log']
rescue
end
end

View File

@ -71,7 +71,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
doc = ActiveSupport::XmlMini.parse(output)
doc = parse_xml(output)
# root_url = doc.elements["info/entry/repository/root"].text
info = Info.new({:root_url => doc['info']['entry']['repository']['root']['__content__'],
:lastrev => Revision.new({
@ -103,7 +103,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
doc = ActiveSupport::XmlMini.parse(output)
doc = parse_xml(output)
each_xml_element(doc['lists']['list'], 'entry') do |entry|
commit = entry['commit']
commit_date = commit['date']
@ -146,7 +146,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
doc = ActiveSupport::XmlMini.parse(output)
doc = parse_xml(output)
each_xml_element(doc['properties']['target'], 'property') do |property|
properties[ property['name'] ] = property['__content__'].to_s
end
@ -173,7 +173,7 @@ module Redmine
output.force_encoding('UTF-8')
end
begin
doc = ActiveSupport::XmlMini.parse(output)
doc = parse_xml(output)
each_xml_element(doc['log'], 'logentry') do |logentry|
paths = []
each_xml_element(logentry['paths'], 'path') do |path|