Giter Site home page Giter Site logo

rxsd's People

Contributors

mikegee avatar movitto avatar sqrel avatar webgago avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rxsd's Issues

undefined method `new' for nil:NilClass (NoMethodError)

Trying out RXSD for the first time using the simple example in conjunction w/Zillow API. Send me a private message for the URLs (can't publish my Zillow API key.)

  xsd_uri = "http://www.zillow.com/static/xsd/SearchResults.xsd"
  xml_uri = "http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=[GET YOUR OWN ZWS ID FROM ZILLOW]&address=2114+Bigelow+Ave&citystatezip=Seattle%2C+WA"
  schema = RXSD::Parser.parse_xsd :uri => xsd_uri

 data = RXSD::Parser.parse_xml :uri => xml_uri
 objs = data.to :ruby_objects, :schema => schema
 objs.each {  |obj|
   puts "#{obj}"
   }

/home/action/.gem/ruby/2.1.1/gems/rxsd-0.5.2/lib/rxsd/builders/ruby_object.rb:24:in build': undefined methodnew' for nil:NilClass (NoMethodError)
from /home/action/.gem/ruby/2.1.1/gems/rxsd-0.5.2/lib/rxsd/translator.rb:118:in block in to' from /home/action/.gem/ruby/2.1.1/gems/rxsd-0.5.2/lib/rxsd/translator.rb:114:ineach'
from /home/action/.gem/ruby/2.1.1/gems/rxsd-0.5.2/lib/rxsd/translator.rb:114:in to' from test.rb:22:insayHi'
from test.rb:30:in `

'

problems in the parser

Hi, i was looking your code and in the file lib/rxsd/parser.rb after the line 59 you added some ":" in the case/when.. you should remove it :-)

Trouble installing using "gem install rxsd"

I'm running into an error trying to install RXSD using gem.

My environment is Ruby 1.9.2p180 , Windows 7 64-bit.

This is what I captured from standard error:

ERROR: Error installing rxsd:
ERROR: Failed to build gem native extension.

    E:/ruby/ruby-192/bin/ruby.exe extconf.rb

missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_hash
missing: to_hash
missing: to_str
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_hash
missing: to_hash
missing: to_str
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_hash
missing: to_hash
missing: to_str
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_io
missing: to_path
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_path
missing: to_path
missing: to_path
missing: to_path
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_hash
missing: to_ary
checking for socket() in -lsocket... missing: to_int
missing: to_hash
missing: to_path
missing: to_int
no
missing: to_hash
missing: to_ary
checking for gethostbyname() in -lnsl... no
missing: to_hash
missing: to_ary
checking for atan() in -lm... yes
missing: to_hash
missing: to_ary
checking for inflate() in -lz... no
missing: to_hash
missing: to_ary
checking for inflate() in -lzlib... no
missing: to_hash
missing: to_ary
checking for inflate() in -lzlib1... no
extconf failure: need zlib
missing: to_io
missing: to_path

Gem files will remain installed in E:/ruby/ruby-192/lib/ruby/gems/1.9.1/gems/libxml-ruby-1.1.4 for inspection.
Results logged to E:/ruby/ruby-192/lib/ruby/gems/1.9.1/gems/libxml-ruby-1.1.4/ext/libxml/gem_make.out

I'm quite new to Ruby so it might be something obvious to more experienced Ruby programmers.

Thanks.

Parsing National Vulnerability XML file fails

I have the following sample program:

require 'rxsd'

xsd_uri = "http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd"
xml_uri = "http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-modified.xml"

schema = RXSD::Parser.parse_xsd :uri => xsd_uri

puts "=======Objects======="
data = RXSD::Parser.parse_xml :uri => xml_uri
objs = data.to :ruby_objects, :schema => schema
objs.each {  |obj|
    puts "#{obj}"
}

As a result I get this:

=======Objects=======
/Library/Ruby/Gems/2.0.0/gems/rxsd-0.5.2/lib/rxsd/builders/ruby_object.rb:24:in `build': undefined method `new' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/2.0.0/gems/rxsd-0.5.2/lib/rxsd/translator.rb:118:in `block in to'
    from /Library/Ruby/Gems/2.0.0/gems/rxsd-0.5.2/lib/rxsd/translator.rb:114:in `each'
    from /Library/Ruby/Gems/2.0.0/gems/rxsd-0.5.2/lib/rxsd/translator.rb:114:in `to'
    from cert-input.rb:23:in `<main>'

NoMethodError: undefined method `to_class_builder' for "xsd:anyType":String

