Qt 4.8
Classes | Namespaces | Functions
qxsdschemaparser.cpp File Reference
#include "qxsdschemaparser_p.h"
#include "private/qxmlutils_p.h"
#include "qacceltreeresourceloader_p.h"
#include "qautoptr_p.h"
#include "qboolean_p.h"
#include "qcommonnamespaces_p.h"
#include "qderivedinteger_p.h"
#include "qderivedstring_p.h"
#include "qqnamevalue_p.h"
#include "qxmlquery_p.h"
#include "qxpathhelper_p.h"
#include "qxsdattributereference_p.h"
#include "qxsdreference_p.h"
#include "qxsdschematoken_p.h"
#include <QtCore/QFile>
#include <QtXmlPatterns/QXmlQuery>

Go to the source code of this file.

Classes

class  QPatternist::ElementNamespaceHandler
 A helper class for automatically handling namespace scopes of elements. More...
 
class  QPatternist::TagValidationHandler
 

Namespaces

 QPatternist
 The namespace for the internal API of QtXmlPatterns.
 

Functions

static XsdParticle::List collectGroupRef (const XsdModelGroup::Ptr &group)
 
static bool isValidUri (const QString &string)
 

Function Documentation

◆ collectGroupRef()

static XsdParticle::List collectGroupRef ( const XsdModelGroup::Ptr group)
static

Returns a list of all particles with group references that appear at any level of the given unresolved group.

Definition at line 215 of file qxsdschemaparser.cpp.

Referenced by QPatternist::XsdSchemaParser::parseRedefine().

216 {
217  XsdParticle::List refParticles;
218 
219  XsdParticle::List particles = group->particles();
220  for (int i = 0; i < particles.count(); ++i) {
221  if (particles.at(i)->term()->isReference()) {
222  const XsdReference::Ptr reference(particles.at(i)->term());
223  if (reference->type() == XsdReference::ModelGroup)
224  refParticles.append(particles.at(i));
225  }
226  if (particles.at(i)->term()->isModelGroup()) {
227  refParticles << collectGroupRef(XsdModelGroup::Ptr(particles.at(i)->term()));
228  }
229  }
230 
231  return refParticles;
232 }
XsdTerm::Ptr term() const
The QExplicitlySharedDataPointer class represents a pointer to an explicitly shared object...
Definition: qshareddata.h:136
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
static XsdParticle::List collectGroupRef(const XsdModelGroup::Ptr &group)
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
XsdParticle::List particles() const
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
virtual bool isReference() const
Definition: qxsdterm.cpp:63
virtual bool isModelGroup() const
Definition: qxsdterm.cpp:53

◆ isValidUri()

static bool isValidUri ( const QString string)
inlinestatic

Helper function that works around the limited facilities of QUrl/AnyURI::fromLexical to detect invalid URIs

Definition at line 238 of file qxsdschemaparser.cpp.

Referenced by QPatternist::XsdSchemaParser::parseAny(), QPatternist::XsdSchemaParser::parseAnyAttribute(), QPatternist::XsdSchemaParser::parseAppInfo(), QPatternist::XsdSchemaParser::parseDocumentation(), QPatternist::XsdSchemaParser::parseNotation(), QPatternist::XsdSchemaParser::parseSchema(), and QPatternist::XsdSchemaParser::readXPathExpression().

239 {
240  // an empty URI points to the current document as defined in RFC 2396 (4.2)
241  if (string.isEmpty())
242  return true;
243 
244  // explicit check as that is not checked by the code below
245  if (string.startsWith(QLatin1String("##")))
246  return false;
247 
248  const AnyURI::Ptr uri = AnyURI::fromLexical(string);
249  return (!(uri->hasError()));
250 }
virtual bool hasError() const
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
static bool isEmpty(const char *str)