Qt 4.8
Classes | Macros | Functions | Variables
qdom.cpp File Reference
#include <qplatformdefs.h>
#include <qdom.h>
#include "private/qxmlutils_p.h"
#include <qatomic.h>
#include <qbuffer.h>
#include <qhash.h>
#include <qiodevice.h>
#include <qlist.h>
#include <qregexp.h>
#include <qtextcodec.h>
#include <qtextstream.h>
#include <qxml.h>
#include <qvariant.h>
#include <qmap.h>
#include <qshareddata.h>
#include <qdebug.h>
#include <stdio.h>

Go to the source code of this file.

Classes

class  QDomAttrPrivate
 
class  QDomCDATASectionPrivate
 
class  QDomCharacterDataPrivate
 
class  QDomCommentPrivate
 
class  QDomDocumentFragmentPrivate
 
class  QDomDocumentPrivate
 
class  QDomDocumentTypePrivate
 
class  QDomElementPrivate
 
class  QDomEntityPrivate
 
class  QDomEntityReferencePrivate
 
class  QDomHandler
 
class  QDomImplementationPrivate
 
class  QDomNamedNodeMapPrivate
 
class  QDomNodeListPrivate
 
class  QDomNodePrivate
 
class  QDomNotationPrivate
 
class  QDomProcessingInstructionPrivate
 
class  QDomTextPrivate
 

Macros

#define IMPL   ((QDomNodePrivate*)impl)
 
#define IMPL   ((QDomNamedNodeMapPrivate*)impl)
 
#define IMPL   ((QDomDocumentTypePrivate*)impl)
 
#define IMPL   ((QDomCharacterDataPrivate*)impl)
 
#define IMPL   ((QDomAttrPrivate*)impl)
 
#define IMPL   ((QDomElementPrivate*)impl)
 
#define IMPL   ((QDomTextPrivate*)impl)
 
#define IMPL   ((QDomNotationPrivate*)impl)
 
#define IMPL   ((QDomEntityPrivate*)impl)
 
#define IMPL   ((QDomDocumentPrivate*)impl)
 

Functions

static QByteArray encodeEntity (const QByteArray &str)
 
static QString encodeText (const QString &str, QTextStream &s, const bool encodeQuotes=true, const bool performAVN=false, const bool encodeEOLs=false)
 
static QString fixedCDataSection (const QString &data, bool *ok)
 
static QString fixedCharData (const QString &data, bool *ok)
 
static QString fixedComment (const QString &data, bool *ok)
 
static QString fixedPIData (const QString &data, bool *ok)
 
static QString fixedPubidLiteral (const QString &data, bool *ok)
 
static QString fixedSystemLiteral (const QString &data, bool *ok)
 
static QString fixedXmlName (const QString &_name, bool *ok, bool namespaces=false)
 
static void initializeReader (QXmlSimpleReader &reader, bool namespaceProcessing)
 
static void qNormalizeNode (QDomNodePrivate *n)
 
static void qt_split_namespace (QString &prefix, QString &name, const QString &qName, bool hasURI)
 
static QString quotedValue (const QString &data)
 

Variables

bool qt_xml_skipped_entity_in_content
 

Macro Definition Documentation

◆ IMPL [1/10]

#define IMPL   ((QDomNodePrivate*)impl)

Definition at line 6666 of file qdom.cpp.

Referenced by QDomNode::appendChild(), QDomCharacterData::appendData(), QDomNode::cloneNode(), QDomNamedNodeMap::contains(), QDomDocument::createAttribute(), QDomDocument::createAttributeNS(), QDomDocument::createCDATASection(), QDomDocument::createComment(), QDomDocument::createDocumentFragment(), QDomDocument::createElement(), QDomDocument::createElementNS(), QDomDocument::createEntityReference(), QDomDocument::createProcessingInstruction(), QDomDocument::createTextNode(), QDomCharacterData::deleteData(), QDomDocument::doctype(), QDomDocument::documentElement(), QDomNode::firstChild(), QDomNode::hasChildNodes(), QDomDocument::implementation(), QDomDocument::importNode(), QDomNode::insertAfter(), QDomNode::insertBefore(), QDomCharacterData::insertData(), QDomNamedNodeMap::item(), QDomNode::lastChild(), QDomNamedNodeMap::length(), QDomCharacterData::length(), QDomNode::localName(), QDomNamedNodeMap::namedItem(), QDomNamedNodeMap::namedItemNS(), QDomNode::namespaceURI(), QDomNode::nextSibling(), QDomNode::nodeName(), QDomNode::nodeType(), QDomNode::nodeValue(), QDomNode::normalize(), QDomNode::ownerDocument(), QDomNode::parentNode(), QDomNode::prefix(), QDomNode::previousSibling(), QDomNode::removeChild(), QDomNamedNodeMap::removeNamedItem(), QDomNamedNodeMap::removeNamedItemNS(), QDomNode::replaceChild(), QDomCharacterData::replaceData(), QDomNode::save(), QDomDocument::setContent(), QDomNamedNodeMap::setNamedItem(), QDomNamedNodeMap::setNamedItemNS(), QDomNode::setNodeValue(), QDomNode::setPrefix(), QDomAttr::setValue(), QDomAttr::specified(), and QDomCharacterData::substringData().

