48 template <
bool FromDocument>
53 Features features) : m_preNumber(-1)
54 , m_isPreviousAtomic(false)
55 , m_hasCharacters(false)
56 , m_isCharactersCompressed(false)
58 , m_document(new
AccelTree(docURI, baseURI))
59 , m_skippedDocumentNodes(0)
60 , m_documentURI(docURI)
62 , m_features(features)
68 m_ancestors.reserve(DefaultNodeStackSize);
71 m_size.reserve(DefaultNodeStackSize);
75 template <
bool FromDocument>
88 m_isCharactersCompressed ? AccelTree::IsCompressed : 0));
89 m_document->data.insert(m_preNumber, m_characters);
93 m_hasCharacters =
false;
95 if(m_isCharactersCompressed)
96 m_isCharactersCompressed =
false;
100 template <
bool FromDocument>
107 if(m_isPreviousAtomic)
114 m_isPreviousAtomic =
true;
120 m_hasCharacters =
true;
128 template <
bool FromDocument>
131 startElement(name, 1, 1);
134 template <
bool FromDocument>
140 m_document->basicData.append(data);
141 if (m_features & SourceLocationsFeature)
142 m_document->sourcePositions.insert(m_document->maximumPreNumber(),
qMakePair(line, column));
145 m_ancestors.push(m_preNumber);
159 m_isPreviousAtomic =
false;
162 template <
bool FromDocument>
171 m_size[m_size.count() - 2] += m_size.top();
174 m_isPreviousAtomic =
false;
177 template <
bool FromDocument>
191 m_isPreviousAtomic =
false;
201 const int oldSize = m_document->m_IDs.
count();
202 m_document->m_IDs.insert(
id, currentParent());
206 m_document->data.insert(m_preNumber, normalized);
213 if(oldSize == m_document->m_IDs.count() && m_context)
216 m_context->error(QtXmlPatterns::tr(
"An %1-attribute with value %2 has already been declared.")
219 FromDocument ? ReportContext::FODC0002 : ReportContext::XQDY0091,
229 m_context->error(QtXmlPatterns::tr(
"An %1-attribute must have a " 230 "valid %2 as value, which %3 isn't.").arg(
formatKeyword(
"xml:id"),
231 formatType(m_namePool, BuiltinTypes::xsNCName),
233 FromDocument ? ReportContext::FODC0002 : ReportContext::XQDY0091,
238 m_document->data.insert(m_preNumber, *m_attributeCompress.insert(value.
toString()));
241 template <
bool FromDocument>
251 if(m_hasCharacters && m_isCharactersCompressed)
253 m_characters = CompressedWhitespace::decompress(m_characters);
254 m_isCharactersCompressed =
false;
259 m_isPreviousAtomic =
false;
260 m_hasCharacters = !m_characters.
isEmpty() || m_preNumber == -1;
263 template <
bool FromDocument>
278 if(m_isCharactersCompressed)
280 m_characters = CompressedWhitespace::decompress(m_characters);
281 m_isCharactersCompressed =
false;
289 m_characters = CompressedWhitespace::compress(ch);
290 m_isCharactersCompressed =
true;
291 m_isPreviousAtomic =
false;
292 m_hasCharacters =
true;
296 template <
bool FromDocument>
302 m_document->data.insert(m_preNumber, data);
310 m_isPreviousAtomic =
false;
313 template <
bool FromDocument>
319 m_document->data.insert(m_preNumber, content);
323 template <
bool FromDocument>
338 if(nb.
prefix() == StandardPrefixes::xml)
342 const int len = nss.
count();
343 for(
int i = 0; i < len; ++i)
352 template <
bool FromDocument>
356 if(m_preNumber == -1)
361 m_ancestors.push(m_preNumber);
364 ++m_skippedDocumentNodes;
366 m_isPreviousAtomic =
false;
369 template <
bool FromDocument>
372 if(m_skippedDocumentNodes == 0)
383 m_document->basicData.first().setSize(m_size.pop());
387 --m_skippedDocumentNodes;
389 m_isPreviousAtomic =
false;
392 template <
bool FromDocument>
399 template <
bool FromDocument>
404 m_document->printStats(m_namePool);
409 template <
bool FromDocument>
416 template <
bool FromDocument>
421 template <
bool FromDocument>
426 template <
bool FromDocument>
432 template <
bool FromDocument>
435 if(m_documentURI.isEmpty())
The QVariant class acts like a union for the most common Qt data types.
QString toString() const
Returns a copy of the string reference as a QString object.
NamespaceCode LocalNameCode
QString formatKeyword(const QString &keyword)
#define it(className, varName)
int count(const T &t) const
Returns the number of occurrences of value in the vector.
QString formatType(const NamePool::Ptr &np, const T &type)
Formats ItemType and SequenceType.
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
Builds an AccelTree from a stream of XML/Item events received through the NodeBuilder interface...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QUrl class provides a convenient interface for working with URLs.
The QString class provides a Unicode character string.
QString prefix(const QXmlNamePool &query) const
Returns the prefix.
bool hasPrefix() const
Returns true if this QXmlName has a non-empty prefix.
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void append(const T &t)
Inserts value at the end of the vector.
bool isEmpty() const
Returns true if the string reference has no characters; otherwise returns false.
The QSourceLocation class identifies a location in a resource by URI, line, and column.
QString stringValue() const
Returns the string value of this Item.
static const char * data(const QByteArray &arr)
static QString formatData(const QString &data)
The QStringRef class provides a thin wrapper around QString substrings.
const T & at(int i) const
Returns the item at index position i in the vector.
QString localName(const QXmlNamePool &query) const
Returns the local name.
NamespaceCode namespaceURI() const
bool isAtomicValue() const
Determines whether this item is an atomic value, or a node.
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
Represents an item in the XPath 2.0 Data Model.
Stores an XML document using the XPath Accelerator scheme, also known as pre/post numbering...
QString simplified() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end, and that has each sequence o...
Q_OUTOFLINE_TEMPLATE QPair< T1, T2 > qMakePair(const T1 &x, const T2 &y)
Houses data for a node, and that all node kinds have.
A callback for reporting errors.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static bool isNCName(const QStringRef &ncName)
Determines whether c is a valid instance of production [4]NCName in the XML 1.0 Namespaces specificat...
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void setSize(const PreNumber aSize)
Base class for all instances that represents something at a certain location.