movitto / rxsd Goto Github PK
View Code? Open in Web Editor NEWXSD / Ruby Translator
Home Page: http://projects.morsi.org/RXSD
License: GNU Lesser General Public License v3.0
XSD / Ruby Translator
Home Page: http://projects.morsi.org/RXSD
License: GNU Lesser General Public License v3.0
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 method
new' 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:in
each'
from /home/action/.gem/ruby/2.1.1/gems/rxsd-0.5.2/lib/rxsd/translator.rb:114:in to' from test.rb:22:in
sayHi'
from test.rb:30:in `
Here's a fix for both scripts:
current_dir = File.dirname(File.expand_path(__FILE__))
lib_path = File.join(current_dir, '..', 'lib')
$LOAD_PATH.unshift lib_path
require 'rxsd'
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 :-)
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.
It is crashing the libxml parser. I think it should default to file.
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>'
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?
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:in
const_set': wrong constant name Buffer-cache (NameError)`
Does anyone have any thoughts regarding this issue?
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.
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:in
to_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:in
to_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:in
to_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:in
each'
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:in
to_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:in
to_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:in
to_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:in
each'
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:in
to_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:in
to_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:in
each'
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:in
to_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:in
to_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:in
each'
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:in
to_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:in
to_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:in
to_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:in
to'
When parsing an element such as
<xsd:element ref="Common" minOccurs="0"/>
the node.ref
seems to return nil and not "Common" as I would expect it do.
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.
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.
Does support for import need to be added? Or am I missing it somewhere?
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>'
The : issue is still present in the current gem.
Note: the String#camelize method is no longer available. Try something like this:
"two_words".split(/_/).map{ |word| word.capitalize }.join('')
:)
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.