wsdl_validator 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wsdl_validator/version.rb +1 -1
- data/lib/wsdl_validator/wsdl_validator.rb +10 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48fff12b40c9b38144839f5b2f76467f8c199731
|
4
|
+
data.tar.gz: 4fdba0e3f8bdde25a218e47e8ea07b7a91ad66ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '083fc37f4fd97a7cb23ac4bb0f01390f5dd4e3e4696fded664789f6c1718aa0200d57cf1a207e098a184fcbc3091997ae01eafb592a05020eaf788e20d51034c'
|
7
|
+
data.tar.gz: 8ba071a17644cbf6f63db23bf37b9c832d4898108783d89278849a538ce27925e1367c9b0403de6e2cc4862541242f0d40d877b77c9d5f3ae90f5769b19070c5
|
@@ -1,13 +1,18 @@
|
|
1
|
+
# Helps to validate xml against schemas contained in a WSDL
|
1
2
|
class WsdlValidator
|
3
|
+
# @param [String] wsdl_url URL to where WSDL is stored
|
2
4
|
def initialize(wsdl_url)
|
3
5
|
@doc = Wasabi.document wsdl_url
|
6
|
+
@schemas = @doc.parser.schemas.collect(&:to_s).join
|
4
7
|
end
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
9
|
+
# @param [String, Nokogiri::XML::NodeSet] xml
|
10
|
+
# @return [Boolean] Whether xml is valid according to WSDL of class
|
11
|
+
def valid?(xml)
|
12
|
+
raise "Incorrect type #{xml.class}" unless [String, Nokogiri::XML::Document, Nokogiri::XML::NodeSet].include? xml.class
|
13
|
+
xml_under_test = Nokogiri::XML(xml.to_s)
|
14
|
+
xsd = Nokogiri::XML::Schema(@schemas)
|
15
|
+
validator = xsd.validate(xml_under_test)
|
11
16
|
validator.each { |error| puts error.message }
|
12
17
|
return false unless validator.empty?
|
13
18
|
true
|