◆ IMPL [2/10]

#define IMPL   ((QDomNamedNodeMapPrivate*)impl)

Definition at line 6666 of file qdom.cpp.

◆ IMPL [3/10]

#define IMPL   ((QDomDocumentTypePrivate*)impl)

Definition at line 6666 of file qdom.cpp.

◆ IMPL [4/10]

#define IMPL   ((QDomCharacterDataPrivate*)impl)

Definition at line 6666 of file qdom.cpp.

◆ IMPL [5/10]

#define IMPL   ((QDomAttrPrivate*)impl)

Definition at line 6666 of file qdom.cpp.

◆ IMPL [6/10]

#define IMPL   ((QDomElementPrivate*)impl)

Definition at line 6666 of file qdom.cpp.

◆ IMPL [7/10]

#define IMPL   ((QDomTextPrivate*)impl)

Definition at line 6666 of file qdom.cpp.

◆ IMPL [8/10]

#define IMPL   ((QDomNotationPrivate*)impl)

Definition at line 6666 of file qdom.cpp.

◆ IMPL [9/10]

#define IMPL   ((QDomEntityPrivate*)impl)

Definition at line 6666 of file qdom.cpp.

◆ IMPL [10/10]

#define IMPL   ((QDomDocumentPrivate*)impl)

Definition at line 6666 of file qdom.cpp.

Function Documentation

◆ encodeEntity()

static QByteArray encodeEntity ( const QByteArray str)
static

Definition at line 5834 of file qdom.cpp.

5835 {
5836  QByteArray tmp(str);
5837  uint len = tmp.size();
5838  uint i = 0;
5839  const char* d = tmp.data();
5840  while (i < len) {
5841  if (d[i] == '%'){
5842  tmp.replace(i, 1, "&#60;");
5843  d = tmp;
5844  len += 4;
5845  i += 5;
5846  }
5847  else if (d[i] == '"') {
5848  tmp.replace(i, 1, "&#34;");
5849  d = tmp;
5850  len += 4;
5851  i += 5;
5852  } else if (d[i] == '&' && i + 1 < len && d[i+1] == '#') {
5853  // Don't encode &lt; or &quot; or &custom;.
5854  // Only encode character references
5855  tmp.replace(i, 1, "&#38;");
5856  d = tmp;
5857  len += 4;
5858  i += 5;
5859  } else {
5860  ++i;
5861  }
5862  }
5863 
5864  return tmp;
5865 }
double d
Definition: qnumeric_p.h:62
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
unsigned int uint
Definition: qglobal.h:996

◆ encodeText()

static QString encodeText ( const QString str,
QTextStream s,
const bool  encodeQuotes = true,
const bool  performAVN = false,
const bool  encodeEOLs = false 
)
static

Definition at line 4245 of file qdom.cpp.

Referenced by QDomAttrPrivate::save(), and QDomElementPrivate::save().

4250 {
4251 #ifdef QT_NO_TEXTCODEC
4252  Q_UNUSED(s);
4253 #else
4254  const QTextCodec *const codec = s.codec();
4255  Q_ASSERT(codec);
4256 #endif
4257  QString retval(str);
4258  int len = retval.length();
4259  int i = 0;
4260 
4261  while (i < len) {
4262  const QChar ati(retval.at(i));
4263 
4264  if (ati == QLatin1Char('<')) {
4265  retval.replace(i, 1, QLatin1String("&lt;"));
4266  len += 3;
4267  i += 4;
4268  } else if (encodeQuotes && (ati == QLatin1Char('"'))) {
4269  retval.replace(i, 1, QLatin1String("&quot;"));
4270  len += 5;
4271  i += 6;
4272  } else if (ati == QLatin1Char('&')) {
4273  retval.replace(i, 1, QLatin1String("&amp;"));
4274  len += 4;
4275  i += 5;
4276  } else if (ati == QLatin1Char('>') && i >= 2 && retval[i - 1] == QLatin1Char(']') && retval[i - 2] == QLatin1Char(']')) {
4277  retval.replace(i, 1, QLatin1String("&gt;"));
4278  len += 3;
4279  i += 4;
4280  } else if (performAVN &&
4281  (ati == QChar(0xA) ||
4282  ati == QChar(0xD) ||
4283  ati == QChar(0x9))) {
4284  const QString replacement(QLatin1String("&#x") + QString::number(ati.unicode(), 16) + QLatin1Char(';'));
4285  retval.replace(i, 1, replacement);
4286  i += replacement.length();
4287  len += replacement.length() - 1;
4288  } else if (encodeEOLs && ati == QChar(0xD)) {
4289  retval.replace(i, 1, QLatin1String("&#xd;")); // Replace a single 0xD with a ref for 0xD
4290  len += 4;
4291  i += 5;
4292  } else {
4293 #ifndef QT_NO_TEXTCODEC
4294  if(codec->canEncode(ati))
4295  ++i;
4296  else
4297 #endif
4298  {
4299  // We have to use a character reference to get it through.
4300  const ushort codepoint(ati.unicode());
4301  const QString replacement(QLatin1String("&#x") + QString::number(codepoint, 16) + QLatin1Char(';'));
4302  retval.replace(i, 1, replacement);
4303  i += replacement.length();
4304  len += replacement.length() - 1;
4305  }
4306  }
4307  }
4308 
4309  return retval;
4310 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
QString & replace(int i, int len, QChar after)
Definition: qstring.cpp:2005
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
QTextCodec * codec() const
Returns the codec that is current assigned to the stream.
bool canEncode(QChar) const
Returns true if the Unicode character ch can be fully encoded with this codec; otherwise returns fals...
static QTextCodec * codec(MYSQL *mysql)
Definition: qsql_mysql.cpp:220
unsigned short ushort
Definition: qglobal.h:995
The QTextCodec class provides conversions between text encodings.
Definition: qtextcodec.h:62
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ fixedCDataSection()

static QString fixedCDataSection ( const QString data,
bool *  ok 
)
static

Definition at line 753 of file qdom.cpp.

Referenced by QDomDocumentPrivate::createCDATASection().

754 {
756  *ok = true;
757  return data;
758  }
759 
760  QString fixedData = fixedCharData(data, ok);
761  if (!*ok)
762  return QString();
763 
764  for (;;) {
765  int idx = fixedData.indexOf(QLatin1String("]]>"));
766  if (idx == -1)
767  break;
769  *ok = false;
770  return QString();
771  }
772  fixedData.remove(idx, 3);
773  }
774 
775  *ok = true;
776  return fixedData;
777 }
static QString fixedCharData(const QString &data, bool *ok)
Definition: qdom.cpp:699
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
static QDomImplementation::InvalidDataPolicy invalidDataPolicy
Definition: qdom.cpp:132
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867

◆ fixedCharData()

static QString fixedCharData ( const QString data,
bool *  ok 
)
static

Definition at line 699 of file qdom.cpp.

Referenced by QDomDocumentPrivate::createTextNode(), fixedCDataSection(), fixedComment(), and fixedPIData().

700 {
702  *ok = true;
703  return data;
704  }
705 
706  QString result;
707  for (int i = 0; i < data.size(); ++i) {
708  QChar c = data.at(i);
709  if (QXmlUtils::isChar(c)) {
710  result.append(c);
712  *ok = false;
713  return QString();
714  }
715  }
716 
717  *ok = true;
718  return result;
719 }
unsigned char c[8]
Definition: qnumeric_p.h:62
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
static bool isChar(const QChar c)
Determines whether c is a valid instance of production [2]Char in the XML 1.0 specification.
Definition: qxmlutils.cpp:271
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
static const char * data(const QByteArray &arr)
QString & append(QChar c)
Definition: qstring.cpp:1777
static QDomImplementation::InvalidDataPolicy invalidDataPolicy
Definition: qdom.cpp:132

◆ fixedComment()

static QString fixedComment ( const QString data,
bool *  ok 
)
static

Definition at line 724 of file qdom.cpp.

Referenced by QDomDocumentPrivate::createComment().

