Skip to content

Commit

Permalink
Added new property "parser.user_libxml" so you can not use LibXML-Rub…
Browse files Browse the repository at this point in the history
…y based parser. Some WSDLs have problems with that parser if they use namespaces in attributes. Example is wsdl:arrayType as an attribute.
  • Loading branch information
swalterd committed Dec 9, 2009
1 parent 4c2fc11 commit db4518a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions lib/xsd/xmlparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


require 'xsd/xmlparser/parser'
require 'soap/property'


module XSD
Expand Down Expand Up @@ -50,19 +51,23 @@ def filter_ns(ns, attrs)
end


PARSER_LIBS = [
'libxmlparser',
'xmlparser',
'xmlscanner',
'rexmlparser'
]
# Get library prefs
opt = ::SOAP::Property.loadproperty('soap/property')
use_libxml = (opt and opt['parser'] and opt['parser']['use_libxml'] and opt['parser']['use_libxml'] == 'false') ? false : true
# Try to load XML processor.
loaded = false
[
'xsd/xmlparser/libxmlparser',
'xsd/xmlparser/xmlparser',
'xsd/xmlparser/xmlscanner',
'xsd/xmlparser/rexmlparser'
].each do |lib|
PARSER_LIBS.each do |name|
begin
require lib
lib = "xsd/xmlparser/#{name}"
require lib unless !use_libxml && name == 'libxmlparser'
# XXX: for a workaround of rubygems' require inconsistency
# XXX: MUST BE REMOVED IN THE FUTURE
name = lib.sub(/^.*\//, '')
raise LoadError unless XSD::XMLParser.constants.find { |c|
c.to_s.downcase == name.downcase
}
Expand All @@ -74,3 +79,4 @@ def filter_ns(ns, attrs)
unless loaded
raise RuntimeError.new("XML processor module not found.")
end

0 comments on commit db4518a

Please sign in to comment.