xml-smart 0.3.20 → 0.3.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c4e2cde5eb9230fc42d7feb05a3958759fc39ddd
4
- data.tar.gz: 316786959d770dd677df634fca110676390f219d
3
+ metadata.gz: 40c589008681cdbad9093b1c87f76c021844e754
4
+ data.tar.gz: '00709426bbf58d6bf3443588ea0d4b2494160367'
5
5
  SHA512:
6
- metadata.gz: 89a4afca96b65573dc5ce6f3e642708da70e18af074d337433f0aa653e9867a445ce012eb2512b9db16cce0b6f157eba7a6bcc69a853bee69247b25dc8dc63f0
7
- data.tar.gz: ad10302a2c733bbf981750bb31b09f9ad8cd18345bed63e646042f7bd88703fdcec62328df2e47b279c3efc24bea779426d0ebfbb82f6b935136d3c9ae286aec
6
+ metadata.gz: fca7278e5139558178a7831c9017b300ae0a93d188420630b4d684545709acb29669b02e970435cf3e970f5aad1a65568b76d5b71501300148a346c6eba9be99
7
+ data.tar.gz: 7db350cd7a2b1cae4dfc17d0e0fae606cd7ebaa54cbc273fbcd483e2b7330145f12c210469fbc8e90b831776d4bb26b90b0d3a823fb7d6322b8d32084a185b06
data/example/EXAMPLE.xml CHANGED
@@ -1,18 +1,10 @@
1
- <?xml version="1.0" encoding="ISO-8859-1"?>
2
- <test xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" attr1="a" attr2="b">
3
- <names>
4
- <name team="0">Sun Apr 03 14:53:20 CEST 2005</name>
5
- <name team="1">J�rgen</name>
6
- <name team="1">Michel</name>
7
- <name team="1">Raphi</name>
8
- <name xmlns:doc="arrra" soap:team="2">Kathrin <b>Fiedler</b> MBA</name>
9
- <name team="5">egon</name>
10
- </names>
11
- <colors>
12
- <blue taint="true">Yeah</blue>
13
- <red taint="true"/>
14
- <green taint="true"/>
15
- </colors>
16
- <hallo>Hallo1</hallo>
17
- <soap:hallo>Hallo2</soap:hallo>
18
- </test>
1
+ <Customers>
2
+ <Customer ID="1">
3
+ Queen Falafel
4
+ <Address>Stollgasse</Address>
5
+ </Customer>
6
+ <Customer ID="2">
7
+ Queen Falafel
8
+ <Address>Wagramerstrasse</Address>
9
+ </Customer>
10
+ </Customers>
@@ -21,11 +21,12 @@ def prnTree(node,depth,mixed)
21
21
  node.children.each { |n|
22
22
  case n
23
23
  when XML::Smart::Dom::Element; prnTree(n,depth+2,node.mixed? | mixed)
24
- when XML::Smart::Dom::Text; print rememberPath(n.path,n.text)
25
- end
24
+ when XML::Smart::Dom::Text;
25
+ print rememberPath(n.path,n.text)
26
+ end
26
27
  }
27
28
  print " " * depth if node.element_only? && !mixed
28
- print "</" + rememberPath(node.path,node.qname.to_s) + ">"
29
+ print "</" + rememberPath(node.path,node.qname.to_s) + ">"
29
30
  print "\n" unless mixed
30
31
  end
31
32
 
@@ -43,7 +44,7 @@ begin
43
44
  @remember = doc.find(xpath).collect { |n| n.path }
44
45
  else
45
46
  message = tmp
46
- end
47
+ end
47
48
  rescue
48
49
  puts "Invalid XPath!"
49
50
  end
data/lib/xml/smart.rb CHANGED
@@ -36,7 +36,9 @@ module Nokogiri
36
36
  end
37
37
 
38
38
  def xpath_fast(path)
39
- ctx = XPathContext.new(self)
39
+ @ctx = XPathContext.new(self) unless defined? @ctx
40
+ ctx = @ctx
41
+ #ctx = XPathContext.new(self)
40
42
  ctx.register_namespaces(self.document.custom_namespace_prefixes.merge(self.document.user_custom_namespace_prefixes))
41
43
  path = path.gsub(/xmlns:/, ' :') unless Nokogiri.uses_libxml?
42
44
  ctx.evaluate(path)
@@ -86,7 +88,9 @@ module Nokogiri
86
88
  # return xpath(path,self.document.custom_namespace_prefixes.merge(self.document.user_custom_namespace_prefixes))
87
89
  return NodeSet.new(document) unless document
88
90
 
89
- ctx = XPathContext.new(self)
91
+ @ctx = XPathContext.new(self) unless defined? @ctx
92
+ ctx = @ctx
93
+ #ctx = XPathContext.new(self)
90
94
  ctx.register_namespaces(self.document.custom_namespace_prefixes.merge(self.document.user_custom_namespace_prefixes))
91
95
  path = path.gsub(/xmlns:/, ' :') unless Nokogiri.uses_libxml?
92
96
  ctx.evaluate(path)
data/test/EXAMPLE.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <test xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xml:lang="de">
2
2
  <names>
3
- <name team="0" a="3">2016-08-09 15:37:16 +0200</name>
3
+ <name team="0" a="3">2017-12-01 11:51:05 +0100</name>
4
4
  <name team="1">Jürgen</name>
5
5
  <name team="1">Michel</name>
6
6
  <name team="1">Raphi</name>
data/test/tc_relaxng.rb CHANGED
@@ -20,9 +20,9 @@ class TestRelaxng < Minitest::Test
20
20
  h.qname.name = 'test'
21
21
  end
22
22
  assert(!doc.validate_against(xsd))
23
-
23
+
24
24
  doc.validate_against(xsd) do |err|
25
- assert("#{err.file} line #{err.line}: #{err.to_s}" =~ /HELLO.xml line 4: Did not expect element test there/)
25
+ assert("#{err.file} line #{err.line}: #{err.to_s}" =~ /HELLO.xml .* Did not expect element test there/)
26
26
  end
27
- end
28
- end
27
+ end
28
+ end
data/test/tc_xmlschema.rb CHANGED
@@ -20,9 +20,9 @@ class TestXmlSchema < Minitest::Test
20
20
  h.qname.name = 'test'
21
21
  end
22
22
  assert(!doc.validate_against(xsd))
23
-
23
+
24
24
  doc.validate_against(xsd) do |err|
25
- assert("#{err.file} line #{err.line}: #{err.to_s}" =~ /HELLO.xml line 4: Did not expect element test there/)
25
+ assert("#{err.file} line #{err.line}: #{err.to_s}" =~ /HELLO.xml .* Did not expect element test there/)
26
26
  end
27
- end
28
- end
27
+ end
28
+ end
data/xml-smart.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "xml-smart"
3
- s.version = "0.3.20"
3
+ s.version = "0.3.21"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "An xml library that doesn't suck - since 2004."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xml-smart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.20
4
+ version: 0.3.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-21 00:00:00.000000000 Z
11
+ date: 2017-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri