xml-smart 0.4.3 → 0.5.0

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
  SHA256:
3
- metadata.gz: 97b3d4716521c2db8484f9bcfbfbf3e94f6860fcca2edef1525f5e6bb72e6a06
4
- data.tar.gz: 25dfd08f00306769c64fd556d9f589aa649bf2760c32f0acfe07f5dbb7df9e48
3
+ metadata.gz: 7442401013fd975d2ffb250e156372e4fc7a6e6d9fba5776c07d643e5c91f8bd
4
+ data.tar.gz: 1a98c2d2cf23fe2980f75fda07935fb92e802f0411647a8ea3e034731a8365d3
5
5
  SHA512:
6
- metadata.gz: 2764ddbf57f7b2ef45e07da667fa9a4f32fb505633a559e5ef759af9ac7c5b7482a93a367f3d8ab9b08bb82b9350211016d18a2f5fd98cdad8e5f7869424ea9b
7
- data.tar.gz: 7a0c5de212141c7e1d86864c1880d1f997aa943cb87adc72f1c8df12000234393d72fef4ef6d04b7fe3953c31716ced533aee44d19557d37c7d73612b93f6909
6
+ metadata.gz: 10c1b36e9d1f8323ed955dbb7e416a47f6501915e9d2ceb68085e83befabc131b514069f44753185711b213f3b8a791305356a46762516b3e725c8bea3c700f8
7
+ data.tar.gz: 829844fea52e292815884037cb004e609f28e447edeecb995bca58d15d271475b22bbb36e2135e16e125f38efcbbeda6c67424c6b2512549696cbed033c8a4e7
@@ -1,4 +1,4 @@
1
- == XML::Smart - A Ruby class for fast and simple XML access
1
+ ## XML::Smart - A Ruby class for fast and simple XML access
2
2
 
3
3
  Copyright (C) 2004-2012 Jürgen Mangler <juergen.mangler@univie.ac.at>
4
4
 
@@ -6,74 +6,84 @@ Ruby/XML/Smart is freely distributable according to the terms of the GNU Lesser
6
6
 
7
7
  This program is distributed without any warranty. See the file 'COPYING' for details.
8
8
 
9
- == Installation
9
+ ## Installation
10
10
 
11
11
  - Based on Nokogiri 1.5.5
12
12
  - Thus works for MRI ruby 1.8.7, 1.9.x, JRuby (basically everything that is Nokogiri ready)
13
13
  - Works on Linux, OSX, Windows
14
14
 
15
- == Features
15
+ ## Features
16
16
 
17
- === Principle of least surprise
17
+ ### Principle of least surprise
18
18
 
19
19
  - Nokogiri is messy - violence always is
20
20
  - libxml smells like old-school C-Binding ;-)
21
21
  - rex is ... strange
22
22
 
23
- === Inherits Nokogiris GREAT compatibility for platforms and Ruby interpreters
23
+ ### Inherits Nokogiris GREAT compatibility for platforms and Ruby interpreters
24
24
 
25
- === XML only
25
+ ### XML only
26
26
 
27
27
  Sorry, no css selectors, html, ... go to Nokogiri if you look for these.
28
28
 
29
- === Great and convenient namespace support, compared to everything else out there
29
+ ### Great and convenient namespace support, compared to everything else out there
30
30
 
31
31
  Use namespaces in xpaths without any additional work:
32
32
 
33
+ ```ruby
33
34
  doc = XML::Smart.string('<test xmlns:aaa="uri:aaa"><aaa:test/></test>')
34
35
  doc.find('string(aaa:test)')
35
36
  doc.close
37
+ ```
36
38
 
37
39
  Register your own shortcusts to be available in all XPaths:
38
40
 
41
+ ```ruby
39
42
  doc = XML::Smart.string('<test xmlns:aaa="uri:aaa"><aaa:test/></test>')
40
43
  doc.register_namespace :a, 'uri:aaa'
41
44
  doc.find('string(a:test)')
42
45
  doc.close
46
+ ```
43
47
 
44
- === NFS safe file locking while editing / reading from an XML file
48
+ ### NFS safe file locking while editing / reading from an XML file
45
49
 
50
+ ```ruby
46
51
  XML::Smart.modify("EXAMPLE.xml","<test><names/></test>") do |doc|
47
52
  doc.root.add "test_node"
48
53
  end
54
+ ```
49
55
 
50
- === check against relaxng and xml schema
56
+ ### check against relaxng and xml schema
51
57
 
52
58
  Libxml2, the basis for nokogiri has only partial xml-schema support, but full
53
59
  relaxng support. Thus checking against xml-schema with nokogiri may return
54
60
  positive results, although it is a lie. XML::Smart internally converts
55
61
  xml-schema to relaxng, thus allowing for seamless schema usage:
56
62
 
63
+ ```ruby
57
64
  doc = XML::Smart.string('<test xmlns:aaa="uri:aaa"><aaa:test/></test>')
58
65
  doc.validate_against(XML::Smart.open_unprotected('xmlschema.xml'))
59
66
  doc.validate_against(XML::Smart.open_unprotected('xmlschema.xml'))
60
67
  doc.find('string(a:test)')
61
68
  doc.close
69
+ ```
62
70
 
