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

    上一话题

    QXmlAttributes

    下一话题

    QDomNamedNodeMap

    QXmlNamespaceSupport

    概要

    函数

    详细描述

    PySide.QtXml.QXmlNamespaceSupport class is a helper class for XML readers which want to include namespace support.

    You can set the prefix for the current namespace with PySide.QtXml.QXmlNamespaceSupport.setPrefix() , and get the list of current prefixes (or those for a given URI) with PySide.QtXml.QXmlNamespaceSupport.prefixes() . The namespace URI is available from PySide.QtXml.QXmlNamespaceSupport.uri() 。使用 PySide.QtXml.QXmlNamespaceSupport.pushContext() to start a new namespace context, and PySide.QtXml.QXmlNamespaceSupport.popContext() to return to the previous namespace context. Use PySide.QtXml.QXmlNamespaceSupport.splitName() or PySide.QtXml.QXmlNamespaceSupport.processName() to split a name into its prefix and local name.

    另请参阅

    Namespace Support via Features

    class PySide.QtXml. QXmlNamespaceSupport

    构造 PySide.QtXml.QXmlNamespaceSupport .

    PySide.QtXml.QXmlNamespaceSupport. popContext ( )

    Reverts to the previous namespace context.

    Normally, you should pop the context at the end of each XML element. After popping the context, all namespace prefix mappings that were previously in force are restored.

    PySide.QtXml.QXmlNamespaceSupport. prefix ( arg__1 )
    参数: arg__1 – unicode
    返回类型: unicode

    Returns one of the prefixes mapped to the namespace URI uri .

    If more than one prefix is currently mapped to the same URI, this function makes an arbitrary selection; if you want all of the prefixes, use PySide.QtXml.QXmlNamespaceSupport.prefixes() 代替。

    Note: to check for a default prefix, use the PySide.QtXml.QXmlNamespaceSupport.uri() function with an argument of “”.

    PySide.QtXml.QXmlNamespaceSupport. prefixes ( arg__1 )
    参数: arg__1 – unicode
    返回类型: list of strings

    这是重载函数。

    Returns a list of all prefixes currently declared for the namespace URI uri .

    The “xml:” prefix is included. If you only want one prefix that is mapped to the namespace URI, and you don't care which one you get, use the PySide.QtXml.QXmlNamespaceSupport.prefix() function instead.

    Note: The empty (default) prefix is never included in this list; to check for the presence of a default namespace, call PySide.QtXml.QXmlNamespaceSupport.uri() with “” as the argument.

    PySide.QtXml.QXmlNamespaceSupport. prefixes ( )
    返回类型: list of strings

    Returns a list of all the prefixes currently declared.

    If there is a default prefix, this function does not return it in the list; check for the default prefix using PySide.QtXml.QXmlNamespaceSupport.uri() with an argument of “”.

    PySide.QtXml.QXmlNamespaceSupport. processName ( arg__1 , arg__2 , arg__3 , arg__4 )
    参数:
    • arg__1 – unicode
    • arg__2 PySide.QtCore.bool
    • arg__3 – unicode
    • arg__4 – unicode

    Processes a raw XML 1.0 name in the current context by removing the prefix and looking it up among the prefixes currently declared.

    qname is the raw XML 1.0 name to be processed. isAttribute is true if the name is an attribute name.

    This function stores the namespace URI in nsuri (which will be set to an empty string if the raw name has an undeclared prefix), and stores the local name (without prefix) in localname (which will be set to an empty string if no namespace is in use).

    Note that attribute names are processed differently than element names: an unprefixed element name gets the default namespace (if any), while an unprefixed attribute name does not.

    PySide.QtXml.QXmlNamespaceSupport. pushContext ( )

    Starts a new namespace context.

    Normally, you should push a new context at the beginning of each XML element: the new context automatically inherits the declarations of its parent context, and it also keeps track of which declarations were made within this context.

    PySide.QtXml.QXmlNamespaceSupport. reset ( )

    Resets this namespace support object ready for reuse.

    PySide.QtXml.QXmlNamespaceSupport. setPrefix ( arg__1 , arg__2 )
    参数:
    • arg__1 – unicode
    • arg__2 – unicode

    This function declares a prefix pre in the current namespace context to be the namespace URI uri . The prefix remains in force until this context is popped, unless it is shadowed in a descendant context.

    Note that there is an asymmetry in this library. PySide.QtXml.QXmlNamespaceSupport.prefix() does not return the default “” prefix, even if you have declared one; to check for a default prefix, you must look it up explicitly using PySide.QtXml.QXmlNamespaceSupport.uri() . This asymmetry exists to make it easier to look up prefixes for attribute names, where the default prefix is not allowed.

    PySide.QtXml.QXmlNamespaceSupport. splitName ( arg__1 , arg__2 , arg__3 )
    参数:
    • arg__1 – unicode
    • arg__2 – unicode
    • arg__3 – unicode

    Splits the name qname at the ‘:' and returns the prefix in prefix and the local name in localname .

    PySide.QtXml.QXmlNamespaceSupport. uri ( arg__1 )
    参数: arg__1 – unicode
    返回类型: unicode

    Looks up the prefix prefix in the current context and returns the currently-mapped namespace URI. Use the empty string (“”) for the default namespace.