I get the error above under Ruby 1.9.3-p551 when I try to follow the README example with the ResourceSync schema. My script:

#! /usr/bin/env ruby
require 'rxsd'
xsd_uri = 'http://www.openarchives.org/rs/0.9.1/resourcesync.xsd'
schema = RXSD::Parser.parse_xsd :uri => xsd_uri
classes = schema.to :ruby_classes

Result:

/Users/dmoles/.rvm/gems/ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/xsd/restriction.rb:110:in `to_class_builder': undefined method `to_class_builder' for "xsd:anyType":String (NoMethodError)
    from /Users/dmoles/.rvm/gems/ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/xsd/complex_content.rb:67:in `to_class_builder'
    from /Users/dmoles/.rvm/gems/ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/xsd/complex_type.rb:83:in `to_class_builder'
    from /Users/dmoles/.rvm/gems/ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/xsd/element.rb:135:in `to_class_builder'
    from /Users/dmoles/.rvm/gems/ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/xsd/schema.rb:105:in `block in to_class_builders'
    from /Users/dmoles/.rvm/gems/ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/xsd/schema.rb:104:in `each'
    from /Users/dmoles/.rvm/gems/ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/xsd/schema.rb:104:in `to_class_builders'
    from /Users/dmoles/.rvm/gems/ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/translator.rb:44:in `all_class_builders'
    from /Users/dmoles/.rvm/gems/ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/translator.rb:54:in `to'
    from ./schema.rb:9:in `<main>'

Possibly related to #6?

Schema to classes conversion fails if XML elements has an "invalid" character

If I have an XML element with a dash (-) within its name (e.g. buffer-cache), schema.to :ruby_classes fails with the following error:

ruby-1.9.3-p551/gems/rxsd-0.5.2/lib/rxsd/builders/ruby_class.rb:39:inconst_set': wrong constant name Buffer-cache (NameError)`

Does anyone have any thoughts regarding this issue?

Trouble installing under Ruby 2.2, 1.8.7

When I try to install under 2.2 or 2.2.1, I get:

ERROR:  Error installing rxsd:
    ERROR: Failed to build gem native extension.
    /Users/dmoles/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150417-38137-cometj.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/dmoles/.rvm/rubies/ruby-2.2.1/bin/$(RUBY_BASE_NAME)
