The QXmlReader class provides an interface for XML readers (i.e. parsers). 更多...
Inherited by QXmlSimpleReader .
The 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: QXmlSimpleReader . In future releases there might be more readers with different properties available (e.g. a validating parser).
XML 类的设计遵循 SAX2 Java 接口 , 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 类。
所有读取器使用类 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 ( QXmlDTDHandler , QXmlDeclHandler , QXmlContentHandler , QXmlEntityResolver , QXmlErrorHandler and 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 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.
可以设置读取器的特征和特性采用 setFeature () 和 setProperty () respectively. You can set the reader to use your own subclasses with setEntityResolver (), setDTDHandler (), setContentHandler (), setErrorHandler (), setLexicalHandler () and setDeclHandler (). The parse itself is started with a call to parse ().
This method is abstract and should be reimplemented in any sub-class.
Returns the content handler or 0 if none was set.
另请参阅 setContentHandler ().
This method is abstract and should be reimplemented in any sub-class.
Returns the declaration handler or 0 if none was set.
另请参阅 setDeclHandler ().
This method is abstract and should be reimplemented in any sub-class.
Returns the DTD handler or 0 if none was set.
另请参阅 setDTDHandler ().
This method is abstract and should be reimplemented in any sub-class.
Returns the entity resolver or 0 if none was set.
另请参阅 setEntityResolver ().
This method is abstract and should be reimplemented in any sub-class.
Returns the error handler or 0 if none is set.
另请参阅 setErrorHandler ().
This method is abstract and should be reimplemented in any sub-class.
若读取器拥有的特征称为 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 ;否则 * ok 被设为 false。
另请参阅 setFeature () 和 hasFeature ().
This method is abstract and should be reimplemented in any sub-class.
返回 true 若读取器拥有的特征称为 name ;否则返回 false。
另请参阅 feature () and setFeature ().
This method is abstract and should be reimplemented in any sub-class.
Returns true if the reader has the property name ; otherwise returns false.
另请参阅 property () 和 setProperty ().
This method is abstract and should be reimplemented in any sub-class.
Returns the lexical handler or 0 if none was set.
另请参阅 setLexicalHandler ().
This method is abstract and should be reimplemented in any sub-class.
读取 XML 文档从 input 并剖析它。返回 true if the parsing was successful; otherwise returns false.
This method is abstract and should be reimplemented in any sub-class.
This method is abstract and should be reimplemented in any sub-class.
若读取器拥有特性 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 被设为 true;否则 * ok 被设为 false。
另请参阅 setProperty () 和 hasProperty ().
This method is abstract and should be reimplemented in any sub-class.
把内容处理程序设为 handler .
另请参阅 contentHandler ().
This method is abstract and should be reimplemented in any sub-class.
把声明处理程序设为 handler .
另请参阅 declHandler ().
This method is abstract and should be reimplemented in any sub-class.
把 DTD 处理程序设为 handler .
另请参阅 DTDHandler ().
This method is abstract and should be reimplemented in any sub-class.
把实体解析器设为 handler .
另请参阅 entityResolver ().
This method is abstract and should be reimplemented in any sub-class.
把错误处理程序设为 handler . Clears the error handler if handler 为 0。
另请参阅 errorHandler ().
This method is abstract and should be reimplemented in any sub-class.
设置特征称为 name 到给定 value . If the reader doesn't have the feature nothing happens.
另请参阅 feature () and hasFeature ().
This method is abstract and should be reimplemented in any sub-class.
把词法处理程序设为 handler .
另请参阅 lexicalHandler ().
This method is abstract and should be reimplemented in any sub-class.
设置特性 name to value . If the reader doesn't have the property nothing happens.
另请参阅 property () 和 hasProperty ().