diff options
author | Alan Conway <aconway@apache.org> | 2007-08-09 17:26:59 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-08-09 17:26:59 +0000 |
commit | eacba97aedd3765cf904d036b875655ef7eb346b (patch) | |
tree | d1ed2c061ae96be938ddd6a5efd3dbe37ea7d8af /cpp/rubygen | |
parent | d2015d708bdb0c660cddd6969996c23daa6a5c49 (diff) | |
download | qpid-python-eacba97aedd3765cf904d036b875655ef7eb346b.tar.gz |
* rubygen/amqpgen.rb: workaround XML namespace problem with ruby 1.8.6.
* src/Makefile.am: fixed so error in rubygen causes build to fail.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@564286 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/rubygen')
-rwxr-xr-x | cpp/rubygen/amqpgen.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/cpp/rubygen/amqpgen.rb b/cpp/rubygen/amqpgen.rb index 49f8c0061e..edfbce2576 100755 --- a/cpp/rubygen/amqpgen.rb +++ b/cpp/rubygen/amqpgen.rb @@ -115,22 +115,35 @@ class AmqpClass < AmqpElement # chassis should be "client" or "server" def amqp_methods_on(chassis) @cache_amqp_methods_on ||= { } - @cache_amqp_methods_on[chassis] ||= elements.collect("method/chassis[@name='#{chassis}']/..") { |m| + + els = elements.collect("method/chassis[@name='#{chassis}']/..") { |m| AmqpMethod.new(m,self) }.sort_by_name - end + @cache_amqp_methods_on[chassis] ||= els +end end # AMQP root element. class AmqpRoot < AmqpElement + # FIXME aconway - something namespace-related in ruby 1.8.6 + # breaks all the xpath expressions with [@attr] tests. + # Not clear if this is a ruby bug or error in my xpath, + # current workaround is to simply delete the namespace node. + def newDoc(xmlFile) + root=Document.new(File.new(xmlFile)).root + root.delete_namespace + throw "Internal error, FIXME comment in aqmpgen.rb." unless (root.namespaces.empty?) + root + end + # Initialize with output directory and spec files from ARGV. def initialize(*specs) specs.size or raise "No XML spec files." specs.each { |f| File.exists?(f) or raise "Invalid XML file: #{f}"} - super Document.new(File.new(specs.shift)).root, nil + super newDoc(specs.shift), nil specs.each { |s| # Merge in additional specs - root=Document.new(File.new(s)).root + root=newDoc s merge(self,root) } end |