jxmlvalidator 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.md +0 -1
  2. data/lib/jxml/validator.rb +15 -11
  3. metadata +2 -2
data/README.md CHANGED
@@ -25,4 +25,3 @@ TODO
25
25
  - cache feature (already implemented in java, need ruby to hook into it)
26
26
  - xml parsing options
27
27
  - command line tool
28
- - make gem
@@ -7,15 +7,19 @@ module JXML
7
7
 
8
8
  JAR_FILE = File.join File.dirname(__FILE__), '..', '..', 'ext', 'xmlvalidator.jar'
9
9
 
10
- # setup rjb validator
11
- ENV['CLASSPATH'] = if ENV['CLASSPATH']
12
- "#{JAR_FILE}:#{ENV['CLASSPATH']}"
13
- else
14
- JAR_FILE
15
- end
10
+ def Validator.load_validator_class
11
+ j_URI = Rjb.import 'java.net.URL'
12
+ uri = j_URI.new "file://#{File.expand_path JAR_FILE}"
16
13
 
17
- J_File = Rjb.import 'java.io.File'
18
- J_Validator = Rjb.import 'edu.fcla.da.xml.Validator'
14
+ j_URLClassLoader = Rjb.import 'java.net.URLClassLoader'
15
+ loader = j_URLClassLoader.new [uri]
16
+
17
+ j_Class = Rjb.import 'java.lang.Class'
18
+ j_Class.forName "edu.fcla.da.xml.Validator", true, loader
19
+ end
20
+
21
+ J_File = Rjb.import 'java.io.File'
22
+ J_Validator = load_validator_class
19
23
 
20
24
  def initialize
21
25
  @jvalidator = J_Validator.new
@@ -47,12 +51,12 @@ module JXML
47
51
  def j2r ja
48
52
 
49
53
  (0...ja.size).map do |n|
50
- e = ja.elementAt n
54
+ e = ja.elementAt n
51
55
 
52
56
  {
53
- :line => e.getLineNumber,
57
+ :line => e.getLineNumber,
54
58
  :message => e.getMessage,
55
- :column => e.getColumnNumber
59
+ :column => e.getColumnNumber
56
60
  }
57
61
 
58
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jxmlvalidator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francesco Lazzarino
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-02-16 00:00:00 -05:00
12
+ date: 2010-03-22 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency