42 #include "QtCore/qxmlstream.h" 44 #if defined(QT_BUILD_XML_LIB) && defined(Q_OS_MAC64) 48 # define QT_NO_XMLSTREAM 51 #ifndef QT_NO_XMLSTREAM 60 #ifndef QT_BOOTSTRAPPED 66 #define Q_DECLARE_TR_FUNCTIONS(context) \ 68 static inline QString tr(const char *sourceText, const char *comment = 0) \ 69 { Q_UNUSED(comment); return QString::fromLatin1(sourceText); } \ 70 static inline QString trUtf8(const char *sourceText, const char *comment = 0) \ 71 { Q_UNUSED(comment); return QString::fromLatin1(sourceText); } \ 72 static inline QString tr(const char *sourceText, const char*, int) \ 73 { return QString::fromLatin1(sourceText); } \ 74 static inline QString trUtf8(const char *sourceText, const char*, int) \ 75 { return QString::fromLatin1(sourceText); } \ 222 #ifndef QT_NO_XMLSTREAMREADER 227 return entityResolver->resolveUndeclaredEntity(name);
251 d->entityResolver = resolver;
267 return d->entityResolver;
430 d->dataBuffer =
data;
442 #ifdef QT_NO_TEXTCODEC 445 d->dataBuffer =
d->codec->fromUnicode(data);
446 d->decoder =
d->codec->makeDecoder();
448 d->lockEncoding =
true;
492 if (
d->deleteDevice) {
494 d->deleteDevice =
false;
524 qWarning(
"QXmlStreamReader: addData() with device()");
527 d->dataBuffer +=
data;
539 d->lockEncoding =
true;
540 #ifdef QT_NO_TEXTCODEC 543 addData(
d->codec->fromUnicode(data));
597 return d->device->atEnd();
599 return !
d->dataBuffer.size();
627 if (!
d->hasCheckedStartDocument)
628 if (!
d->checkStartDocument())
634 d->raiseWellFormedError(QXmlStream::tr(
"Extra content at end of document."));
760 "ProcessingInstruction\0";
763 0, 8, 16, 30, 42, 55, 66, 77, 85, 89, 105, 0
785 d->namespaceProcessing = enable;
791 return d->namespaceProcessing;
805 #endif // QT_NO_XMLSTREAMREADER 809 tagStack.reserve(16);
810 tagStackStringStorage.reserve(32);
811 tagStackStringStorageSize = 0;
817 #ifndef QT_NO_XMLSTREAMREADER 824 #ifndef QT_NO_TEXTCODEC 865 #ifndef QT_NO_TEXTCODEC 929 #ifndef QT_NO_TEXTCODEC 1024 if(
c < 0x20 || (
c > 0xFFFD &&
c < 0x10000) ||
c > 0x10FFFF ) {
1034 if (
c ==
uint(*str)) {
1036 if (tokenToInject >= 0)
1040 if (
scanString(str + 1, tokenToInject,
false))
1056 if (c !=
ushort(str[n])) {
1066 for (
int i = 0; i < n; ++i)
1077 if (tokenToInject >= 0)
1214 if (!(c & 0xff0000)) {
1279 while ((c =
getChar()) ==
']') {
1309 if (!(c & 0xff0000)) {
1359 if (prefix && *prefix == n+1) {
1467 for (
int i = s.
size()-1; i >= from; --i)
1474 for (
int i = s.
size()-1; i >= 0; --i)
1481 for (
int i = s.
size()-1; i >= 0; --i) {
1483 if (c ==
'\n' || c ==
'\r')
1492 for (
int i = s.
size()-1; i >= 0; --i) {
1494 if (c ==
'&' || c ==
';')
1496 else if (c ==
'\n' || c ==
'\r')
1505 const int BUFFER_SIZE = 8192;
1509 #ifndef QT_NO_TEXTCODEC 1530 #ifndef QT_NO_TEXTCODEC 1545 if ((ch1 == 0 && ch2 == 0 && ch3 == 0xfe && ch4 == 0xff) ||
1546 (ch1 == 0xff && ch2 == 0xfe && ch3 == 0 && ch4 == 0))
1548 else if (ch1 == 0x3c && ch2 == 0x00 && ch3 == 0x00 && ch4 == 0x00)
1550 else if (ch1 == 0x00 && ch2 == 0x00 && ch3 == 0x00 && ch4 == 0x3c)
1552 else if ((ch1 == 0xfe && ch2 == 0xff) || (ch1 == 0xff && ch2 == 0xfe))
1554 else if (ch1 == 0x3c && ch2 == 0x00)
1556 else if (ch1 == 0x00 && ch2 == 0x3c)
1572 #endif // QT_NO_TEXTCODEC 1589 if (namespaceDeclaration.
prefix == prefix) {
1628 ns ==
QLatin1String(
"http://www.w3.org/XML/1998/namespace"))
1637 ^ (namespaceUri ==
QLatin1String(
"http://www.w3.org/XML/1998/namespace")))
1638 || namespaceUri ==
QLatin1String(
"http://www.w3.org/2000/xmlns/")
1643 namespaceDeclaration.
prefix = namespacePrefix;
1653 for (
int i = 0; i < n; ++i) {
1670 for (
int j = 0; j < i; ++j) {
1714 for (
int i = 0; i < n; ++i) {
1753 if (
sym(symbolIndex).
c ==
'x')
1758 ok &= (s == 0x9 || s == 0xa || s == 0xd || (s >= 0x20 && s <= 0xd7ff)
1759 || (s >= 0xe000 && s <= 0xfffd) || (s >= 0x10000 && s <= 0x10ffff));
1772 for (i = publicId.
size() - 1; i >= 0; --i) {
1774 switch ((c = data[i])) {
1775 case ' ':
case '\n':
case '\r':
case '-':
case '(':
case ')':
1776 case '+':
case ',':
case '.':
case '/':
case ':':
case '=':
1777 case '?':
case ';':
case '!':
case '*':
case '#':
case '@':
1778 case '$':
case '_':
case '%':
case '\'':
case '\"':
1781 if ((c >=
'a' && c <=
'z')
1782 || (c >=
'A' && c <=
'Z')
1783 || (c >=
'0' && c <=
'9'))
1817 err = QXmlStream::tr(
"Invalid XML version string.");
1819 err = QXmlStream::tr(
"Unsupported XML version.");
1827 bool hasStandalone =
false;
1829 for (
int i = 0; err.
isNull() && i < n; ++i) {
1840 err = QXmlStream::tr(
"The standalone pseudo attribute must appear after the encoding.");
1842 err = QXmlStream::tr(
"%1 is an invalid encoding name.").
arg(
name);
1844 #ifdef QT_NO_TEXTCODEC 1849 err = QXmlStream::tr(
"Encoding %1 is unsupported").
arg(
name);
1856 #endif // QT_NO_TEXTCODEC 1859 hasStandalone =
true;
1865 err = QXmlStream::tr(
"Standalone accepts only yes or no.");
1867 err = QXmlStream::tr(
"Invalid attribute in XML declaration.");
1879 this->error =
error;
1883 errorString = QXmlStream::tr(
"Premature end of document.");
1885 errorString = QXmlStream::tr(
"Invalid document.");
1914 if (nexpected < nmax)
1915 expected[nexpected++] = tk;
1919 error_message.
clear ();
1920 if (nexpected && nexpected < nmax) {
1923 for (
int s = 0; s < nexpected; ++s) {
1925 error_message += QXmlStream::tr (
"Expected ");
1926 else if (s == nexpected - 1)
1927 error_message +=
QLatin1String (nexpected > 2 ?
", or " :
" or ");
1936 error_message += QXmlStream::tr(
", but got \'");
1940 error_message += QXmlStream::tr(
"Unexpected \'");
1962 return d->lineNumber + 1;
1972 return d->characterOffset -
d->lastLineStart +
d->readBufferPos;
1982 return d->characterOffset +
d->readBufferPos;
2005 if (
d->notationDeclarations.size())
2006 const_cast<QXmlStreamReaderPrivate *>(
d)->resolveDtd();
2007 return d->publicNotationDeclarations;
2020 if (
d->entityDeclarations.size())
2021 const_cast<QXmlStreamReaderPrivate *>(
d)->resolveDtd();
2022 return d->publicEntityDeclarations;
2057 return d->dtdPublicId;
2075 return d->dtdSystemId;
2091 if (
d->publicNamespaceDeclarations.isEmpty() &&
d->type == StartElement)
2092 const_cast<QXmlStreamReaderPrivate *>(
d)->resolvePublicNamespaces();
2093 return d->publicNamespaceDeclarations;
2114 namespaceDeclaration.
prefix =
d->addToStringStorage(extraNamespaceDeclaration.
prefix());
2130 for (
int i = 0; i < extraNamespaceDeclarations.
size(); ++i)
2131 addExtraNamespaceDeclaration(extraNamespaceDeclarations.
at(i));
2154 if (isStartElement()) {
2157 switch (readNext()) {
2159 case EntityReference:
2160 result.
insert(result.
size(),
d->text.unicode(),
d->text.size());
2164 case ProcessingInstruction:
2168 if (behaviour == SkipChildElements) {
2169 skipCurrentElement();
2171 }
else if (behaviour == IncludeChildElements) {
2172 result += readElementText(behaviour);
2177 if (
d->error || behaviour == ErrorOnUnexpectedElement) {
2179 d->raiseError(UnexpectedElementError, QXmlStream::tr(
"Expected character data."));
2198 return readElementText(ErrorOnUnexpectedElement);
2208 d->raiseError(CustomError, message);
2220 return d->errorString;
2242 return d->processingInstructionTarget;
2251 return d->processingInstructionData;
2275 return d->namespaceUri;
2293 return d->qualifiedName;
2320 return d->attributes;
2323 #endif // QT_NO_XMLSTREAMREADER 2347 m_isDefault =
false;
2376 qualifiedName.
size() - (colon + 1)));
2807 for (
int i = 0; i < size(); ++i) {
2810 return attribute.
value();
2822 for (
int i = 0; i < size(); ++i) {
2825 return attribute.
value();
2837 for (
int i = 0; i < size(); ++i) {
2840 return attribute.
value();
2859 for (
int i = 0; i < size(); ++i) {
2862 return attribute.
value();
2881 for (
int i = 0; i < size(); ++i) {
2884 return attribute.
value();
2907 #ifndef QT_NO_XMLSTREAMREADER 2999 return d->standalone;
3017 return d->documentVersion;
3035 return d->documentEncoding;
3039 #endif // QT_NO_XMLSTREAMREADER 3118 #ifndef QT_NO_XMLSTREAMWRITER 3128 #ifndef QT_NO_TEXTCODEC 3135 void writeEscaped(
const QString &,
bool escapeWhitespace =
false);
3136 void write(
const char *s,
int len);
3137 template <
int N>
void write(
const char (&s)[N]) {
write(s, N - 1); }
3138 bool finishStartElement(
bool contents =
true);
3154 #ifndef QT_NO_TEXTCODEC 3158 void checkIfASCIICompatibleCodec();
3165 void indent(
int level);
3170 :autoFormattingIndent(4,
' ')
3176 #ifndef QT_NO_TEXTCODEC 3192 #ifndef QT_NO_TEXTCODEC 3207 #ifdef QT_NO_TEXTCODEC 3218 qWarning(
"QXmlStreamWriter: No device");
3226 #ifdef QT_NO_TEXTCODEC 3237 qWarning(
"QXmlStreamWriter: No device");
3244 for (
int i = 0; i < s.
size(); ++i ) {
3252 else if (c.
unicode() ==
'\"' )
3254 else if (escapeWhitespace && c.
isSpace()) {
3264 escaped +=
QChar(c);
3305 return hadSomethingWritten;
3317 return hadSomethingWritten;
3324 if (namespaceDeclaration.
namespaceUri == namespaceUri) {
3326 return namespaceDeclaration;
3348 if (writeDeclaration)
3350 return namespaceDeclaration;
3358 for (
int i = level; i > 0; --i)
3393 d->deleteDevice =
true;
3403 d->stringDevice = string;
3423 if (device ==
d->device)
3425 d->stringDevice = 0;
3426 if (
d->deleteDevice) {
3428 d->deleteDevice =
false;
3446 #ifndef QT_NO_TEXTCODEC 3465 d->checkIfASCIICompatibleCodec();
3492 #endif // QT_NO_TEXTCODEC 3524 d->autoFormatting = enable;
3535 return d->autoFormatting;
3558 d->autoFormattingIndent =
QByteArray(
qAbs(spacesOrTabs), spacesOrTabs >= 0 ?
' ' :
'\t');
3564 return d->autoFormattingIndent.count(
' ') -
d->autoFormattingIndent.count(
'\t');
3602 d->write(qualifiedName);
3604 d->writeEscaped(value,
true);
3623 if (!namespaceDeclaration.prefix.isEmpty()) {
3624 d->write(namespaceDeclaration.prefix);
3629 d->writeEscaped(value,
true);
3670 for (
int i = 0; i < attributes.
size(); ++i)
3686 d->finishStartElement();
3689 d->write(
"<![CDATA[");
3704 d->finishStartElement();
3705 d->writeEscaped(text);
3717 if (!
d->finishStartElement(
false) &&
d->autoFormatting)
3718 d->indent(
d->tagStack.size());
3722 d->inStartElement =
d->lastWasStartElement =
false;
3732 d->finishStartElement();
3733 if (
d->autoFormatting)
3736 if (
d->autoFormatting)
3753 d->writeStartElement(
QString(), qualifiedName);
3754 d->inEmptyElement =
true;
3769 d->writeStartElement(namespaceUri, name);
3770 d->inEmptyElement =
true;
3815 while (
d->tagStack.size())
3828 if (
d->tagStack.isEmpty())
3832 if (
d->inStartElement && !
d->inEmptyElement) {
3834 d->lastWasStartElement =
d->inStartElement =
false;
3840 if (!
d->finishStartElement(
false) && !
d->lastWasStartElement &&
d->autoFormatting)
3841 d->indent(
d->tagStack.size()-1);
3842 if (
d->tagStack.isEmpty())
3844 d->lastWasStartElement =
false;
3864 d->finishStartElement();
3892 d->findNamespace(namespaceUri,
d->inStartElement);
3897 namespaceDeclaration.
prefix =
d->addToStringStorage(prefix);
3898 namespaceDeclaration.
namespaceUri =
d->addToStringStorage(namespaceUri);
3899 if (
d->inStartElement)
3900 d->writeNamespaceDeclaration(namespaceDeclaration);
3922 namespaceDeclaration.
namespaceUri =
d->addToStringStorage(namespaceUri);
3923 if (
d->inStartElement)
3924 d->writeNamespaceDeclaration(namespaceDeclaration);
3936 if (!
d->finishStartElement(
false) &&
d->autoFormatting)
3937 d->indent(
d->tagStack.size());
3971 d->finishStartElement(
false);
3972 d->write(
"<?xml version=\"");
3975 d->write(
"\" encoding=\"");
3976 #ifdef QT_NO_TEXTCODEC 3977 d->write(
"iso-8859-1");
3979 d->write(
d->codec->name().constData(),
d->codec->name().length());
3994 d->finishStartElement(
false);
3995 d->write(
"<?xml version=\"");
3998 d->write(
"\" encoding=\"");
3999 #ifdef QT_NO_TEXTCODEC 4000 d->write(
"iso-8859-1");
4002 d->write(
d->codec->name().constData(),
d->codec->name().length());
4006 d->write(
"\" standalone=\"yes\"?>");
4008 d->write(
"\" standalone=\"no\"?>");
4023 d->writeStartElement(
QString(), qualifiedName);
4039 d->writeStartElement(namespaceUri, name);
4045 indent(tagStack.size());
4047 Tag &tag = tagStack_push();
4048 tag.name = addToStringStorage(name);
4049 tag.namespaceDeclaration = findNamespace(namespaceUri);
4051 if (!tag.namespaceDeclaration.prefix.isEmpty()) {
4052 write(tag.namespaceDeclaration.prefix);
4056 inStartElement = lastWasStartElement =
true;
4058 for (
int i = lastNamespaceDeclaration; i < namespaceDeclarations.size(); ++i)
4059 writeNamespaceDeclaration(namespaceDeclarations[i]);
4060 tag.namespaceDeclarationsSize = lastNamespaceDeclaration;
4063 #ifndef QT_NO_XMLSTREAMREADER 4084 for (
int i = 0; i < namespaceDeclarations.
size(); ++i) {
4116 qWarning(
"QXmlStreamWriter: writeCurrentToken() with invalid state.");
4153 #endif // QT_NO_XMLSTREAMREADER 4154 #endif // QT_NO_XMLSTREAMWRITER 4158 #endif // QT_NO_XMLSTREAM uint referenceToUnparsedEntityDetected
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Error error() const
Returns the type of the current error, or NoError if no error occurred.
uint resolveCharRef(int symbolIndex)
QXmlStreamStringRef m_namespaceUri
QXmlStreamEntityDeclaration & operator=(const QXmlStreamEntityDeclaration &)
Assigns other to this entity declaration.
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
bool scanAfterLangleBang()
QString toString() const
Returns a copy of the string reference as a QString object.
void checkPublicLiteral(const QStringRef &publicId)
void clear()
Clears the contents of the string reference by making it null and empty.
The QXmlStreamWriter class provides an XML writer with a simple streaming API.
int autoFormattingIndent() const
the number of spaces or tabs used for indentation when auto-formatting is enabled.
QXmlStreamWriterPrivate(QXmlStreamWriter *q)
QXmlStreamStringRef m_name
QStringRef appendTo(QString *string) const
Appends the string reference to string, and returns a new reference to the combined string data...
Category
This enum maps the Unicode character categories.
~QXmlStreamWriter()
Destructor.
#define QT_END_NAMESPACE
This macro expands to.
bool finishStartElement(bool contents=true)
QXmlStreamAttribute & operator=(const QXmlStreamAttribute &)
Assigns other to this attribute.
bool autoFormatting() const
This property controls whether or not the stream writer automatically formats the generated XML data...
char * data()
Returns a pointer to the data stored in the byte array.
qint64 characterOffset() const
Returns the current character offset, starting with 0.
const QChar at(int i) const
Returns the character at the given index position in the string.
qint64 lineNumber() const
Returns the current line number, starting with 1.
uint isCodecASCIICompatible
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QStringRef documentEncoding
void resolvePublicNamespaces()
QXmlStreamSimpleStack< DtdAttribute > dtdAttributes
static const char QXmlStreamReader_tokenTypeString_string[]
QXmlStreamAttributes attributes
QStringRef attributePrefix
void setEntityResolver(QXmlStreamEntityResolver *resolver)
Makes resolver the new entityResolver().
The QXmlStreamEntityDeclaration class represents a DTD entity declaration.
bool isCDATA() const
Returns true if the reader reports characters that stem from a CDATA section; otherwise returns false...
QXmlStreamEntityDeclarations entityDeclarations() const
If the state() is DTD , this function returns the DTD's unparsed (external) entity declarations...
QHash< QString, Entity > entityHash
Q_CORE_EXPORT void qFree(void *ptr)
QString & replace(int i, int len, QChar after)
#define at(className, varName)
The QByteArray class provides an array of bytes.
bool scanString(const char *str, short tokenToInject, bool requireSpace=true)
QXmlStreamStringRef m_notationName
QString resolveUndeclaredEntity(const QString &name)
The QXmlStreamNotationDeclaration class represents a DTD notation declaration.
QXmlStreamEntityResolver * entityResolver
QStringRef value() const
Returns the attribute's value.
bool isEndElement() const
Returns true if tokenType() equals EndElement ; otherwise returns false.
QXmlStreamStringRef m_publicId
~QXmlStreamNamespaceDeclaration()
Destructs this namespace declaration.
QTextDecoder * makeDecoder() const
Creates a QTextDecoder which stores enough state to decode chunks of char * data to create chunks of ...
void raiseError(const QString &message=QString())
Raises a custom error with an optional error message.
void writeEndDocument()
Closes all remaining open start elements and writes a newline.
QXmlStreamSimpleStack< Attribute > attributeStack
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QStringRef name() const
Returns the local name of a StartElement, EndElement, or an EntityReference.
long ASN1_INTEGER_get ASN1_INTEGER * a
uint hasCheckedStartDocument
Q_CORE_EXPORT void * qRealloc(void *ptr, size_t size)
void parseEntity(const QString &value)
virtual ~QXmlStreamEntityResolver()
Destroys the entity resolver.
The QBuffer class provides a QIODevice interface for a QByteArray.
bool atEnd() const
Returns true if the reader has read until the end of the XML document, or if an error() has occurred ...
The QString class provides a Unicode character string.
QStringRef attributeQualifiedName
void injectToken(ushort tokenToInject)
bool scanUntil(const char *str, short tokenToInject=-1)
Scans characters until str is encountered, and validates the characters as according to the Char[2] p...
Q_DECL_CONSTEXPR T qAbs(const T &t)
TokenType
This enum specifies the type of token the reader just read.
void writeDTD(const QString &dtd)
Writes a DTD section.
QStringRef prefix() const
Returns the prefix of a StartElement or EndElement.
void putStringLiteral(const QString &s)
QStringRef qualifiedName() const
Returns the attribute's qualified name.
The QChar class provides a 16-bit Unicode character.
void writeEntityReference(const QString &name)
Writes the entity reference name to the stream, as "&\a{name};".
QXmlStreamStringRef m_value
bool isNamespaceAttribute
uint referenceToParameterEntityDetected
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
bool isSpace() const
Returns true if the character is a separator character (Separator_* categories); otherwise returns fa...
Category category() const
Returns the character's category.
void resize(int size)
Sets the size of the vector to size.
QStringRef value(const QString &namespaceUri, const QString &name) const
Returns the value of the attribute name in the namespace described with namespaceUri, or an empty string reference if the attribute is not defined.
int lastNamespaceDeclaration
QXmlStreamStringRef m_name
void writeEscaped(const QString &, bool escapeWhitespace=false)
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read...
Value & sym(int index) const
QXmlStreamNotationDeclaration()
Creates an empty notation declaration.
const QChar * constData() const
Same as unicode().
The QXmlStreamAttribute class represents a single XML attribute.
void writeCDATA(const QString &text)
Writes text as CDATA section.
void reserve(int size)
Attempts to allocate memory for at least size characters.
QStringRef namespaceUri() const
Returns the namespaceUri of a StartElement or EndElement.
void setCodec(QTextCodec *codec)
Sets the codec for this stream to codec.
virtual QString resolveEntity(const QString &publicId, const QString &systemId)
TokenType tokenType() const
Returns the type of the current token.
int size() const
Returns the number of characters referred to by the string reference.
QXmlStreamReader()
Constructs a stream reader.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QScopedPointer< QXmlStreamReaderPrivate > d_ptr
void writeAttribute(const QString &qualifiedName, const QString &value)
Writes an attribute with qualifiedName and value.
QIODevice * device() const
Returns the current device associated with the QXmlStreamWriter, or 0 if no device has been assigned...
int fastScanContentCharList()
Used for text nodes essentially.
void writeNamespaceDeclaration(const NamespaceDeclaration &namespaceDeclaration)
void raiseError(QXmlStreamReader::Error error, const QString &message=QString())
The QXmlStreamEntityResolver class provides an entity resolver for a QXmlStreamReader.
QHash< QString, Entity > parameterEntityHash
void clear()
Removes all the elements from the vector and releases the memory used by the vector.
QXmlStreamSimpleStack< uint > putStack
int size() const
Returns the number of characters in this string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void skipCurrentElement()
Reads until the end of the current element, skipping any child nodes.
QXmlStreamStringRef m_systemId
void writeStartElement(const QString &namespaceUri, const QString &name)
ReadElementTextBehaviour
This enum specifies the different behaviours of readElementText().
void writeNamespace(const QString &namespaceUri, const QString &prefix=QString())
Writes a namespace declaration for namespaceUri with prefix.
QXmlStreamStringRef m_systemId
The QTextEncoder class provides a state-based encoder.
QXmlStreamStringRef m_name
Q_CORE_EXPORT void qWarning(const char *,...)
bool isEmpty() const
Returns true if the string reference has no characters; otherwise returns false.
virtual QString resolveUndeclaredEntity(const QString &name)
Resolves the undeclared entity name and returns its replacement text.
QXmlStreamNotationDeclaration & operator=(const QXmlStreamNotationDeclaration &)
Assigns other to this notation declaration.
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
bool scanPublicOrSystem()
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
void checkIfASCIICompatibleCodec()
QStringRef namespaceUri() const
Returns the namespaceUri.
bool scanAfterDefaultDecl()
static QTextCodec * codecForMib(int mib)
Returns the QTextCodec which matches the MIBenum mib.
QStringRef prefix() const
Returns the prefix.
NamespaceDeclaration & findNamespace(const QString &namespaceUri, bool writeDeclaration=false, bool noDefault=false)
void addExtraNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &extraNamespaceDeclaraction)
Adds an extraNamespaceDeclaration.
QXmlStreamStringRef m_qualifiedName
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
QStringRef name() const
Returns the attribute's local name.
QXmlStreamNotationDeclarations publicNotationDeclarations
QXmlStreamStringRef m_namespaceUri
void writeCharacters(const QString &text)
Writes text.
QStringRef documentEncoding() const
If the state() is StartDocument , this function returns the encoding string as specified in the XML d...
QIODevice * device() const
Returns the current device associated with the QXmlStreamReader, or 0 if no device has been assigned...
The QStringRef class provides a thin wrapper around QString substrings.
NamespaceDeclaration emptyNamespace
QXmlStreamReader::Error error
const T & at(int i) const
Returns the item at index position i in the vector.
~QXmlStreamWriterPrivate()
bool isStartElement() const
Returns true if tokenType() equals StartElement ; otherwise returns false.
~QXmlStreamReader()
Destructs the reader.
TokenType readNext()
Reads the next token and returns its type.
QXmlStreamEntityDeclaration()
Creates an empty entity declaration.
int length() const
Same as size().
QStringRef qualifiedName() const
Returns the qualified name of a StartElement or EndElement;.
The QXmlStreamNamespaceDeclaration class represents a namespace declaration.
void resize(int size)
Sets the size of the string to size characters.
const char * constData() const
Returns a pointer to the data stored in the byte array.
QXmlStreamWriter()
Constructs a stream writer.
bool isNull() const
Returns true if this string is null; otherwise returns false.
QStringRef dtdPublicId() const
If the state() is DTD , this function returns the DTD's public identifier.
QStringRef namespaceForPrefix(const QStringRef &prefix)
bool hasFailure() const
Determines whether the decoder encountered a failure while decoding the input.
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
#define Q_DECLARE_PUBLIC(Class)
QXmlStreamReader::TokenType type
QString & append(QChar c)
bool readNextStartElement()
Reads until the next start element within the current element.
QStringRef symName(int index)
QByteArray autoFormattingIndent
~QXmlStreamReaderPrivate()
void writeStartDocument()
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setAutoFormattingIndent(int spacesOrTabs)
int count(char c) const
Returns the number of occurrences of character ch in the byte array.
void writeEndElement()
Closes the previous start element.
void putReplacement(const QString &s)
QStringRef documentVersion() const
If the state() is StartDocument , this function returns the version string as specified in the XML de...
The QXmlStreamAttributes class represents a vector of QXmlStreamAttribute.
void clear()
Clears the contents of the string and makes it empty.
uint hasExternalDtdSubset
void writeCurrentToken(const QXmlStreamReader &reader)
Writes the current state of the reader.
void writeDefaultNamespace(const QString &namespaceUri)
Writes a default namespace declaration for namespaceUri.
QXmlStreamNamespaceDeclaration()
Creates an empty namespace declaration.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
int fastScanName(int *prefix=0)
QXmlStreamSimpleStack< NotationDeclaration > notationDeclarations
Error
This enum specifies different error cases.
qint64 columnNumber() const
Returns the current column number, starting with 0.
void reserve(int extraCapacity)
QXmlStreamStringRef m_value
void setDevice(QIODevice *device)
Sets the current device to device.
static const char nameCharTable[128]
void addData(const QByteArray &data)
Adds more data for the reader to read.
void resize(int size)
Sets the size of the byte array to size bytes.
void putString(const QString &s, int from=0)
QXmlStreamNamespaceDeclarations namespaceDeclarations() const
If the state() is StartElement , this function returns the element's namespace declarations.
void writeTextElement(const QString &qualifiedName, const QString &text)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setDevice(QIODevice *device)
Sets the current device to device.
QString toUnicode(const char *chars, int len)
Converts the first len bytes in chars to Unicode, returning the result.
uint toUInt(bool *ok=0, int base=10) const
Returns the string converted to an unsigned int using base base, which is 10 by default and must be b...
QXmlStreamStringRef m_prefix
void writeEmptyElement(const QString &qualifiedName)
Writes an empty element with qualified name qualifiedName.
static QTextCodec * codecForName(const QByteArray &name)
Searches all installed QTextCodec objects and returns the one which best matches name; the match is c...
QXmlStreamStringRef m_publicId
int size() const
Returns the number of bytes in this byte array.
QStringRef documentVersion
QStringRef processingInstructionData() const
Returns the data of a ProcessingInstruction.
bool isWhitespace() const
Returns true if the reader reports characters that only consist of white-space; otherwise returns fal...
bool checkStartDocument()
static NameChar fastDetermineNameChar(QChar ch)
static int t_action(int state, int token)
bool namespaceProcessing() const
This property controls whether or not the stream reader processes namespaces.
void write(const QStringRef &)
QStringRef dtdSystemId() const
If the state() is DTD , this function returns the DTD's system identifier.
QScopedPointer< QXmlStreamWriterPrivate > d_ptr
void setAutoFormatting(bool)
QXmlStreamAttribute()
Creates an empty attribute.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
void writeProcessingInstruction(const QString &target, const QString &data=QString())
Writes an XML processing instruction with target and data, where data must not contain the sequence "...
The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming ...
QTextEncoder * makeEncoder() const
Creates a QTextEncoder which stores enough state to encode chunks of Unicode data as char * data...
void reserve(int size)
Attempts to allocate memory for at least size elements.
QXmlStreamReaderPrivate(QXmlStreamReader *q)
QStringRef processingInstructionTarget() const
Returns the target of a ProcessingInstruction.
static Entity createLiteral(const QString &entity)
bool isNull() const
Returns true if string() returns a null pointer or a pointer to a null string; otherwise returns true...
void raiseWellFormedError(const QString &message)
bool hasError() const
Returns true if the stream failed to write to the underlying device; otherwise returns false...
~QXmlStreamNotationDeclaration()
Destructs this notation declaration.
qint64 write(const char *data, qint64 len)
Writes at most maxSize bytes of data from data to the device.
QXmlStreamEntityResolver * entityResolver() const
Returns the entity resolver, or 0 if there is no entity resolver.
The QTextCodec class provides conversions between text encodings.
QStringRef text() const
Returns the text of Characters , Comment , DTD , or EntityReference.
bool isStandaloneDocument() const
Returns true if this document has been declared standalone in the XML declaration; otherwise returns ...
QString errorString() const
Returns the error message that was set with raiseError().
QXmlStreamReaderPrivate * entityParser
QStringRef dtdName() const
If the state() is DTD , this function returns the DTD's name.
char at(int i) const
Returns the character at index position i in the byte array.
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
void setNamespaceProcessing(bool)
void writeComment(const QString &text)
Writes text as XML comment, where text must not contain the forbidden sequence "--" or end with "-"...
The QIODevice class is the base interface class of all I/O devices in Qt.
void putReplacementInAttributeValue(const QString &s)
QXmlStreamNamespaceDeclaration & operator=(const QXmlStreamNamespaceDeclaration &)
Assigns other to this namespace declaration.
QStringRef symString(int index)
void append(const QString &namespaceUri, const QString &name, const QString &value)
Appends a new attribute with name in the namespace described with namespaceUri, and value value...
QString & insert(int i, QChar c)
QString readElementText()
QXmlStreamEntityDeclarations publicEntityDeclarations
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
int size() const
Returns the number of items in the vector.
uint filterCarriageReturn()
~QXmlStreamAttribute()
Destructs an attribute.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QXmlStreamAttributes attributes() const
Returns the attributes of a StartElement.
int fastScanLiteralContent()
QXmlStreamNamespaceDeclarations publicNamespaceDeclarations
void writeAttributes(const QXmlStreamAttributes &attributes)
Writes the attribute vector attributes.
void clear()
Removes any device() or data from the reader and resets its internal state to the initial state...
void clear()
Clears the contents of the byte array and makes it empty.
QXmlStreamSimpleStack< EntityDeclaration > entityDeclarations
QString tokenString() const
Returns the reader's current token as string.
~QXmlStreamEntityDeclaration()
Destructs this entity declaration.
QXmlStreamNotationDeclarations notationDeclarations() const
If the state() is DTD , this function returns the DTD's notation declarations.
void writeStartElement(const QString &qualifiedName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QStringRef symPrefix(int index)
static bool isEncName(const QString &encName)
Determines whether encName is a valid instance of production [81]EncName in the XML 1...
QByteArray fromUnicode(const QString &str)
Converts the Unicode string str into an encoded QByteArray.
static const char *const spell[]
QTextCodec * codec() const
Returns the codec that is currently assigned to the stream.
void addExtraNamespaceDeclarations(const QXmlStreamNamespaceDeclarations &extraNamespaceDeclaractions)
Adds a vector of declarations specified by extraNamespaceDeclarations.
static const short QXmlStreamReader_tokenTypeString_indices[]
void write(const char(&s)[N])
#define forever
This macro is provided for convenience for writing infinite loops.
QStringRef namespaceUri() const
Returns the attribute's resolved namespaceUri, or an empty string reference if the attribute does not...
void write(const QString &)