• PySide 模块
  • PySide.QtXml
  • 内容表

    上一话题

    QDomDocumentFragment

    下一话题

    延伸阅读

    QDomImplementation

    概要

    函数

    静态函数

    详细描述

    PySide.QtXml.QDomImplementation class provides information about the features of the DOM implementation.

    此类描述由 DOM 实现所支持的特征。目前支持 DOM 级别 1 和 DOM 级别 2 核心 XML 子集。

    通常,使用函数 QDomDocument.implementation() to get the implementation object.

    可以创建新的文档类型采用 PySide.QtXml.QDomImplementation.createDocumentType() and a new document with PySide.QtXml.QDomImplementation.createDocument() .

    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 PySide.QtXml.QDomDocument 文档编制。

    The QDom classes have a few issues of nonconformance with the XML specifications that cannot be fixed in Qt 4 without breaking backward compatibility. The QtXmlPatterns module and the PySide.QtCore.QXmlStreamReader and PySide.QtCore.QXmlStreamWriter 类拥有更高一致性。

    class PySide.QtXml. QDomImplementation
    class PySide.QtXml. QDomImplementation ( arg__1 )
    参数: arg__1 PySide.QtXml.QDomImplementation

    构造 PySide.QtXml.QDomImplementation 对象。

    构造副本为 x .

    PySide.QtXml.QDomImplementation. InvalidDataPolicy

    此枚举指定应做什么,当工厂函数在 PySide.QtXml.QDomDocument 被调用采用无效数据。

    常量 描述
    QDomImplementation.AcceptInvalidChars The data should be stored in the DOM object anyway. In this case the resulting XML document might not be well-formed. This is the default value and QDom's behavior in Qt < 4.1.
    QDomImplementation.DropInvalidChars 应从数据中移除无效字符。
    QDomImplementation.ReturnNullNode 工厂函数应返回 null 节点。
    PySide.QtXml.QDomImplementation. createDocument ( nsURI , qName , doctype )
    参数:
    返回类型:

    PySide.QtXml.QDomDocument

    创建的 DOM (文档对象模型) 文档具有文档类型 doctype . This function also adds a root element node with the qualified name qName 和名称空间 URI nsURI .

    PySide.QtXml.QDomImplementation. createDocumentType ( qName , publicId , systemId )
    参数:
    • qName – unicode
    • publicId – unicode
    • systemId – unicode
    返回类型:

    PySide.QtXml.QDomDocumentType

    创建文档类型节点为名称 qName .

    publicId specifies the public identifier of the external subset. If you specify an empty string ( QString() ) as the publicId , this means that the document type has no public identifier.

    systemId specifies the system identifier of the external subset. If you specify an empty string as the systemId , this means that the document type has no system identifier.

    Since you cannot have a public identifier without a system identifier, the public identifier is set to an empty string if there is no system identifier.

    DOM level 2 does not support any other document type declaration features.

    The only way you can use a document type that was created this way, is in combination with the PySide.QtXml.QDomImplementation.createDocument() function to create a PySide.QtXml.QDomDocument with this document type.

    In the DOM specification, this is the only way to create a non-null document. For historical reasons, Qt also allows to create the document using the default empty constructor. The resulting document is null, but becomes non-null when a factory function, for example QDomDocument.createElement() , is called. The document also becomes non-null when setContent() is called.

    PySide.QtXml.QDomImplementation. hasFeature ( feature , version )
    参数:
    • feature – unicode
    • version – unicode
    返回类型:

    PySide.QtCore.bool

    The function returns true if QDom implements the requested version of a feature ;否则返回 false。

    目前支持的特征及其版本:

    Feature 版本
    XML 1.0
    static PySide.QtXml.QDomImplementation. invalidDataPolicy ( )
    返回类型: PySide.QtXml.QDomImplementation.InvalidDataPolicy

    Returns the invalid data policy, which specifies what should be done when a factory function in PySide.QtXml.QDomDocument is passed invalid data.

    另请参阅

    PySide.QtXml.QDomImplementation.setInvalidDataPolicy() QDomImplementation.InvalidDataPolicy

    PySide.QtXml.QDomImplementation. isNull ( )
    返回类型: PySide.QtCore.bool

    Returns false if the object was created by QDomDocument.implementation() ; otherwise returns true.

    PySide.QtXml.QDomImplementation. __ne__ ( arg__1 )
    参数: arg__1 PySide.QtXml.QDomImplementation
    返回类型: PySide.QtCore.bool

    返回 true 若 x and this DOM implementation object were created from different QDomDocuments; otherwise returns false.

    PySide.QtXml.QDomImplementation. __eq__ ( arg__1 )
    参数: arg__1 PySide.QtXml.QDomImplementation
    返回类型: PySide.QtCore.bool

    返回 true 若 x and this DOM implementation object were created from the same PySide.QtXml.QDomDocument ;否则返回 false。

    static PySide.QtXml.QDomImplementation. setInvalidDataPolicy ( policy )
    参数: policy PySide.QtXml.QDomImplementation.InvalidDataPolicy

    Sets the invalid data policy, which specifies what should be done when a factory function in PySide.QtXml.QDomDocument is passed invalid data.

    policy is set for all instances of PySide.QtXml.QDomDocument which already exist and which will be created in the future.

    doc = QDomDocument()
    impl = QDomImplementation()
    # This will create the element, but the resulting XML document will
    # be invalid, because '~' is not a valid character in a tag name.
    impl.setInvalidDataPolicy(QDomImplementation.AcceptInvalidData)
    elt1 = doc.createElement("foo~bar")
    # This will create an element with the tag name "foobar".
    impl.setInvalidDataPolicy(QDomImplementation.DropInvalidData)
    elt2 = doc.createElement("foo~bar")
    # This will create a null element.
    impl.setInvalidDataPolicy(QDomImplementation::ReturnNullNode)
    elt3 = doc.createElement("foo~bar")
    										

    另请参阅

    PySide.QtXml.QDomImplementation.invalidDataPolicy() QDomImplementation.InvalidDataPolicy