• 7289阅读
  • 3回复

qt如何建立XML声明? [复制链接]

上一主题 下一主题
离线zhuhehz
 

只看楼主 倒序阅读 楼主  发表于: 2010-08-12
— 本帖被 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声明啊?

离线zhuhehz

只看该作者 1楼 发表于: 2010-08-13
没人帮我吗?
离线yfx2003

只看该作者 2楼 发表于: 2010-08-13
帮顶
www.qtcn.org/gpq4/
ajaxref.okajax.com/
离线zhuhehz

只看该作者 3楼 发表于: 2010-08-13
回 2楼(yfx2003) 的帖子
总版主都帮顶了!荣幸!
快速回复
限100 字节
 
上一个 下一个