XML的声明
通过createProcessingInstruction()
代码如下:
pDoc->insertBefore((MSXML2::IXMLDOMNode*)pDoc->createProcessingInstruction("xml","version=\"1.0\"encoding=\"UTF-8"),
_variant_t((LPDISPATCH)xmlRoot.GetInterfacePtr()));
pDoc->save("d:\\he.xml");
然后打开he.xml,可以看到是有<?xml version="1.0" encoding="UTF-8" ?>
但是如果我是想不通过pDoc->save("d:\\he.xml"); (想节约处理时间)
而是直接通过CString strTT;
strTT.Empty();
strTT.Format("%s", (LPCSTR)pDoc->xml);
这样打印出来的strTT是<?xml version="1.0" ?>
而encoding="UTF-8"这一行却不见了??
这个应该怎么处理,?? 难道只能是自己通过手动添加<?xml version="1.0" encoding="UTF-8" ?>这一行吗?