Entity Replacement

hi.. can some one please explain this to me? im not clear what its
actually means.... thx for helping~~~

doc = Document.new('<!DOCTYPE
        foo [ <!ENTITY ent "replace"> ]><a>replace
        &ent;</a>',{:raw=>:all})
        doc.root.text #-> "replace &ent;" doc.to_s # Generates: #
        <!DOCTYPE foo [ # <!ENTITY ent "replace"> #
        ]><a>replace &ent;</a>

and shud i place it in the xml file or ...other places?

cheers