I have a problem that sounds basic, but I haven't found a solution anywhere. I'm using the Ruby version of XmlSimple, specifically the xml_out function.
The Problem
I'm having trouble outputting an element which would have one attribute node and a text node. Here's what I want:
<lane id='1'>unchannelized</lane>
Here's what I currently get:
<lane id='1'>
<content>unchannelized</content>
</lane>
I've tried to use the "ContentKey" => 'content' option to xml_out (in addition to the "AttrPrefix" => true), but that yielded the same result. I've tried to change the ContentKey as well, same difference.
Relevant Code
The attribute & text node getting added to an array:
laneConfigArr << {"@id" => laneNo, "content" => netsimLaneChannelizationCode(matchArr[matchIndex])}
The actual hash being generated:
unhappyHash << {
#more stuff here,
"LaneConfig" => {"lane" => laneConfigArr},
#more stuff here
}
The xml_out call [EDITED]:
result["NetsimLinks"] = {"NetsimLink" => unhappyHash}
doc = XmlSimple.xml_out(result, {"AttrPrefix" => true, "RootName" => "CORSIMNetwork", "ContentKey" => "content"})
Environment Details
- OS: Windows 7
- Ruby: 1.9.3-p125
- XmlSimple: 1.0.13
Looked everywhere, no-one seems to have had this problem. Perhaps I'm missing something, or maybe this cannot/shouldn't be done?
I'd highly appreciate any help with this.