Open jairojunior opened 9 years ago
It's been a while but grepping through the code, we seem to invoking "camelize" on attribute, element, simple type, and complex type names and setting that to the ClassBuilder.klass_name, which gets passed onto Object.const_set
https://github.com/movitto/RXSD/blob/master/lib/rxsd/xsd/element.rb#L139 https://github.com/movitto/RXSD/blob/master/lib/rxsd/builders/ruby_class.rb#L39
String#camelize defined in active support will convert "foo-bar" into "Foo-bar" which is an invalid const name, hence the issue.
Perhaps swapping dashes (-) with underscores (_) before invoking camlize is invoked may work. Don't currently have time for this, but pr's / other thoughts are more than welcome.
Thank you. I will work on a PR as soon I can, just wanted a hint before dig into the code.
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?