49 template<
typename TokenLookupClass,
55 , m_hasHandledStandardAttributes(false)
57 , m_elementDescriptions(elementDescriptions)
58 , m_standardAttributes(standardAttributes)
61 Q_ASSERT(!m_elementDescriptions.isEmpty());
64 m_stripWhitespace.push(
true);
67 template<
typename TokenLookupClass,
73 template<
typename TokenLookupClass,
82 template<
typename TokenLookupClass,
92 m_currentElementName = TokenLookupClass::toToken(
name());
93 m_currentAttributes = attributes();
94 m_hasHandledStandardAttributes =
false;
96 if(!m_currentAttributes.hasAttribute(
QLatin1String(
"xml:space")))
97 m_stripWhitespace.push(m_stripWhitespace.top());
101 m_currentElementName = TokenLookupClass::toToken(
name());
102 m_stripWhitespace.pop();
111 template<
typename TokenLookupClass,
116 || XPathHelper::isWhitespaceOnly(
text());
120 template<
typename TokenLookupClass,
125 m_context->error(message, code, currentLocation());
128 template<
typename TokenLookupClass,
132 m_context->
warning(message, currentLocation());
135 template<
typename TokenLookupClass,
139 return m_currentElementName;
142 template<
typename TokenLookupClass,
148 if(m_elementDescriptions.contains(elementName))
152 const int attCount = m_currentAttributes.count();
156 for(
int i = 0; i < attCount; ++i)
161 const typename TokenLookupClass::NodeName attrName(TokenLookupClass::toToken(attr.
name()));
162 encounteredXSLTAtts.
insert(attrName);
166 !m_standardAttributes.contains(attrName) &&
167 !isAnyAttributeAllowed())
172 const int totalCount =
all.count();
175 for(
int i = 0; i < totalCount; ++i)
184 translationString = QtXmlPatterns::tr(
"Attribute %1 cannot appear on the element %2. Only the standard attributes can appear.")
188 else if(totalCount == 1)
190 translationString = QtXmlPatterns::tr(
"Attribute %1 cannot appear on the element %2. Only %3 is allowed, and the standard attributes.")
195 else if(totalCount == 1)
198 translationString = QtXmlPatterns::tr(
"Attribute %1 cannot appear on the element %2. Allowed is %3, %4, and the standard attributes.")
207 translationString = QtXmlPatterns::tr(
"Attribute %1 cannot appear on the element %2. Allowed is %3, and the standard attributes.")
213 m_context->error(translationString,
214 ReportContext::XTSE0090,
220 m_context->error(QtXmlPatterns::tr(
"XSL-T attributes on XSL-T elements must be in the null namespace, not in the XSL-T namespace which %1 is.")
222 ReportContext::XTSE0090,
230 if(!requiredButMissing.isEmpty())
232 error(QtXmlPatterns::tr(
"The attribute %1 must appear on element %2.")
235 ReportContext::XTSE0010);
240 error(QtXmlPatterns::tr(
"The element with local name %1 does not exist in XSL-T.").arg(
formatKeyword(
name())),
241 ReportContext::XTSE0010);
245 template<
typename TokenLookupClass,
248 const QString &localName)
const 251 return m_currentAttributes.hasAttribute(namespaceURI, localName);
254 template<
typename TokenLookupClass,
258 return hasAttribute(
QString(), localName);
261 template<
typename TokenLookupClass,
264 const QString &namespaceURI)
const 268 Q_ASSERT_X(m_currentAttributes.hasAttribute(namespaceURI, localName),
270 "Validation must be done before this function is called.");
272 return m_currentAttributes.value(namespaceURI, localName).toString();
void warning(const QString &message) const
Convenience function for calling ReportContext::warning().
QString toString() const
Returns a copy of the string reference as a QString object.
QString formatKeyword(const QString &keyword)
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
static bool isWhitespace(char c)
The QString class provides a Unicode character string.
The QHash class is a template class that provides a hash-table-based dictionary.
TokenType
This enum specifies the type of token the reader just read.
The QXmlStreamAttribute class represents a single XML attribute.
static QString toString(Register *reg, int type, bool *ok=0)
void append(const T &t)
Inserts value at the end of the list.
bool contains(const T &value) const
QList< T > toList() const
The QStringList class provides a list of strings.
bool isEmpty() const
Returns true if the string reference has no characters; otherwise returns false.
const_iterator insert(const T &value)
The QSourceLocation class identifies a location in a resource by URI, line, and column.
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
QStringRef name() const
Returns the attribute's local name.
Base class for tokenizers that reads XML formats. This is XSLTTokenizer, and the W3C XML Schema parse...
QSet< T > & subtract(const QSet< T > &other)
TokenType readNext()
Reads the next token and returns its type.
T & first()
Returns a reference to the first item in the list.
QString join(const QString &sep) const
Joins all the string list's strings into a single string with each element separated by the given sep...
#define Q_ASSERT_X(cond, where, what)
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
T & last()
Returns a reference to the last item in the list.
bool isWhitespace() const
Returns true if the reader reports characters that only consist of white-space; otherwise returns fal...
QSet< typename TokenLookupClass::NodeName > requiredAttributes
QSet< typename TokenLookupClass::NodeName > optionalAttributes
The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming ...
A structure that lists the optional and required attributes of an element. Used with MaintainingReade...
The QIODevice class is the base interface class of all I/O devices in Qt.
The QList class is a template class that provides lists.
QStringRef namespaceUri() const
Returns the attribute's resolved namespaceUri, or an empty string reference if the attribute does not...