725 {
727  *ok = true;
728  return data;
729  }
730 
731  QString fixedData = fixedCharData(data, ok);
732  if (!*ok)
733  return QString();
734 
735  for (;;) {
736  int idx = fixedData.indexOf(QLatin1String("--"));
737  if (idx == -1)
738  break;
740  *ok = false;
741  return QString();
742  }
743  fixedData.remove(idx, 2);
744  }
745 
746  *ok = true;
747  return fixedData;
748 }
static QString fixedCharData(const QString &data, bool *ok)
Definition: qdom.cpp:699
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
static QDomImplementation::InvalidDataPolicy invalidDataPolicy
Definition: qdom.cpp:132
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867

◆ fixedPIData()

static QString fixedPIData ( const QString data,
bool *  ok 
)
static

Definition at line 781 of file qdom.cpp.

Referenced by QDomDocumentPrivate::createProcessingInstruction().

782 {
784  *ok = true;
785  return data;
786  }
787 
788  QString fixedData = fixedCharData(data, ok);
789  if (!*ok)
790  return QString();
791 
792  for (;;) {
793  int idx = fixedData.indexOf(QLatin1String("?>"));
794  if (idx == -1)
795  break;
797  *ok = false;
798  return QString();
799  }
800  fixedData.remove(idx, 2);
801  }
802 
803  *ok = true;
804  return fixedData;
805 }
static QString fixedCharData(const QString &data, bool *ok)
Definition: qdom.cpp:699
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
static QDomImplementation::InvalidDataPolicy invalidDataPolicy
Definition: qdom.cpp:132
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867

◆ fixedPubidLiteral()

static QString fixedPubidLiteral ( const QString data,
bool *  ok 
)
static

Definition at line 810 of file qdom.cpp.

Referenced by QDomImplementation::createDocumentType().

811 {
813  *ok = true;
814  return data;
815  }
816 
817  QString result;
818 
819  if(QXmlUtils::isPublicID(data))
820  result = data;
822  *ok = false;
823  return QString();
824  }
825 
826  if (result.indexOf(QLatin1Char('\'')) != -1
827  && result.indexOf(QLatin1Char('"')) != -1) {
829  *ok = false;
830  return QString();
831  } else {
832  result.remove(QLatin1Char('\''));
833  }
834  }
835 
836  *ok = true;
837  return result;
838 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
static QDomImplementation::InvalidDataPolicy invalidDataPolicy
Definition: qdom.cpp:132
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867
static bool isPublicID(const QString &candidate)
Determines whether c is a valid instance of production [12] PubidLiteral in the XML 1...
Definition: qxmlutils.cpp:316
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ fixedSystemLiteral()

static QString fixedSystemLiteral ( const QString data,
bool *  ok 
)
static

Definition at line 843 of file qdom.cpp.

Referenced by QDomImplementation::createDocumentType().

844 {
846  *ok = true;
847  return data;
848  }
849 
850  QString result = data;
851 
852  if (result.indexOf(QLatin1Char('\'')) != -1
853  && result.indexOf(QLatin1Char('"')) != -1) {
855  *ok = false;
856  return QString();
857  } else {
858  result.remove(QLatin1Char('\''));
859  }
860  }
861 
862  *ok = true;
863  return result;
864 }
The QString class provides a Unicode character string.
Definition: qstring.h:83
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
static QDomImplementation::InvalidDataPolicy invalidDataPolicy
Definition: qdom.cpp:132
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
Definition: qstring.cpp:1867
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ fixedXmlName()

static QString fixedXmlName ( const QString _name,
bool *  ok,
bool  namespaces = false 
)
static

Definition at line 645 of file qdom.cpp.

Referenced by QDomDocumentPrivate::createAttribute(), QDomDocumentPrivate::createAttributeNS(), QDomImplementation::createDocumentType(), QDomDocumentPrivate::createElement(), QDomDocumentPrivate::createElementNS(), QDomDocumentPrivate::createEntityReference(), and QDomDocumentPrivate::createProcessingInstruction().

