|
本帖最后由 a408815041 于 2016-3-4 18:26 编辑
XML 就是 数据存储语言。
看最后个单词也知道大致什么意思,, 文档,元素,结点
你实在不知道这些类的功能,,你去助手里面看啊,,写的很详细。
看不懂英文,,自己去百度翻译或者 下载个有道词典,,虽然不是100%翻译对,,大致也能猜到
比如
Detailed Description
The QDomDocument class represents an XML document.
The QDomDocument class represents the entire XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.
Since elements, text nodes, comments, processing instructions, etc., cannot exist outside the context of a document, the document class also contains the factory functions needed to create these objects. The node objects created have an ownerDocument() function which associates them with the document within whose context they were created. The DOM classes that will be used most often are QDomNode, QDomDocument, QDomElement and QDomText.
The parsed XML is represented internally by a tree of objects that can be accessed using the various QDom classes. All QDom classes only reference objects in the internal tree. The internal objects in the DOM tree will get deleted once the last QDom object referencing them or the QDomDocument itself is deleted.
Creation of elements, text nodes, etc. is done using the various factory functions provided in this class. Using the default constructors of the QDom classes will only result in empty objects that cannot be manipulated or inserted into the Document.
The QDomDocument class has several functions for creating document data, for example, createElement(), createTextNode(), createComment(), createCDATASection(), createProcessingInstruction(), createAttribute() and createEntityReference(). Some of these functions have versions that support namespaces, i.e. createElementNS() and createAttributeNS(). The createDocumentFragment() function is used to hold parts of the document; this is useful for manipulating for complex documents.
The entire content of the document is set with setContent(). This function parses the string it is passed as an XML document and creates the DOM tree that represents the document. The root element is available using documentElement(). The textual representation of the document can be obtained using toString().
Note: The DOM tree might end up reserving a lot of memory if the XML document is big. For such documents, the QXmlStreamReader or the QXmlQuery classes might be better solutions.
It is possible to insert a node from another document into the document using importNode().
You can obtain a list of all the elements that have a particular tag with elementsByTagName() or with elementsByTagNameNS(). |
|