summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-08 19:52:22 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-08 19:52:22 (GMT)
commit780ee7c209c33490a5f77306880c8cd8bd0e82a6 (patch)
tree2f7bcec390b914a6c6ef0106102ac0c48189dd45 /src
parente41737d36419e775f602544b2b0e8b9e96f75361 (diff)
parentdb20aff5bf81a6a935fbb89bf103351dc7a9215d (diff)
downloadQt-780ee7c209c33490a5f77306880c8cd8bd0e82a6.zip
Qt-780ee7c209c33490a5f77306880c8cd8bd0e82a6.tar.gz
Qt-780ee7c209c33490a5f77306880c8cd8bd0e82a6.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: QXmlSchema internals: include/import/redefine schemas only once
Diffstat (limited to 'src')
-rw-r--r--src/xmlpatterns/schema/qxsdschemaparser.cpp48
-rw-r--r--src/xmlpatterns/schema/qxsdschemaparser_p.h22
2 files changed, 64 insertions, 6 deletions
diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp
index 6ed28af..fd0b95c 100644
--- a/src/xmlpatterns/schema/qxsdschemaparser.cpp
+++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp
@@ -264,16 +264,31 @@ XsdSchemaParser::XsdSchemaParser(const XsdSchemaContext::Ptr &context, const Xsd
setupBuiltinTypeNames();
}
+void XsdSchemaParser::addIncludedSchemas(const NamespaceSet &schemas)
+{
+ m_includedSchemas += schemas;
+}
+
void XsdSchemaParser::setIncludedSchemas(const NamespaceSet &schemas)
{
m_includedSchemas = schemas;
}
+void XsdSchemaParser::addImportedSchemas(const NamespaceSet &schemas)
+{
+ m_importedSchemas += schemas;
+}
+
void XsdSchemaParser::setImportedSchemas(const NamespaceSet &schemas)
{
m_importedSchemas = schemas;
}
+void XsdSchemaParser::addRedefinedSchemas(const NamespaceSet &schemas)
+{
+ m_redefinedSchemas += schemas;
+}
+
void XsdSchemaParser::setRedefinedSchemas(const NamespaceSet &schemas)
{
m_redefinedSchemas = schemas;
@@ -297,6 +312,7 @@ void XsdSchemaParser::setDocumentURI(const QUrl &uri)
// prevent to get included/imported/redefined twice
m_includedSchemas.insert(uri);
m_importedSchemas.insert(uri);
+ m_redefinedSchemas.insert(uri);
}
QUrl XsdSchemaParser::documentURI() const
@@ -594,8 +610,14 @@ void XsdSchemaParser::parseInclude()
parser.setIncludedSchemas(m_includedSchemas);
parser.setImportedSchemas(m_importedSchemas);
parser.setRedefinedSchemas(m_redefinedSchemas);
- if (!parser.parse(XsdSchemaParser::IncludeParser))
+ if (!parser.parse(XsdSchemaParser::IncludeParser)) {
return;
+ } else {
+ // add indirectly loaded schemas to the list of already loaded ones
+ addIncludedSchemas(parser.m_includedSchemas);
+ addImportedSchemas(parser.m_importedSchemas);
+ addRedefinedSchemas(parser.m_redefinedSchemas);
+ }
}
}
@@ -684,8 +706,14 @@ void XsdSchemaParser::parseImport()
parser.setIncludedSchemas(m_includedSchemas);
parser.setImportedSchemas(m_importedSchemas);
parser.setRedefinedSchemas(m_redefinedSchemas);
- if (!parser.parse(XsdSchemaParser::ImportParser))
+ if (!parser.parse(XsdSchemaParser::ImportParser)) {
return;
+ } else {
+ // add indirectly loaded schemas to the list of already loaded ones
+ addIncludedSchemas(parser.m_includedSchemas);
+ addImportedSchemas(parser.m_importedSchemas);
+ addRedefinedSchemas(parser.m_redefinedSchemas);
+ }
}
}
} else {
@@ -702,8 +730,14 @@ void XsdSchemaParser::parseImport()
parser.setIncludedSchemas(m_includedSchemas);
parser.setImportedSchemas(m_importedSchemas);
parser.setRedefinedSchemas(m_redefinedSchemas);
- if (!parser.parse(XsdSchemaParser::ImportParser))
+ if (!parser.parse(XsdSchemaParser::ImportParser)) {
return;
+ } else {
+ // add indirectly loaded schemas to the list of already loaded ones
+ addIncludedSchemas(parser.m_includedSchemas);
+ addImportedSchemas(parser.m_importedSchemas);
+ addRedefinedSchemas(parser.m_redefinedSchemas);
+ }
}
}
} else {
@@ -839,8 +873,14 @@ void XsdSchemaParser::parseRedefine()
parser.setIncludedSchemas(m_includedSchemas);
parser.setImportedSchemas(m_importedSchemas);
parser.setRedefinedSchemas(m_redefinedSchemas);
- if (!parser.parse(XsdSchemaParser::RedefineParser))
+ if (!parser.parse(XsdSchemaParser::RedefineParser)) {
return;
+ } else {
+ // add indirectly loaded schemas to the list of already loaded ones
+ addIncludedSchemas(parser.m_includedSchemas);
+ addImportedSchemas(parser.m_importedSchemas);
+ addRedefinedSchemas(parser.m_redefinedSchemas);
+ }
delete reply;
}
diff --git a/src/xmlpatterns/schema/qxsdschemaparser_p.h b/src/xmlpatterns/schema/qxsdschemaparser_p.h
index ad5e9ce..80d44a5 100644
--- a/src/xmlpatterns/schema/qxsdschemaparser_p.h
+++ b/src/xmlpatterns/schema/qxsdschemaparser_p.h
@@ -120,20 +120,38 @@ namespace QPatternist
typedef QSet<QUrl> NamespaceSet;
/**
+ * Adds @p schemas to the list of already included schemas, so the parser
+ * can detect multiple includes of the same schema.
+ */
+ void addIncludedSchemas(const NamespaceSet &schemas);
+
+ /**
* Sets which @p schemas have been included already, so the parser
- * can detect circular includes.
+ * can detect multiple includes of the same schema.
*/
void setIncludedSchemas(const NamespaceSet &schemas);
/**
+ * Adds @p schemas to the list of already imported schemas, so the parser
+ * can detect multiple imports of the same schema.
+ */
+ void addImportedSchemas(const NamespaceSet &schemas);
+
+ /**
* Sets which @p schemas have been imported already, so the parser
* can detect circular imports.
*/
void setImportedSchemas(const NamespaceSet &schemas);
/**
+ * Adds @p schemas to the list of already redefined schemas, so the parser
+ * can detect multiple redefines of the same schema.
+ */
+ void addRedefinedSchemas(const NamespaceSet &schemas);
+
+ /**
* Sets which @p schemas have been redefined already, so the parser
- * can detect circular redefines.
+ * can detect multiple redefines of the same schema.
*/
void setRedefinedSchemas(const NamespaceSet &schemas);