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

    上一话题

    QXmlLocator

    下一话题

    QXmlSimpleReader

    QXmlReader

    继承者: QXmlSimpleReader

    详细描述

    PySide.QtXml.QXmlReader class provides an interface for XML readers (i.e. parsers).

    This abstract class provides an interface for all of Qt's XML readers. Currently there is only one implementation of a reader included in Qt's XML module: PySide.QtXml.QXmlSimpleReader . In future releases there might be more readers with different properties available (e.g. a validating parser).

    The design of the XML classes follows the SAX2 Java interface, with the names adapted to fit Qt naming conventions. It should be very easy for anybody who has worked with SAX2 to get started with the Qt XML classes.

    All readers use the class PySide.QtXml.QXmlInputSource to read the input document. Since you are normally interested in particular content in the XML document, the reader reports the content through special handler classes ( PySide.QtXml.QXmlDTDHandler , PySide.QtXml.QXmlDeclHandler , PySide.QtXml.QXmlContentHandler , PySide.QtXml.QXmlEntityResolver , PySide.QtXml.QXmlErrorHandler and PySide.QtXml.QXmlLexicalHandler ), which you must subclass, if you want to process the contents.

    Since the handler classes only describe interfaces you must implement all the functions. We provide the PySide.QtXml.QXmlDefaultHandler class to make this easier: it implements a default behavior (do nothing) for all functions, so you can subclass it and just implement the functions you are interested in.

    Features and properties of the reader can be set with PySide.QtXml.QXmlReader.setFeature() and PySide.QtXml.QXmlReader.setProperty() respectively. You can set the reader to use your own subclasses with PySide.QtXml.QXmlReader.setEntityResolver() , PySide.QtXml.QXmlReader.setDTDHandler() , PySide.QtXml.QXmlReader.setContentHandler() , PySide.QtXml.QXmlReader.setErrorHandler() , PySide.QtXml.QXmlReader.setLexicalHandler() and PySide.QtXml.QXmlReader.setDeclHandler() . The parse itself is started with a call to PySide.QtXml.QXmlReader.parse() .

    class PySide.QtXml. QXmlReader
    PySide.QtXml.QXmlReader. DTDHandler ( )
    返回类型: PySide.QtXml.QXmlDTDHandler

    Returns the DTD handler or 0 if none was set.

    PySide.QtXml.QXmlReader. contentHandler ( )
    返回类型: PySide.QtXml.QXmlContentHandler

    Returns the content handler or 0 if none was set.

    PySide.QtXml.QXmlReader. declHandler ( )
    返回类型: PySide.QtXml.QXmlDeclHandler

    Returns the declaration handler or 0 if none was set.

    PySide.QtXml.QXmlReader. entityResolver ( )
    返回类型: PySide.QtXml.QXmlEntityResolver

    Returns the entity resolver or 0 if none was set.

    PySide.QtXml.QXmlReader. errorHandler ( )
    返回类型: PySide.QtXml.QXmlErrorHandler

    Returns the error handler or 0 if none is set.

    PySide.QtXml.QXmlReader. feature ( name )
    参数: name – unicode
    返回类型: PySequence

    If the reader has the feature called name , the feature's value is returned. If no such feature exists the return value is undefined.

    ok is not 0: * ok is set to true if the reader has the feature called name ; otherwise * ok is set to false.

    PySide.QtXml.QXmlReader. hasFeature ( name )
    参数: name – unicode
    返回类型: PySide.QtCore.bool

    返回 true if the reader has the feature called name ;否则返回 false。

    PySide.QtXml.QXmlReader. hasProperty ( name )
    参数: name – unicode
    返回类型: PySide.QtCore.bool

    Returns true if the reader has the property name ;否则返回 false。

    PySide.QtXml.QXmlReader. lexicalHandler ( )
    返回类型: PySide.QtXml.QXmlLexicalHandler

    Returns the lexical handler or 0 if none was set.

    PySide.QtXml.QXmlReader. parse ( input )
    参数: input PySide.QtXml.QXmlInputSource
    返回类型: PySide.QtCore.bool

    Reads an XML document from input and parses it. Returns true if the parsing was successful; otherwise returns false.

    PySide.QtXml.QXmlReader. parse ( input )
    参数: input PySide.QtXml.QXmlInputSource
    返回类型: PySide.QtCore.bool

    Parses the given input .

    PySide.QtXml.QXmlReader. property ( name )
    参数: name – unicode
    返回类型: PySequence

    If the reader has the property name , this function returns the value of the property; otherwise the return value is undefined.

    ok is not 0: if the reader has the name property * ok is set to true; otherwise * ok is set to false.

    PySide.QtXml.QXmlReader. setContentHandler ( handler )
    参数: handler PySide.QtXml.QXmlContentHandler

    Sets the content handler to handler .

    PySide.QtXml.QXmlReader. setDTDHandler ( handler )
    参数: handler PySide.QtXml.QXmlDTDHandler

    Sets the DTD handler to handler .

    PySide.QtXml.QXmlReader. setDeclHandler ( handler )
    参数: handler PySide.QtXml.QXmlDeclHandler

    Sets the declaration handler to handler .

    PySide.QtXml.QXmlReader. setEntityResolver ( handler )
    参数: handler PySide.QtXml.QXmlEntityResolver

    Sets the entity resolver to handler .

    PySide.QtXml.QXmlReader. setErrorHandler ( handler )
    参数: handler PySide.QtXml.QXmlErrorHandler

    Sets the error handler to handler . Clears the error handler if handler is 0.

    PySide.QtXml.QXmlReader. setFeature ( name , value )
    参数:
    • name – unicode
    • value PySide.QtCore.bool

    Sets the feature called name 到给定 value . If the reader doesn't have the feature nothing happens.

    PySide.QtXml.QXmlReader. setLexicalHandler ( handler )
    参数: handler PySide.QtXml.QXmlLexicalHandler

    Sets the lexical handler to handler .

    PySide.QtXml.QXmlReader. setProperty ( name , value )
    参数:
    • name – unicode
    • value void

    Sets the property name to value . If the reader doesn't have the property nothing happens.