##// END OF EJS Templates
Removes the XML declaration that breaks the parser with JRuby....
Jean-Philippe Lang -
r9352:cb16661d365c
parent child
Show More
@@ -267,6 +267,13 module Redmine
267 nil
267 nil
268 end
268 end
269 end
269 end
270
271 def parse_xml(xml)
272 if RUBY_PLATFORM == 'java'
273 xml = xml.sub(%r{<\?xml[^>]*\?>}, '')
274 end
275 ActiveSupport::XmlMini.parse(xml)
276 end
270 end
277 end
271
278
272 class Entries < Array
279 class Entries < Array
@@ -135,7 +135,7 module Redmine
135 output.force_encoding('UTF-8')
135 output.force_encoding('UTF-8')
136 end
136 end
137 begin
137 begin
138 @summary = ActiveSupport::XmlMini.parse(output)['rhsummary']
138 @summary = parse_xml(output)['rhsummary']
139 rescue
139 rescue
140 end
140 end
141 end
141 end
@@ -151,7 +151,7 module Redmine
151 output.force_encoding('UTF-8')
151 output.force_encoding('UTF-8')
152 end
152 end
153 begin
153 begin
154 ActiveSupport::XmlMini.parse(output)['rhmanifest']['repository']['manifest']
154 parse_xml(output)['rhmanifest']['repository']['manifest']
155 rescue
155 rescue
156 end
156 end
157 end
157 end
@@ -199,7 +199,7 module Redmine
199 end
199 end
200 begin
200 begin
201 # Mercurial < 1.5 does not support footer template for '</log>'
201 # Mercurial < 1.5 does not support footer template for '</log>'
202 ActiveSupport::XmlMini.parse("#{output}</log>")['log']
202 parse_xml("#{output}</log>")['log']
203 rescue
203 rescue
204 end
204 end
205 end
205 end
@@ -71,7 +71,7 module Redmine
71 output.force_encoding('UTF-8')
71 output.force_encoding('UTF-8')
72 end
72 end
73 begin
73 begin
74 doc = ActiveSupport::XmlMini.parse(output)
74 doc = parse_xml(output)
75 # root_url = doc.elements["info/entry/repository/root"].text
75 # root_url = doc.elements["info/entry/repository/root"].text
76 info = Info.new({:root_url => doc['info']['entry']['repository']['root']['__content__'],
76 info = Info.new({:root_url => doc['info']['entry']['repository']['root']['__content__'],
77 :lastrev => Revision.new({
77 :lastrev => Revision.new({
@@ -103,7 +103,7 module Redmine
103 output.force_encoding('UTF-8')
103 output.force_encoding('UTF-8')
104 end
104 end
105 begin
105 begin
106 doc = ActiveSupport::XmlMini.parse(output)
106 doc = parse_xml(output)
107 each_xml_element(doc['lists']['list'], 'entry') do |entry|
107 each_xml_element(doc['lists']['list'], 'entry') do |entry|
108 commit = entry['commit']
108 commit = entry['commit']
109 commit_date = commit['date']
109 commit_date = commit['date']
@@ -146,7 +146,7 module Redmine
146 output.force_encoding('UTF-8')
146 output.force_encoding('UTF-8')
147 end
147 end
148 begin
148 begin
149 doc = ActiveSupport::XmlMini.parse(output)
149 doc = parse_xml(output)
150 each_xml_element(doc['properties']['target'], 'property') do |property|
150 each_xml_element(doc['properties']['target'], 'property') do |property|
151 properties[ property['name'] ] = property['__content__'].to_s
151 properties[ property['name'] ] = property['__content__'].to_s
152 end
152 end
@@ -173,7 +173,7 module Redmine
173 output.force_encoding('UTF-8')
173 output.force_encoding('UTF-8')
174 end
174 end
175 begin
175 begin
176 doc = ActiveSupport::XmlMini.parse(output)
176 doc = parse_xml(output)
177 each_xml_element(doc['log'], 'logentry') do |logentry|
177 each_xml_element(doc['log'], 'logentry') do |logentry|
178 paths = []
178 paths = []
179 each_xml_element(logentry['paths'], 'path') do |path|
179 each_xml_element(logentry['paths'], 'path') do |path|
General Comments 0
You need to be logged in to leave comments. Login now