646 {
647  QString name, prefix;
648  if (namespaces)
649  qt_split_namespace(prefix, name, _name, true);
650  else
651  name = _name;
652 
653  if (name.isEmpty()) {
654  *ok = false;
655  return QString();
656  }
657 
659  *ok = true;
660  return _name;
661  }
662 
663  QString result;
664  bool firstChar = true;
665  for (int i = 0; i < name.size(); ++i) {
666  QChar c = name.at(i);
667  if (firstChar) {
668  if (QXmlUtils::isLetter(c) || c.unicode() == '_' || c.unicode() == ':') {
669  result.append(c);
670  firstChar = false;
672  *ok = false;
673  return QString();
674  }
675  } else {
676  if (QXmlUtils::isNameChar(c))
677  result.append(c);
679  *ok = false;
680  return QString();
681  }
682  }
683  }
684 
685  if (result.isEmpty()) {
686  *ok = false;
687  return QString();
688  }
689 
690  *ok = true;
691  if (namespaces && !prefix.isEmpty())
692  return prefix + QLatin1Char(':') + result;
693  return result;
694 }
unsigned char c[8]
Definition: qnumeric_p.h:62
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
ushort unicode() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qchar.h:251
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
static void qt_split_namespace(QString &prefix, QString &name, const QString &qName, bool hasURI)
Definition: qdom.cpp:104
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
static bool isNameChar(const QChar c)
Determines whether c is a valid instance of production [4]NameChar in the XML 1.0 specification...
Definition: qxmlutils.cpp:291
const char * name
QString & append(QChar c)
Definition: qstring.cpp:1777
static bool isLetter(const QChar c)
Determines whether c is a valid instance of production [84]Letter in the XML 1.0 specification.
Definition: qxmlutils.cpp:256
static QDomImplementation::InvalidDataPolicy invalidDataPolicy
Definition: qdom.cpp:132
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ initializeReader()

static void initializeReader ( QXmlSimpleReader reader,
bool  namespaceProcessing 
)
static

Definition at line 6360 of file qdom.cpp.

Referenced by QDomDocument::setContent(), and QDomDocumentPrivate::setContent().

6361 {
6362  reader.setFeature(QLatin1String("http://xml.org/sax/features/namespaces"), namespaceProcessing);
6363  reader.setFeature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"), !namespaceProcessing);
6364  reader.setFeature(QLatin1String("http://trolltech.com/xml/features/report-whitespace-only-CharData"), false); // Shouldn't change in Qt 4
6365 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void setFeature(const QString &name, bool value)
Turns on the feature name if enable is true; otherwise turns it off.
Definition: qxml.cpp:3517

◆ qNormalizeNode()

static void qNormalizeNode ( QDomNodePrivate n)
static

Definition at line 1913 of file qdom.cpp.

Referenced by QDomNodePrivate::normalize().

1914 {
1915  QDomNodePrivate* p = n->first;
1916  QDomTextPrivate* t = 0;
1917 
1918  while (p) {
1919  if (p->isText()) {
1920  if (t) {
1921  QDomNodePrivate* tmp = p->next;
1922  t->appendData(p->nodeValue());
1923  n->removeChild(p);
1924  p = tmp;
1925  } else {
1926  t = (QDomTextPrivate*)p;
1927  p = p->next;
1928  }
1929  } else {
1930  p = p->next;
1931  t = 0;
1932  }
1933  }
1934 }
virtual bool isText() const
Definition: qdom.cpp:177
QString nodeValue() const
Definition: qdom.cpp:143
QDomNodePrivate * next
Definition: qdom.cpp:193
QDomNodePrivate * first
Definition: qdom.cpp:195
virtual QDomNodePrivate * removeChild(QDomNodePrivate *oldChild)
Definition: qdom.cpp:1851
void appendData(const QString &arg)
Definition: qdom.cpp:4012

◆ qt_split_namespace()

static void qt_split_namespace ( QString prefix,
QString name,
const QString qName,
bool  hasURI 
)
static

Definition at line 104 of file qdom.cpp.

Referenced by fixedXmlName(), QDomAttrPrivate::QDomAttrPrivate(), QDomElementPrivate::QDomElementPrivate(), and QDomElementPrivate::setAttributeNS().

105 {
106  int i = qName.indexOf(QLatin1Char(':'));
107  if (i == -1) {
108  if (hasURI)
109  prefix = QLatin1String("");
110  else
111  prefix.clear();
112  name = qName;
113  } else {
114  prefix = qName.left(i);
115  name = qName.mid(i + 1);
116  }
117 }
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
void clear()
Clears the contents of the string and makes it empty.
Definition: qstring.h:723
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ quotedValue()

static QString quotedValue ( const QString data)
static

Definition at line 3656 of file qdom.cpp.

Referenced by QTestXunitStreamer::formatAttributes(), QDomDocumentTypePrivate::save(), QDomNotationPrivate::save(), and QDomEntityPrivate::save().

3657 {
3658  QChar quote = data.indexOf(QLatin1Char('\'')) == -1
3659  ? QLatin1Char('\'')
3660  : QLatin1Char('"');
3661  return quote + data + quote;
3662 }
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

Variable Documentation

◆ qt_xml_skipped_entity_in_content

bool qt_xml_skipped_entity_in_content