← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug1023120-schemaImport into lp:zorba

 

Cezar Andrei has proposed merging lp:~zorba-coders/zorba/bug1023120-schemaImport into lp:zorba.

Requested reviews:
  Zorba Coders (zorba-coders)
Related bugs:
  Bug #1023120 in Zorba: "xs:include ignored in schemas"
  https://bugs.launchpad.net/zorba/+bug/1023120

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug1023120-schemaImport/+merge/114712

Fix for bug 1023120 xs:include ignored in schemas.
Added a new test for this case.
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug1023120-schemaImport/+merge/114712
Your team Zorba Coders is requested to review the proposed merge of lp:~zorba-coders/zorba/bug1023120-schemaImport into lp:zorba.
=== modified file 'src/types/schema/schema.cpp'
--- src/types/schema/schema.cpp	2012-07-12 17:29:55 +0000
+++ src/types/schema/schema.cpp	2012-07-12 19:33:21 +0000
@@ -115,13 +115,14 @@
     // QQQ Is this reinterpret_cast necessary? Is it safe? Can I just
     // pump the chars from read() to the XMLBytes Xerces wants?
     char* const lToFill = reinterpret_cast<char*>(toFill);
+    TRACE("lToFill: " << lToFill );
     theStream->read(lToFill, maxToRead);
     return static_cast<unsigned int>(theStream->gcount());
   }
 
   virtual const XMLCh* getContentType() const
   {
-    // Unless we know it, do what Xerces' implemtation does: return 0
+    // Unless we know it, do what Xerces' implementation does: return 0
     return 0;
   }
 
@@ -232,7 +233,7 @@
       
       try
       {
-        TRACE("lId: " << StrX(lId) << " lResolved: " << lResolved);
+        TRACE("lId: " << StrX(lId) << " lResolved: " << lResolved << " thePhysURI: " << StrX(thePhysicalURI));
         zstring lErrorMessage;
         lResource = theSctx->resolve_uri(lResolved, internal::EntityData::SCHEMA, lErrorMessage);
         internal::StreamResource* lStream =
@@ -245,10 +246,10 @@
           lStream->setStreamReleaser(nullptr);
           
           if (isSystemId)
-            lRetval->setSystemId(thePhysicalURI);
+            lRetval->setSystemId(XMLString::transcode(lResolved.c_str()));
           
           if (isPublicId)
-            lRetval->setPublicId(thePhysicalURI);
+            lRetval->setPublicId(XMLString::transcode(lResolved.c_str()));
             
           return lRetval;
         }

=== added file 'test/rbkt/ExpQueryResults/zorba/schemas/include.xml.res'
--- test/rbkt/ExpQueryResults/zorba/schemas/include.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/schemas/include.xml.res	2012-07-12 19:33:21 +0000
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<s:superproduct xmlns:s="http://www.28msec.com/project1/schemas/simple"; string="blabla" something="something"/>
+

=== added file 'test/rbkt/Queries/zorba/schemas/incl-base.xsd'
--- test/rbkt/Queries/zorba/schemas/incl-base.xsd	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/incl-base.xsd	2012-07-12 19:33:21 +0000
@@ -0,0 +1,13 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
+  targetNamespace="http://www.28msec.com/project1/schemas/simple"; 
+            xmlns="http://www.28msec.com/project1/schemas/simple"; 
+  elementFormDefault="qualified">
+
+  <xs:element name="product" type="ProductType"/>
+
+  <xs:complexType name="ProductType">
+    <xs:attribute name="string" type="xs:string"/>
+  </xs:complexType>
+
+</xs:schema>
+

=== added file 'test/rbkt/Queries/zorba/schemas/incl-extensions.xsd'
--- test/rbkt/Queries/zorba/schemas/incl-extensions.xsd	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/incl-extensions.xsd	2012-07-12 19:33:21 +0000
@@ -0,0 +1,20 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
+  targetNamespace="http://www.28msec.com/project1/schemas/simple"; 
+            xmlns:ext="http://www.28msec.com/project1/schemas/simple"; 
+            xmlns:simple="http://www.28msec.com/project1/schemas/simple";
+  elementFormDefault="qualified">
+
+  <xs:include schemaLocation="incl-base.xsd"/>
+
+  <xs:element name="superproduct" type="ext:SuperProductType"/>
+
+  <xs:complexType name="SuperProductType">
+    <xs:complexContent>
+      <xs:extension base="simple:ProductType">
+        <xs:attribute name="something" type="xs:string"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+</xs:schema>
+

=== added file 'test/rbkt/Queries/zorba/schemas/include.xq'
--- test/rbkt/Queries/zorba/schemas/include.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/schemas/include.xq	2012-07-12 19:33:21 +0000
@@ -0,0 +1,4 @@
+import schema namespace s = 
+    "http://www.28msec.com/project1/schemas/simple"; at "incl-extensions.xsd";
+
+validate { <s:superproduct string="blabla" something="something"/> }


Follow ups