Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added new property "parser.user_libxml" so you can not use LibXML-Rub…

…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...
commit db4518a635b9101627e3c9b23a520c7a49be3359 1 parent 4c2fc11
Scott Diedrick swalterd authored
Showing with 14 additions and 8 deletions.
  1. +14 −8 lib/xsd/xmlparser.rb
22 lib/xsd/xmlparser.rb
View
@@ -7,6 +7,7 @@
require 'xsd/xmlparser/parser'
+require 'soap/property'
module XSD
@@ -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
}
@@ -74,3 +79,4 @@ def filter_ns(ns, attrs)
unless loaded
raise RuntimeError.new("XML processor module not found.")
end
+
Please sign in to comment.
Something went wrong with that request. Please try again.