Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QXmlReader Class

TheQXmlReader class provides an interface for XML readers (i.e. parsers).More...

Header:#include <QXmlReader>
Inherited By:

QXmlSimpleReader

Note: All functions in this class arereentrant.

Public Functions

virtual~QXmlReader()
virtual QXmlDTDHandler *DTDHandler() const = 0
virtual QXmlContentHandler *contentHandler() const = 0
virtual QXmlDeclHandler *declHandler() const = 0
virtual QXmlEntityResolver *entityResolver() const = 0
virtual QXmlErrorHandler *errorHandler() const = 0
virtual boolfeature(const QString & name, bool * ok = 0) const = 0
virtual boolhasFeature(const QString & name) const = 0
virtual boolhasProperty(const QString & name) const = 0
virtual QXmlLexicalHandler *lexicalHandler() const = 0
virtual boolparse(const QXmlInputSource * input) = 0
virtual void *property(const QString & name, bool * ok = 0) const = 0
virtual voidsetContentHandler(QXmlContentHandler * handler) = 0
virtual voidsetDTDHandler(QXmlDTDHandler * handler) = 0
virtual voidsetDeclHandler(QXmlDeclHandler * handler) = 0
virtual voidsetEntityResolver(QXmlEntityResolver * handler) = 0
virtual voidsetErrorHandler(QXmlErrorHandler * handler) = 0
virtual voidsetFeature(const QString & name, bool value) = 0
virtual voidsetLexicalHandler(QXmlLexicalHandler * handler) = 0
virtual voidsetProperty(const QString & name, void * value) = 0

Detailed Description

TheQXmlReader 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).

The design of the XML classes follows theSAX2 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 classQXmlInputSource 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 andQXmlLexicalHandler), 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 theQXmlDefaultHandler 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 withsetFeature() andsetProperty() respectively. You can set the reader to use your own subclasses withsetEntityResolver(),setDTDHandler(),setContentHandler(),setErrorHandler(),setLexicalHandler() andsetDeclHandler(). The parse itself is started with a call toparse().

See alsoQXmlSimpleReader.

Member Function Documentation

[virtual]QXmlReader::~QXmlReader()

Destroys the reader.

[pure virtual]QXmlDTDHandler * QXmlReader::DTDHandler() const

Returns the DTD handler or 0 if none was set.

See alsosetDTDHandler().

[pure virtual]QXmlContentHandler * QXmlReader::contentHandler() const

Returns the content handler or 0 if none was set.

See alsosetContentHandler().

[pure virtual]QXmlDeclHandler * QXmlReader::declHandler() const

Returns the declaration handler or 0 if none was set.

See alsosetDeclHandler().

[pure virtual]QXmlEntityResolver * QXmlReader::entityResolver() const

Returns the entity resolver or 0 if none was set.

See alsosetEntityResolver().

[pure virtual]QXmlErrorHandler * QXmlReader::errorHandler() const

Returns the error handler or 0 if none is set.

See alsosetErrorHandler().

[pure virtual]bool QXmlReader::feature(constQString & name,bool * ok = 0) const

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

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

See alsosetFeature() andhasFeature().

[pure virtual]bool QXmlReader::hasFeature(constQString & name) const

Returnstrue if the reader has the feature calledname; otherwise returns false.

See alsofeature() andsetFeature().

[pure virtual]bool QXmlReader::hasProperty(constQString & name) const

Returns true if the reader has the propertyname; otherwise returns false.

See alsoproperty() andsetProperty().

[pure virtual]QXmlLexicalHandler * QXmlReader::lexicalHandler() const

Returns the lexical handler or 0 if none was set.

See alsosetLexicalHandler().

[pure virtual]bool QXmlReader::parse(constQXmlInputSource * input)

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

[pure virtual]void * QXmlReader::property(constQString & name,bool * ok = 0) const

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

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

See alsosetProperty() andhasProperty().

[pure virtual]void QXmlReader::setContentHandler(QXmlContentHandler * handler)

Sets the content handler tohandler.

See alsocontentHandler().

[pure virtual]void QXmlReader::setDTDHandler(QXmlDTDHandler * handler)

Sets the DTD handler tohandler.

See alsoDTDHandler().

[pure virtual]void QXmlReader::setDeclHandler(QXmlDeclHandler * handler)

Sets the declaration handler tohandler.

See alsodeclHandler().

[pure virtual]void QXmlReader::setEntityResolver(QXmlEntityResolver * handler)

Sets the entity resolver tohandler.

See alsoentityResolver().

[pure virtual]void QXmlReader::setErrorHandler(QXmlErrorHandler * handler)

Sets the error handler tohandler. Clears the error handler ifhandler is 0.

See alsoerrorHandler().

[pure virtual]void QXmlReader::setFeature(constQString & name,bool value)

Sets the feature calledname to the givenvalue. If the reader doesn't have the feature nothing happens.

See alsofeature() andhasFeature().

[pure virtual]void QXmlReader::setLexicalHandler(QXmlLexicalHandler * handler)

Sets the lexical handler tohandler.

See alsolexicalHandler().

[pure virtual]void QXmlReader::setProperty(constQString & name,void * value)

Sets the propertyname tovalue. If the reader doesn't have the property nothing happens.

See alsoproperty() andhasProperty().

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp