Building XML with Nokogiri

Hi,

I’m trying to build XML using Nokogiri::XML::Builder, in the following
way:

builder = Nokogiri::XML::Builder.new do |xml|
xml.rpc {
xml.get-chassis-inventory {

}
}
end
puts builder.to_xml

But, the API seems to be having a problem with ‘-’ in the
‘get-chassis-inventory’ tag. Any idea how to overcome this?

On 10/03/2012 01:21 PM, ankit j. wrote:

}
end
puts builder.to_xml

But, the API seems to be having a problem with ‘-’ in the
‘get-chassis-inventory’ tag. Any idea how to overcome this?

The hyphen is being interpreted by Ruby as a minus operator. You can
work around this by using send:

xml.send(:“get-chassis-inventory”) {
}

Lars H. wrote in post #1078521:

xml.send(:“get-chassis-inventory”) {
}

Thank You!