extconf.rb:17:in `<main>': uninitialized constant Config (NameError)

extconf failed, exit code 1

Gem files will remain installed in /Users/dmoles/.rvm/gems/ruby-2.2.1/gems/libxml-ruby-2.4.0 for inspection.
Results logged to /Users/dmoles/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0/libxml-ruby-2.4.0/gem_make.out

Checking the gemspec (s.required_ruby_version = '>= 1.8.1'), I tried downgrading to 1.8 and got past libxml, but failed at:

ERROR:  Error installing rxsd:
    i18n requires Ruby version >= 1.9.3.

I finally was able to install under 1.9.3-p551 but then ran into an issue similar to #6, which I'll file separately.

crash on CDISC ODM 1.3.1 schema

require 'rxsd'
xsd_uri = 'http://evs.nci.nih.gov/ftp1/CDISC/schema/foundation/ODM1-3-1-foundation.xsd'
schema = RXSD::Parser.parse_xsd :uri => xsd_uri
classes = schema.to :ruby_classes

undefined method to_class_builder' for "xs:anyURI":String (NoMethodError) C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/extension.rb:88:into_class_builder'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/simple_content.rb:68:in to_class_builder' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/complex_type.rb:81:into_class_builder'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/element.rb:131:in to_class_builder' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/element.rb:127:into_class_builder'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:71:in to_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:70:ineach'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:70:in to_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/group.rb:82:into_class_builders'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/group.rb:78:in to_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/choice.rb:74:into_class_builders'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/choice.rb:73:in each' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/choice.rb:73:into_class_builders'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:79:in to_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:78:ineach'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:78:in to_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/complex_type.rb:112:into_class_builder'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/element.rb:131:in to_class_builder' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/element.rb:127:into_class_builder'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:71:in to_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:70:ineach'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:70:in to_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/complex_type.rb:112:into_class_builder'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/element.rb:131:in to_class_builder' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/element.rb:127:into_class_builder'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:71:in to_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:70:ineach'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/sequence.rb:70:in to_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/complex_type.rb:112:into_class_builder'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/element.rb:140:in to_class_builder' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/schema.rb:105:into_class_builders'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/schema.rb:104:in each' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/xsd/schema.rb:104:into_class_builders'
C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/translator.rb:44:in all_class_builders' C:/ruby/lib/ruby/gems/1.8/gems/rxsd-0.5.1/lib/rxsd/translator.rb:54:into'

Can RXSD generate schema-complaint XML?

If I parse an XSD into Ruby classes and create instances of those classes. Do those instances know how to serialize themselves into XML that is guaranteed to validate against the XSD?

I don't see an example of this use case in the readme or from a cursory scan of the implementation.

Reference to old libxml causes problems on OSX 10.11.2

Something has changed with the libxml dependency, so that when I try a bundle install under OSX 10.11.2, I get this error:

An error occurred while installing libxml-ruby (2.4.0), and Bundler cannot continue.
Make sure that `gem install libxml-ruby -v '2.4.0'` succeeds before bundling.

I think the fix is easy:

-  s.add_dependency('libxml-ruby', '~> 2.4.0')
+  s.add_dependency('libxml-ruby', '~> 2.8.0')

With this tweak I can bundle install, and tests pass.

Support import

Does support for import need to be added? Or am I missing it somewhere?

Problem with superclass method

I run the following sample program (pretty much adapted from the wiki) and use the National Vulnerability Database XML schema and sample file as an input.

This is the sample file:

require 'rxsd'

xsd_uri = "http://nvd.nist.gov/schema/nvd-cve-feed_2.0.xsd"
xml_uri = "http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-modified.xml"

schema = RXSD::Parser.parse_xsd :uri => xsd_uri

puts "=======Classes======="
classes = schema.to :ruby_classes
puts classes.collect{ |cl| !cl.nil? ?
    (cl.to_s + " < " + cl.superclass.to_s) : ""}.sort.join("\n")

This is what I'm getting:

cert-input.rb:23:in `block in <main>': undefined method `superclass' for "vuln:vulnerabilityType":String (NoMethodError)
    from cert-input.rb:23:in `collect'
    from cert-input.rb:23:in `<main>'

GEM update

The : issue is still present in the current gem.

Explosions on Ruby 1.9.

Note: the String#camelize method is no longer available. Try something like this:

"two_words".split(/_/).map{ |word| word.capitalize }.join('')

:)

Namespace Problem?

This sample code raises: undefined method 'new' for "simpletest:testMessage":String (NoMethodError). I would greatly appreciate any help.

require "rxsd"

schema = RXSD::Parser.parse_xsd raw: <<XSD
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified"
    targetNamespace="http://www.covermymeds.com/cmmtest" version="1.0"
    xmlns:simpletest="http://www.covermymeds.com/cmmtest"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">

    <xsd:attribute name="msgType" type="xsd:string"/>
    <xsd:complexType name="testMessage">
        <xsd:sequence>
            <xsd:element name="header" type="simpletest:headerType"/>
            <xsd:element name="body" type="simpletest:bodyType"/>
        </xsd:sequence>
        <xsd:attribute ref="simpletest:msgType"/>
    </xsd:complexType>
    <xsd:element name="Message" type="simpletest:testMessage"/>
    <xsd:simpleType name="headerType">
        <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
    <xsd:simpleType name="bodyType">
        <xsd:restriction base="xsd:string"/>
    </xsd:simpleType>
</xsd:schema>
XSD

doc = RXSD::Parser.parse_xml raw: <<XML
<?xml version="1.0" encoding="UTF-8"?>
<simpletest:Message xmlns:simpletest="http://www.covermymeds.com/cmmtest">
    <simpletest:header>header goes here</simpletest:header>
    <simpletest:body>body goes here</simpletest:body>
</simpletest:Message>
XML

doc.to :ruby_objects, schema: schema

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.