xcop 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/xcop/document.rb +11 -0
- data/lib/xcop/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 38b6fe520c9b6d5c13c9dbb395fc5484c935311f2bfee2c83594b95023099a5a
|
|
4
|
+
data.tar.gz: 8484754dd75c22a9e5f21452a3a92e3704a9a1a9d37285eda11f0a0f9e11c83c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0208353e4449b9b6b0a67b1cdaf324f0f0f600e00251d1dd350165b759b260bb2ffa1565427b45b6247b56421c496b8a2f927b9b980b2a9367d6cb08871d0b52'
|
|
7
|
+
data.tar.gz: f132099516bc9aeea73ffddc77c29f5f3a1e3e634b516da942a267e2748df87fff9a40df74d4f1af1f342e1ce7b67a074118efb07b1684e286dc01bae47f0074
|
data/lib/xcop/document.rb
CHANGED
|
@@ -126,6 +126,16 @@ class Xcop::Document
|
|
|
126
126
|
declared - used
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
+
# Returns the absolute path of the local XSD schema declared by +xml+,
|
|
130
|
+
# or +nil+ when no schema is declared or the declared location is not a
|
|
131
|
+
# local file. The location comes from +xsi:noNamespaceSchemaLocation+
|
|
132
|
+
# or, failing that, from the second token of +xsi:schemaLocation+.
|
|
133
|
+
#
|
|
134
|
+
# A +schemaLocation+ is a URI, not a file path, so a remote schema such
|
|
135
|
+
# as +http://maven.apache.org/xsd/maven-4.0.0.xsd+ (the normal case for
|
|
136
|
+
# Maven +pom.xml+, +settings.xml+ and +site.xml+) must not be treated as
|
|
137
|
+
# a local file. Any location that carries a URL scheme is therefore
|
|
138
|
+
# skipped, leaving only truly local schemas to be validated. See #163.
|
|
129
139
|
def schema(xml)
|
|
130
140
|
root = xml.root
|
|
131
141
|
return unless root
|
|
@@ -138,6 +148,7 @@ class Xcop::Document
|
|
|
138
148
|
mapped.value.split.last
|
|
139
149
|
end
|
|
140
150
|
return unless location
|
|
151
|
+
return if location.match?(%r{\A[a-z][a-z0-9+.-]*://}i)
|
|
141
152
|
File.expand_path(location, File.dirname(@path))
|
|
142
153
|
end
|
|
143
154
|
|
data/lib/xcop/version.rb
CHANGED