You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ro...@apache.org on 2006/08/18 20:44:07 UTC
svn commit: r432673 - in /incubator/tuscany:
cpp/sdo/runtime/core/src/commonj/sdo/
sandbox/robbinspg/sdo/runtime/core/src/commonj/sdo/
Author: robbinspg
Date: Fri Aug 18 11:44:06 2006
New Revision: 432673
URL: http://svn.apache.org/viewvc?rev=432673&view=rev
Log:
TUSCANY-625 allow control of import namespace="..."
Modified:
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h
incubator/tuscany/sandbox/robbinspg/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.h?rev=432673&r1=432672&r2=432673&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.h Fri Aug 18 11:44:06 2006
@@ -49,7 +49,8 @@
public:
SDOSchemaSAX2Parser(SchemaInfo& schemaInfo,
- ParserErrorSetter* insetter);
+ ParserErrorSetter* insetter,
+ bool loadImportNamespace = false);
virtual ~SDOSchemaSAX2Parser();
@@ -224,6 +225,7 @@
TypeDefinitionsImpl typeDefinitions;
+ bool loadImportNamespace;
};
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h?rev=432673&r1=432672&r2=432673&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelper.h Fri Aug 18 11:44:06 2006
@@ -51,9 +51,9 @@
*
*/
- SDO_API virtual const char* defineFile(const char* schemaFile) = 0;
- SDO_API virtual const char* define(std::istream& schema) = 0;
- SDO_API virtual const char* define(const char* schema) = 0;
+ SDO_API virtual const char* defineFile(const char* schemaFile, bool loadImportNamespace = false) = 0;
+ SDO_API virtual const char* define(std::istream& schema, bool loadImportNamespace = false) = 0;
+ SDO_API virtual const char* define(const char* schema, bool loadImportNamespace = false) = 0;
/** generate buildsXSD from types/properties
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp?rev=432673&r1=432672&r2=432673&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.cpp Fri Aug 18 11:44:06 2006
@@ -75,10 +75,10 @@
*
*/
- const char* XSDHelperImpl::defineFile(const char* schema)
+ const char* XSDHelperImpl::defineFile(const char* schema, bool loadImportNamespace)
{
- SDOSchemaSAX2Parser schemaParser(schemaInfo, this);
+ SDOSchemaSAX2Parser schemaParser(schemaInfo, this, loadImportNamespace);
clearErrors();
if (schemaParser.parse(schema) == 0)
{
@@ -88,19 +88,19 @@
return 0;
}
- const char* XSDHelperImpl::define(std::istream& schema)
+ const char* XSDHelperImpl::define(std::istream& schema, bool loadImportNamespace)
{
- SDOSchemaSAX2Parser schemaParser(schemaInfo, this);
+ SDOSchemaSAX2Parser schemaParser(schemaInfo, this, loadImportNamespace);
clearErrors();
schema >> schemaParser;
defineTypes(schemaParser.getTypeDefinitions());
return schemaInfo.getTargetNamespaceURI();
}
- const char* XSDHelperImpl::define(const char* schema)
+ const char* XSDHelperImpl::define(const char* schema, bool loadImportNamespace)
{
std::istringstream str(schema);
- SDOSchemaSAX2Parser schemaParser(schemaInfo, this);
+ SDOSchemaSAX2Parser schemaParser(schemaInfo, this, loadImportNamespace);
clearErrors();
str >> schemaParser;
defineTypes(schemaParser.getTypeDefinitions());
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h?rev=432673&r1=432672&r2=432673&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/XSDHelperImpl.h Fri Aug 18 11:44:06 2006
@@ -62,9 +62,9 @@
* The return value is the URI of the root Type
*
*/
- virtual const char* defineFile(const char* schemaFile);
- virtual const char* define(std::istream& schema);
- virtual const char* define(const char* schema);
+ virtual const char* defineFile(const char* schemaFile, bool loadImportNamespace = false);
+ virtual const char* define(std::istream& schema, bool loadImportNamespace = false);
+ virtual const char* define(const char* schema, bool loadImportNamespace = false);
/** getErrorCount gets number of parse errors
*
Modified: incubator/tuscany/sandbox/robbinspg/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/robbinspg/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp?rev=432673&r1=432672&r2=432673&view=diff
==============================================================================
--- incubator/tuscany/sandbox/robbinspg/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp (original)
+++ incubator/tuscany/sandbox/robbinspg/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp Fri Aug 18 11:44:06 2006
@@ -37,8 +37,9 @@
{
SDOSchemaSAX2Parser::SDOSchemaSAX2Parser(SchemaInfo& schemaInf,
- ParserErrorSetter* insetter)
- : schemaInfo(schemaInf) ,SAX2Parser(insetter)
+ ParserErrorSetter* insetter,
+ bool loadImpNamespace)
+ : schemaInfo(schemaInf), SAX2Parser(insetter), loadImportNamespace(loadImpNamespace)
{
bInSchema = false;
bInvalidElement = false;
@@ -608,6 +609,8 @@
SchemaInfo schemaInf;
SDOSchemaSAX2Parser schemaParser(schemaInf, (ParserErrorSetter*)setter);
+
+ TypeDefinitionsImpl* typedefs;
SDOXMLString schemaLocation = attributes.getValue("schemaLocation");
SDOXMLString importNamespace = attributes.getValue("namespace");
@@ -619,16 +622,23 @@
// we were not able to start the parse
return;
}
+
+ typedefs = &schemaParser.getTypeDefinitions();
+
}
else
{
// schemaLocation isn't present. Try loading namespace for import
- if (localname.equalsIgnoreCase("import")
+ if (loadImportNamespace
+ && localname.equalsIgnoreCase("import")
&& !importNamespace.isNull())
{
try
{
- schemaParser.parse(importNamespace);
+ SDOSchemaSAX2Parser sp(schemaInf, 0);
+
+ sp.parse(importNamespace);
+ typedefs = &sp.getTypeDefinitions();
}
catch (SDORuntimeException&)
{
@@ -641,9 +651,7 @@
}
}
-
- TypeDefinitionsImpl& typedefs = schemaParser.getTypeDefinitions();
- XMLDAS_TypeDefs types = typedefs.types;
+ XMLDAS_TypeDefs types = typedefs->types;
XMLDAS_TypeDefs::iterator iter;
for (iter=types.begin(); iter != types.end(); iter++)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org