Rails+Builder.Generate XML output without entities

Viewed 2391

How to make Builder to not encode 'śćż' and other such characters. What I want is 'całość' to be literally printed in XML document. Example:

xml.instruct! :xml, :version => '1.0', :encoding => 'utf-8'
xml.Trader( :'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
            :'xmlns:xsd' => "http://www.w3.org/2001/XMLSchema") do
  xml.Informacje do
    xml.RodzajPaczki 'całość'
    xml.Program 'mine'
    xml.WersjaProgramu '1.0'
  end
end

Output:

<?xml version="1.0" encoding="utf-8"?> 
<Trader xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
 <Informacje>  
  <RodzajPaczki>ca&#322;o&#347;&#263;</RodzajPaczki> 
    <Program>mine</Program> 
    <WersjaProgramu>1.0</WersjaProgramu> 
  </Informacje>
</Trader> 

ca&#322;o&#347;&#263; should be całość. I saw pseudo solution like xml.RodzajPaczki {|t| t << 'całość' } but it does not work correctly. It outdent 'całość' to left side of a document.

4 Answers
Related