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:55:30 UTC
svn commit: r432682 - in /incubator/tuscany/cpp/sdo/runtime/core:
src/commonj/sdo/SDOSchemaSAX2Parser.cpp test/maintest.txt test/sdotest.cpp
Author: robbinspg
Date: Fri Aug 18 11:55:30 2006
New Revision: 432682
URL: http://svn.apache.org/viewvc?rev=432682&view=rev
Log:
TUSCANY-625 fix up test case
Modified:
incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
incubator/tuscany/cpp/sdo/runtime/core/test/maintest.txt
incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.cpp
Modified: incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp?rev=432682&r1=432681&r2=432682&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/src/commonj/sdo/SDOSchemaSAX2Parser.cpp Fri Aug 18 11:55:30 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;
@@ -606,7 +607,13 @@
if (!bInSchema) return;
+ SchemaInfo schemaInf;
+ SDOSchemaSAX2Parser schemaParser(schemaInf, (ParserErrorSetter*)setter);
+
+ TypeDefinitionsImpl* typedefs;
+
SDOXMLString schemaLocation = attributes.getValue("schemaLocation");
+ SDOXMLString importNamespace = attributes.getValue("namespace");
if (!schemaLocation.isNull())
{
if (startSecondaryParse(schemaParser,schemaLocation) == 0)
@@ -616,22 +623,80 @@
return;
}
+ typedefs = &schemaParser.getTypeDefinitions();
+
+ }
+ else
+ {
+ // schemaLocation isn't present. Try loading namespace for import
+ if (loadImportNamespace
+ && localname.equalsIgnoreCase("import")
+ && !importNamespace.isNull())
+ {
+ try
+ {
+ SDOSchemaSAX2Parser sp(schemaInf, 0);
- TypeDefinitionsImpl& typedefs = schemaParser.getTypeDefinitions();
- XMLDAS_TypeDefs types = typedefs.types;
+ sp.parse(importNamespace);
+ typedefs = &sp.getTypeDefinitions();
+ }
+ catch (SDORuntimeException&)
+ {
+ return;
+ }
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ XMLDAS_TypeDefs types = typedefs->types;
XMLDAS_TypeDefs::iterator iter;
for (iter=types.begin(); iter != types.end(); iter++)
{
if ((*iter).second.name.equals("RootType")
- {
+ && currentType.name.equals("RootType")
+ && (*iter).second.uri.equals(currentType.uri))
+ {
// This must be true for an import/include to be
+ // legally positioned
+
+ XMLDAS_TypeDefs::iterator find = typeDefinitions.types.find(
+ (*iter).first);
+
+ std::list<PropertyDefinitionImpl>::iterator propit;
+ std::list<PropertyDefinitionImpl>::iterator currpropit;
+ bool found;
+
+ for (propit = (*iter).second.properties.begin() ;
+ propit != (*iter).second.properties.end(); ++ propit)
+ {
+ found = false;
+ // do not merge properties whose names clash
+ for ( currpropit = currentType.properties.begin();
+ currpropit != currentType.properties.end();
+ ++currpropit)
+ {
+ if ((*currpropit).name.equals((*propit).name))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ currentType.properties.insert(
+ currentType.properties.end(),*propit);
+ }
}
+ }
else
{
typeDefinitions.types.insert(*iter);
}
}
- }
+
}
Modified: incubator/tuscany/cpp/sdo/runtime/core/test/maintest.txt
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/maintest.txt?rev=432682&r1=432681&r2=432682&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/maintest.txt (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/maintest.txt Fri Aug 18 11:55:30 2006
@@ -53,7 +53,7 @@
Type Manager
Has Property name of type String
Has Property officeid of type String
-Has Property string of type String
+Has Property str of type String
Has Property boolean of type Boolean
Has Property byte of type Byte
Has Property character of type Character
@@ -115,7 +115,7 @@
Has Property name of type String
Has Property name of type String
Has Property officeid of type String
-Has Property string of type String
+Has Property str of type String
Has Property boolean of type Boolean
Has Property byte of type Byte
Has Property character of type Character
Modified: incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.cpp
URL: http://svn.apache.org/viewvc/incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.cpp?rev=432682&r1=432681&r2=432682&view=diff
==============================================================================
--- incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.cpp (original)
+++ incubator/tuscany/cpp/sdo/runtime/core/test/sdotest.cpp Fri Aug 18 11:55:30 2006
@@ -2332,7 +2332,7 @@
*/
/* Now add a primitive type test to the manager */
- mdg->addPropertyToType(tm,"string",ts);
+ mdg->addPropertyToType(tm,"str",ts);
fprintf(f, "Manager is sequenced?%d\n",tm.isSequencedType());
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org