-
UID:101957
-
- 注册时间2010-07-26
- 最后登录2017-09-15
- 在线时间0小时
-
- 发帖56
- 搜Ta的帖子
- 精华0
- 金钱560
- 威望66
- 贡献值0
- 好评度56
-
访问TA的空间加好友用道具
|
—
本帖被 XChinux 从 General Qt Programming 移动到本区(2011-01-02)
—
如下面 QDomDocument doc; QDomProcessingInstruction instruction; instruction = doc.createProcessingInstruction("xml","version=\"1.0\" encoding=\"UTF-8\""); doc.appendChild( instruction); 可以建立XML声明,一般好像都这么用!
但是在QT助手的《QDomProcessingInstruction Class Reference》中有如下一段话Detailed Description
The QDomProcessingInstruction class represents an XML processing instruction. Processing instructions are used in XML to keep processor-specific information in the text of the document. The XML declaration that appears at the top of an XML document, typically <?xml version='1.0' encoding='UTF-8'?>, is treated by QDom as a processing instruction. This is unfortunate, since the XML declaration is not a processing instruction; among other differences, it cannot be inserted into a document anywhere but on the first line. Do not use this function to create an xml declaration, since although it has the same syntax as a processing instruction, it isn't, and might not be treated by QDom as such. The content of the processing instruction is retrieved with data() and set with setData(). The processing instruction's target is retrieved with target(). For further information about the Document Object Model see Level 1 and Level 2 Core. For a more general introduction of the DOM implementation see the QDomDocument documentation. 标红的部分好像说不要用QDomProcessingInstruction创建XML声明。请教大家到底如何建立XML声明啊?
|