我使用  TXMLDocmment 控件生成xml文件,但是汉字是乱码,应该是编码的问题,可是设置encodeing属性设置时总是提示错误。请问怎么设置。

解决方案 »

  1.   

    XMLDocument
    提示:Project Project1.exe raised exception class EAccessViolation with message 'Access violation at address 004641D6 in module 'Project1.exe'. Read of address 00000000'. Process stopped. Use Step or Run to continue.
    读写的时候,都会出错。
      

  2.   

    1.先定义
    resourcestring
      XMLTag          = 'xml';
      XMLPrologAttrs  = 'version="1.0" encoding="GBK"';
    2.在“XmlDoc  := CreateOleObject('Microsoft.XMLDOM') as IXMLDomDocument;”之后添加:
      XmlDoc.AppendChild(XmlDoc.CreateProcessingInstruction(XMLTag, XMLPrologAttrs));
    3.我在我的程序中又做了一点的修改,两者都调试通过了。
      把“XmlDoc  := CreateOleObject('Microsoft.XMLDOM') as IXMLDomDocument;”
      改成了:“XmlDoc  := CoDOMDocument.Create;”
    最后希望我这份帖子能帮助更多的人!
      

  3.   

    http://community.csdn.net/Expert/topic/3591/3591336.xml?temp=8.756655E-02