sshaw / jaxb2ruby Goto Github PK
View Code? Open in Web Editor NEWGenerate pure Ruby objects from an XML schema (XSD) using JAXB and JRuby. Use your favorite XML to object mapper or a custom ERB template.
Generate pure Ruby objects from an XML schema (XSD) using JAXB and JRuby. Use your favorite XML to object mapper or a custom ERB template.
@sshaw I wasn't sure how to get in contact with you, but this gem worked brilliantly (inside of a Docker container)! Thanks for making it π
This looks to be the only problem:
JAXB2Ruby::Template::a class created by the ruby template#test_0003_has singular read/write accessors for attributes:
ArgumentError: wrong number of arguments (1 for 0)
/Users/sshaw/code/ruby/jaxb2ruby/jaxb2ruby/lib/jaxb2ruby/converter.rb:75:in `find_namespace'
/Users/sshaw/code/ruby/jaxb2ruby/jaxb2ruby/lib/jaxb2ruby/converter.rb:93:in `translate_type'
/Users/sshaw/code/ruby/jaxb2ruby/jaxb2ruby/lib/jaxb2ruby/converter.rb:135:in `extract_class'
/Users/sshaw/code/ruby/jaxb2ruby/jaxb2ruby/lib/jaxb2ruby/converter.rb:233:in `block in extract_classes'
org/jruby/RubyArray.java:1733:in `each'
/Users/sshaw/code/ruby/jaxb2ruby/jaxb2ruby/lib/jaxb2ruby/converter.rb:230:in `extract_classes'
/Users/sshaw/code/ruby/jaxb2ruby/jaxb2ruby/lib/jaxb2ruby/converter.rb:42:in `create_ruby_classes'
/Users/sshaw/code/ruby/jaxb2ruby/jaxb2ruby/lib/jaxb2ruby/converter.rb:29:in `convert'
/Users/sshaw/code/ruby/jaxb2ruby/jaxb2ruby/lib/jaxb2ruby/converter.rb:14:in `convert'
/Users/sshaw/code/ruby/jaxb2ruby/spec/spec_helper.rb:10:in `convert'
/Users/sshaw/code/ruby/jaxb2ruby/spec/template_spec.rb:68:in `block in (root)'
org/jruby/RubyBasicObject.java:1687:in `instance_eval'
From PR #3.
Thank you for releasing jaxb2ruby. I am trying to convert a schema that I donβt control into Ruby classes. However, I get the recommendation:
β’ [ERROR] Complex type and its child element share the same name "ScenarioType". Use a class customization to resolve this conflict. line 2265 of file:/C:/jaxb/BuildingSync.xsd
I see that I can use the βc option to specify a YAML file, but Iβm not really sure what to put in the YAML file. I have attached the full XSD for reference and have also made an excerpt below that illustrates my specific problem. I think a small sample YAML file will allow me to find my way forward on my own.
--- cut out extra ---
<xs:complexType name="ScenarioType">
xs:sequence
<xs:element name="ScenarioName" type="xs:string" minOccurs="0">
xs:annotation
xs:documentationName of the scenario for which energy use data is included. This may include benchmarks, baselines, and improved cases. For retrofits, each package represents a different scenario.</xs:documentation>
</xs:annotation>
</xs:element>
--- cut out extra ---
<xs:element name="ScenarioType" minOccurs="0">
xs:annotation
xs:documentationType of scenario for which energy use is presented.</xs:documentation>
</xs:annotation>
xs:complexType
xs:choice
--- cut out extra ---
By the way , I tried to send this request to your email sshaw AT gmail.com and GMail rejected it. Yes, I made the obvious corrections.
From which repository can I install your gem? It isn't in rubygems.org.
Error appears while running generator with schema files taken from OpenTravel site:
(this link requires accepting license agreement and some form filling to access)
$ unzip 2007A_10_Publication.zip
$ jaxb2ruby -t roxml _OTA2007A_XML/OTA_VehAvailRateRQ.xsd
outputting classes to ruby
generating: org/opentravel/ota/v2003/v05/acceptable_payment_cards_info_type/acceptable_payment_cards/acceptable_payment_card.rb
generating: org/opentravel/ota/v2003/v05/acceptable_payment_cards_info_type/acceptable_payment_cards.rb
generating: org/opentravel/ota/v2003/v05/acceptable_payment_cards_info_type.rb
generating: org/opentravel/ota/v2003/v05/accepted_payments_type.rb
generating: org/opentravel/ota/v2003/v05/address_info_type.rb
generating: org/opentravel/ota/v2003/v05/address_pref_type.rb
generating: org/opentravel/ota/v2003/v05/address_type/bldg_room.rb
generating: org/opentravel/ota/v2003/v05/address_type/street_nmbr.rb
generating: org/opentravel/ota/v2003/v05/address_type.rb
generating: org/opentravel/ota/v2003/v05/bank_acct_type.rb
generating: org/opentravel/ota/v2003/v05/blackout_date_type.rb
generating: org/opentravel/ota/v2003/v05/cancel_info_rq_type.rb
generating: org/opentravel/ota/v2003/v05/cancel_info_rs_type/cancel_rules.rb
generating: org/opentravel/ota/v2003/v05/cancel_info_rs_type.rb
generating: org/opentravel/ota/v2003/v05/cancel_rule_type.rb
generating: org/opentravel/ota/v2003/v05/comment_type/comment.rb
generating: org/opentravel/ota/v2003/v05/comment_type.rb
generating: org/opentravel/ota/v2003/v05/commission_type/commission_payable_amount.rb
generating: org/opentravel/ota/v2003/v05/commission_type/commissionable_amount.rb
generating: org/opentravel/ota/v2003/v05/commission_type/flat_commission.rb
generating: org/opentravel/ota/v2003/v05/commission_type/prepaid_amount.rb
generating: org/opentravel/ota/v2003/v05/commission_type.rb
generating: org/opentravel/ota/v2003/v05/common_pref_type.rb
class generation failed: undefined method `split' for nil:NilClass
backtrace:
/home/dev/.rvm/gems/jruby-1.7.16@jaxb/gems/jaxb2ruby-0.0.1-java/lib/jaxb2ruby/classes.rb:171:in `requires'
org/jruby/RubyArray.java:2412:in `map'
/home/dev/.rvm/gems/jruby-1.7.16@jaxb/gems/jaxb2ruby-0.0.1-java/lib/jaxb2ruby/classes.rb:171:in `requires'
(erb):8:in `result'
org/jruby/RubyKernel.java:1101:in `eval'
/home/dev/.rvm/rubies/jruby-1.7.16/lib/ruby/1.9/erb.rb:838:in `result'
/home/dev/.rvm/gems/jruby-1.7.16@jaxb/gems/jaxb2ruby-0.0.1-java/lib/jaxb2ruby/template.rb:30:in `build'
/home/dev/.rvm/gems/jruby-1.7.16@jaxb/gems/jaxb2ruby-0.0.1-java/bin/jaxb2ruby:81:in `(root)'
org/jruby/RubyIO.java:1181:in `open'
/home/dev/.rvm/gems/jruby-1.7.16@jaxb/gems/jaxb2ruby-0.0.1-java/bin/jaxb2ruby:81:in `(root)'
org/jruby/RubyArray.java:1613:in `each'
/home/dev/.rvm/gems/jruby-1.7.16@jaxb/gems/jaxb2ruby-0.0.1-java/bin/jaxb2ruby:78:in `(root)'
org/jruby/RubyKernel.java:1081:in `load'
/home/dev/.rvm/gems/jruby-1.7.16@jaxb/bin/jaxb2ruby:1:in `(root)'
org/jruby/RubyKernel.java:1101:in `eval'
/home/dev/.rvm/gems/jruby-1.7.16@jaxb/bin/jruby_executable_hooks:15:in `(root)'
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.