63
- === xinclude
71
+ ### xinclude
64
72
 
65
- Libxml2, the basis for nokogiri does not support https xincludes. Nokogiri may
66
- impelement this in the future (issue
67
- https://github.com/sparklemotion/nokogiri/issues/1321), but for now we do
68
- support it:
73
+ Libxml2, the basis for nokogiri does not support https xincludes. Nokogiri may impelement this in the future (issue
74
+ https://github.com/sparklemotion/nokogiri/issues/1321), but for now we do support it:
69
75
 
76
+ ```ruby
70
77
  doc.xinclude!
78
+ ```
71
79
 
72
80
  or
73
-
81
+
82
+ ```ruby
74
83
  doc.find('//someelement').first.xinclude!
84
+ ```
75
85
 
76
- == Changes since 0.2.x (see Changelog)
86
+ ## Changes since 0.2.x (see Changelog)
77
87
 
78
88
  - qname instead of name
79
89
  - #register_namespace instead of #namespaces= to register shortcuts
@@ -81,6 +91,6 @@ or
81
91
  - signals removed
82
92
  - pull parser removed
83
93
 
84
- == Documentation
94
+ ## Documentation
85
95
 
86
96
  Sorry, no inline code documentation yet. We have an extensive test suite, look for examples there for now.
data/lib/xml/smart.rb CHANGED
@@ -164,14 +164,14 @@ module XML
164
164
  begin
165
165
  if name.is_a?(String) && File.exist?(name)
166
166
  MUTEX.synchronize do
167
- io = ::Kernel::open(name,'r+')
167
+ io = ::URI::open(name,'r+')
168
168
  io.flock(File::LOCK_EX)
169
169
  end
170
170
  dom = Dom.new Nokogiri::XML::parse(io){|config| config.noblanks.noent.nsclean.strict }, name
171
171
  io.rewind
172
172
  elsif name.is_a?(String) && !File.exist?(name)
173
173
  MUTEX.synchronize do
174
- io = ::Kernel::open(name,'w')
174
+ io = ::URI::open(name,'w')
175
175
  io.flock(File::LOCK_EX)
176
176
  end
177
177
  dom = Smart::string(default,name)
@@ -217,7 +217,7 @@ module XML
217
217
  filename = nil
218
218
  io = if name.is_a?(String)
219
219
  filename = name
220
- ::Kernel::open(name)
220
+ ::URI::open(name)
221
221
  else
222
222
  filename = name.path
223
223
  name
data/lib/xml/smart_dom.rb CHANGED
@@ -49,7 +49,7 @@ module XML
49
49
  def save_as(name)
50
50
  raise Error, 'first parameter has to be a filename or filehandle' unless name.is_a?(String) || name.is_a?(IO) || name.is_a?(Tempfile)
51
51
  begin
52
- io = name.is_a?(String) ? ::Kernel::open(name,'w') : name
52
+ io = name.is_a?(String) ? ::URI::open(name,'w') : name
53
53
  rescue
54
54
  raise Error, "could not open #{name}"
55
55
  end
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">2020-06-05 23:34:48 +0200</name>
3
+ <name team="0" a="3">2021-11-03 02:24:58 +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/concurrent.xml CHANGED
@@ -1 +1,7 @@
1
- <solutions><solution matnr="9906264" name="mangler" secid="1" assessment="16"><question block="1" question="2"/><question block="2" question="4"/><question block="3" question="6"/></solution></solutions>
1
+ <solutions>
2
+ <solution matnr="9906264" name="mangler" secid="1" when="2021-11-03T02:24:55+01:00" assessment="16">
3
+ <question block="1" question="2"/>
4
+ <question block="2" question="4"/>
5
+ <question block="3" question="6"/>
6
+ </solution>
7
+ </solutions>
data/xml-smart.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "xml-smart"
3
- s.version = "0.4.3"
3
+ s.version = "0.5.0"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
- s.summary = "An xml library that doesn't suck - since 2004."
6
+ s.summary = "An xml library that doesn't suck (for me) - since 2004."
7
7
 
8
8
  s.description = "An xml library that doesn't suck (since 2004). Based on Nokogiri since 2012. For more info check out the Documentation link below."
9
9
 
10
- s.files = Dir['{lib/**/*,example/**/*}'] + %w(COPYING Rakefile xml-smart.gemspec README.rdoc AUTHORS)
10
+ s.files = Dir['{lib/**/*,example/**/*}'] + %w(COPYING Rakefile xml-smart.gemspec README.md AUTHORS)
11
11
  s.require_path = 'lib'
12
- s.extra_rdoc_files = ['README.rdoc']
12
+ s.extra_rdoc_files = ['README.md']
13
13
  s.test_files = Dir['test/tc_*.rb','test/*.xml','test/*.rng','test/*.xsd','test/smartrunner.rb','minitest/*']
14
14
  s.bindir = 'example'
15
15
  s.executables = ['xpath_visual']
16
16
 
17
17
  s.authors = ['Juergen eTM Mangler']
18
18
  s.email = 'juergen.mangler@gmail.com'
19
- s.homepage = 'http://www.wst.univie.ac.at/~mangler/xml-smart/'
19
+ s.homepage = 'https://github.com/etm/xml-smart/'
20
20
 
21
21
  s.required_ruby_version = '>=1.9.3'
22
22
 
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.4.3
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juergen eTM Mangler
8
- autorequire:
8
+ autorequire:
9
9
  bindir: example
10
10
  cert_chain: []
11
- date: 2020-06-05 00:00:00.000000000 Z
11
+ date: 2023-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -77,11 +77,11 @@ executables:
77
77
  - xpath_visual
78
78
  extensions: []
79
79
  extra_rdoc_files:
80
- - README.rdoc
80
+ - README.md
81
81
  files:
82
82
  - AUTHORS
83
83
  - COPYING
84
- - README.rdoc
84
+ - README.md
85
85
  - Rakefile
86
86
  - example/CARD.xml
87
87
  - example/EXAMPLE.xml
@@ -145,11 +145,11 @@ files:
145
145
  - test/tc_xpath_root.rb
146
146
  - test/tc_xsl.rb
147
147
  - xml-smart.gemspec
148
- homepage: http://www.wst.univie.ac.at/~mangler/xml-smart/
148
+ homepage: https://github.com/etm/xml-smart/
149
149
  licenses:
150
150
  - LGPL-3.0
151
151
  metadata: {}
152
- post_install_message:
152
+ post_install_message:
153
153
  rdoc_options: []
154
154
  require_paths:
155
155
  - lib
@@ -164,52 +164,52 @@ required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
- rubygems_version: 3.1.2
168
- signing_key:
167
+ rubygems_version: 3.4.6
168
+ signing_key:
169
169
  specification_version: 4
170
- summary: An xml library that doesn't suck - since 2004.
170
+ summary: An xml library that doesn't suck (for me) - since 2004.
171
171
  test_files:
172
- - test/tc_qname.rb
172
+ - test/tc_add.rb
173
+ - test/tc_basic.rb
174
+ - test/tc_concurrent.rb
175
+ - test/tc_copy.rb
176
+ - test/tc_create.rb
173
177
  - test/tc_delete.rb
174
- - test/tc_root.rb
175
- - test/tc_xinclude.rb
176
- - test/tc_write.rb
178
+ - test/tc_move_elements.rb
179
+ - test/tc_namespace_default.rb
180
+ - test/tc_namespace_detailed.rb
177
181
  - test/tc_namespace_find.rb
178
- - test/tc_sort.rb
179
182
  - test/tc_nested.rb
180
- - test/tc_xmlschema.rb
181
- - test/tc_xpath_attrs.rb
182
- - test/tc_namespace_default.rb
183
- - test/tc_version.rb
183
+ - test/tc_pi.rb
184
+ - test/tc_qname.rb
185
+ - test/tc_relaxng.rb
186
+ - test/tc_root.rb
184
187
  - test/tc_set_or_replace.rb
188
+ - test/tc_sort.rb
185
189
  - test/tc_string.rb
186
- - test/tc_xsl.rb
187
- - test/tc_concurrent.rb
188
- - test/tc_xpath_root.rb
189
- - test/tc_namespace_detailed.rb
190
- - test/tc_copy.rb
191
- - test/tc_basic.rb
192
- - test/tc_move_elements.rb
193
- - test/tc_create.rb
190
+ - test/tc_todoc.rb
191
+ - test/tc_version.rb
192
+ - test/tc_write.rb
193
+ - test/tc_xinclude.rb
194
+ - test/tc_xmlschema.rb
194
195
  - test/tc_xpath.rb
195
- - test/tc_relaxng.rb
196
+ - test/tc_xpath_attrs.rb
196
197
  - test/tc_xpath_functions.rb
197
- - test/tc_pi.rb
198
- - test/tc_add.rb
199
- - test/tc_todoc.rb
200
- - test/HELLO.xml
201
- - test/EXAMPLE-NS.xml
202
- - test/3.xml
203
- - test/XSL_BASE.xml
198
+ - test/tc_xpath_root.rb
199
+ - test/tc_xsl.rb
204
200
  - test/1.xml
205
- - test/EXAMPLE.str.xml
206
201
  - test/2.xml
207
- - test/EXAMPLE.xml
202
+ - test/3.xml
203
+ - test/EXAMPLE-NS.xml
208
204
  - test/EXAMPLE-NSE.xml
209
- - test/concurrent.xml
205
+ - test/EXAMPLE.str.xml
206
+ - test/EXAMPLE.tmp.xml
207
+ - test/EXAMPLE.xml
210
208
  - test/HELLO-MORE.xml
209
+ - test/HELLO.xml
210
+ - test/XSL_BASE.xml
211
211
  - test/XSL_DOCUMENT.xml
212
- - test/EXAMPLE.tmp.xml
212
+ - test/concurrent.xml
213
213
  - test/HELLO.rng
214
214
  - test/HELLO.xsd
215
215
  - test/smartrunner.rb