Merge lp:~zorba-coders/zorba/bug857842-textWithComment into lp:zorba

Proposed by Cezar Andrei
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/bug857842-textWithComment
Merge into: lp:zorba
Diff against target: 682 lines (+280/-136)
11 files modified
ChangeLog (+1/-0)
src/api/xmldatamanagerimpl.cpp (+6/-9)
src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp (+6/-4)
src/compiler/translator/translator.cpp (+2/-2)
src/runtime/strings/strings_impl.cpp (+3/-3)
src/types/root_typemanager.cpp (+7/-8)
src/types/schema/validate.cpp (+224/-104)
src/types/schema/validate.h (+20/-0)
src/util/http_util.cpp (+4/-3)
src/zorbamisc/ns_consts.h (+2/-0)
src/zorbaserialization/serialize_zorba_types.cpp (+5/-3)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug857842-textWithComment
Reviewer Review Type Date Requested Status
Cezar Andrei Approve
Matthias Brantner Pending
Review via email: mp+103367@code.launchpad.net

This proposal has been superseded by a proposal from 2012-04-27.

Commit message

Fix for Bug #857842 Assertion failed with simple content element with comments
Make use of XML_SCHEMA_NS definition from ns_consts.h.

Description of the change

Fix for Bug #857842 Assertion failed with simple content element with comments
Make use of XML_SCHEMA_NS definition from ns_consts.h.

To post a comment you must log in.
Revision history for this message
Cezar Andrei (cezar-andrei) wrote :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug857842-textWithComment into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job bug857842-textWithComment-2012-04-24T20-22-02.911Z is
  finished. The final status was:

  98 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

10792. By Cezar Andrei <email address hidden>

Avoid validating text nodes as a whole if it's part of content with child elements, i.e. mixed content.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2--- ChangeLog 2012-04-25 17:16:48 +0000
3+++ ChangeLog 2012-04-27 21:01:19 +0000
4@@ -41,6 +41,7 @@
5 * Fixed bug #949910 (has-children may be invoked on all nodes). Internally, zorba::store::Item::getChildren() now returns NULL on node classes without offspring (instead of raising an error).
6 * Fixed Bug #933490: Error ItemFactoryImpl::createBase64Binary with istream
7 * Fixed bug #867112 (Diagnostic Handler was not working on external APIs)
8+ * Fixed bug #857842 (Assertion failed with simple content element with comments)
9
10
11 version 2.2
12
13=== modified file 'src/api/xmldatamanagerimpl.cpp'
14--- src/api/xmldatamanagerimpl.cpp 2012-04-24 12:39:38 +0000
15+++ src/api/xmldatamanagerimpl.cpp 2012-04-27 21:01:19 +0000
16@@ -33,18 +33,15 @@
17 #include "api/staticcontextimpl.h"
18 #include "api/documentmanagerimpl.h"
19 #include "api/collectionmanagerimpl.h"
20-
21+#include "context/static_context.h"
22 #include "diagnostics/xquery_diagnostics.h"
23-
24+#include "runtime/util/flowctl_exception.h"
25 #include "store/api/collection.h"
26 #include "store/api/item.h"
27-#include "system/globalenv.h"
28 #include "store/api/store.h"
29 #include "store/api/item_factory.h"
30-
31-#include "context/static_context.h"
32-
33-#include "runtime/util/flowctl_exception.h"
34+#include "system/globalenv.h"
35+#include "zorbamisc/ns_consts.h"
36
37 #ifndef ZORBA_NO_FULL_TEXT
38 #include "stemmer_wrapper.h"
39@@ -292,7 +289,7 @@
40 Item empty_item;
41 Item validated_options;
42 NsBindings nsPairs;
43- Item untyped_type = theFactory->createQName("http://www.w3.org/2001/XMLSchema", "xs", "untyped");
44+ Item untyped_type = theFactory->createQName(XML_SCHEMA_NS, XML_SCHEMA_PREFIX, "untyped");
45 Item options_node = theFactory->createElementNode(empty_item,
46 theFactory->createQName(static_context::ZORBA_XML_FN_OPTIONS_NS, "options"),
47 untyped_type, false, false, nsPairs);
48@@ -340,7 +337,7 @@
49 Item empty_item;
50 Item validated_options;
51 NsBindings nsPairs;
52- Item untyped_type = theFactory->createQName("http://www.w3.org/2001/XMLSchema", "xs", "untyped");
53+ Item untyped_type = theFactory->createQName(XML_SCHEMA_NS, XML_SCHEMA_PREFIX, "untyped");
54 Item options_node = theFactory->createElementNode(empty_item,
55 theFactory->createQName(static_context::ZORBA_XML_FN_OPTIONS_NS, "options"),
56 untyped_type, false, false, nsPairs);
57
58=== modified file 'src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp'
59--- src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2012-04-24 12:39:38 +0000
60+++ src/compiler/parsetree/parsenode_print_xqdoc_visitor.cpp 2012-04-27 21:01:19 +0000
61@@ -38,6 +38,8 @@
62 #include "store/api/iterator.h"
63
64 #include "system/globalenv.h"
65+#include "zorbamisc/ns_consts.h"
66+
67
68 using namespace std;
69
70@@ -499,10 +501,10 @@
71 theVersion("1.0"),
72 theFactory(GENV_ITEMFACTORY)
73 {
74- theNamespaceMap["fn"] = "http://www.w3.org/2005/xpath-functions";
75- theNamespaceMap[""] = "http://www.w3.org/2005/xpath-functions";
76- theNamespaceMap["xs"] = "http://www.w3.org/2001/XMLSchema";
77- theNamespaceMap["local"] = "http://www.w3.org/2005/xquery-local-functions";
78+ theNamespaceMap["fn"] = XQUERY_XPATH_FN_NS;
79+ theNamespaceMap[""] = XQUERY_XPATH_FN_NS;
80+ theNamespaceMap[XML_SCHEMA_PREFIX] = XML_SCHEMA_NS;
81+ theNamespaceMap["local"] = XQUERY_LOCAL_FN_NS;
82 }
83
84
85
86=== modified file 'src/compiler/translator/translator.cpp'
87--- src/compiler/translator/translator.cpp 2012-04-24 12:39:38 +0000
88+++ src/compiler/translator/translator.cpp 2012-04-27 21:01:19 +0000
89@@ -83,6 +83,7 @@
90
91 #include "zorbatypes/URI.h"
92 #include "zorbatypes/numconversions.h"
93+#include "zorbamisc/ns_consts.h"
94
95 #ifdef ZORBA_WITH_DEBUGGER
96 #include "debugger/debugger_commons.h"
97@@ -105,7 +106,6 @@
98
99
100 #define NODE_SORT_OPT
101-#define XS_URI "http://www.w3.org/2001/XMLSchema"
102
103 namespace zorba
104 {
105@@ -2011,7 +2011,7 @@
106 theSctx->bind_ns(pfx, targetNS, loc, err::XQST0033);
107 }
108
109- zstring xsdTNS = zstring(XS_URI);
110+ zstring xsdTNS = zstring(XML_SCHEMA_NS);
111 if ( xsdTNS.compare(targetNS)==0 )
112 {
113 // Xerces doesn't like importing XMLSchema.xsd schema4schema, so we skip it
114
115=== modified file 'src/runtime/strings/strings_impl.cpp'
116--- src/runtime/strings/strings_impl.cpp 2012-04-24 12:39:38 +0000
117+++ src/runtime/strings/strings_impl.cpp 2012-04-27 21:01:19 +0000
118@@ -1840,7 +1840,7 @@
119 store::NsBindings ns_binding;
120 zstring baseURI;
121 GENV_ITEMFACTORY->createQName(untyped_type_name,
122- "http://www.w3.org/2001/XMLSchema", "xs", "untyped");
123+ XML_SCHEMA_NS, XML_SCHEMA_PREFIX, "untyped");
124 GENV_ITEMFACTORY->createQName(non_match_element_name,
125 static_context::W3C_FN_NS, "fn", "non-match");
126 GENV_ITEMFACTORY->createElementNode(non_match_elem, parent, non_match_element_name, untyped_type_name, false, false, ns_binding, baseURI);
127@@ -1969,7 +1969,7 @@
128 store::NsBindings ns_binding;
129 zstring baseURI;
130 GENV_ITEMFACTORY->createQName(untyped_type_name,
131- "http://www.w3.org/2001/XMLSchema", "xs", "untyped");
132+ XML_SCHEMA_NS, XML_SCHEMA_PREFIX, "untyped");
133 GENV_ITEMFACTORY->createQName(match_element_name,
134 static_context::W3C_FN_NS, "fn", "match");
135 store::Item_t match_elem;
136@@ -2129,7 +2129,7 @@
137 store::NsBindings ns_binding;
138 zstring baseURI;
139 GENV_ITEMFACTORY->createQName(untyped_type_name,
140- "http://www.w3.org/2001/XMLSchema", "xs", "untyped");
141+ XML_SCHEMA_NS, XML_SCHEMA_PREFIX, "untyped");
142 GENV_ITEMFACTORY->createQName(result_element_name,
143 static_context::W3C_FN_NS, "fn", "analyze-string-result");
144 GENV_ITEMFACTORY->createElementNode(result, NULL, result_element_name, untyped_type_name, false, false, ns_binding, baseURI);
145
146=== modified file 'src/types/root_typemanager.cpp'
147--- src/types/root_typemanager.cpp 2012-04-24 12:39:38 +0000
148+++ src/types/root_typemanager.cpp 2012-04-27 21:01:19 +0000
149@@ -20,16 +20,18 @@
150 #include <zorba/identtypes.h>
151 #include <zorba/typeident.h>
152
153-#include "zorbatypes/datetime.h"
154-#include "zorbatypes/duration.h"
155+#include "store/api/item_factory.h"
156+#include "store/api/store.h"
157
158 #include "system/globalenv.h"
159
160 #include "types/root_typemanager.h"
161 #include "types/node_test.h"
162
163-#include "store/api/item_factory.h"
164-#include "store/api/store.h"
165+#include "zorbamisc/ns_consts.h"
166+
167+#include "zorbatypes/datetime.h"
168+#include "zorbatypes/duration.h"
169
170
171
172@@ -200,14 +202,11 @@
173 TypeManagerImpl(NULL),
174 m_atomic_qnametype_map(ATOMIC_QNAMETYPE_MAP_SIZE, false)
175 {
176-#define XS_URI "http://www.w3.org/2001/XMLSchema"
177-#define XS_PREFIX "xs"
178-
179 #define ZXSE_URI "http://www.zorba-xquery.com/zorba/schema-extensions"
180 #define ZXSE_PREFIX "zxse"
181
182 #define XSQNDECL(var, local) \
183- GENV.getStore().getItemFactory()->createQName(var, XS_URI, XS_PREFIX, local)
184+ GENV.getStore().getItemFactory()->createQName(var, XML_SCHEMA_NS, XML_SCHEMA_PREFIX, local)
185
186 XSQNDECL(XS_ANY_ATOMIC_QNAME, "anyAtomicType");
187 XSQNDECL(XS_STRING_QNAME, "string");
188
189=== modified file 'src/types/schema/validate.cpp'
190--- src/types/schema/validate.cpp 2012-04-26 20:54:34 +0000
191+++ src/types/schema/validate.cpp 2012-04-27 21:01:19 +0000
192@@ -473,6 +473,10 @@
193 const QueryLoc& loc)
194 {
195 store::Item_t child;
196+ bool inTextContent = false;
197+ bool hasChildrenElements = false;
198+ zstring textNodeValue = zstring("");
199+ std::vector<store::Item*> textContent;
200
201 while ( children->next(child) )
202 {
203@@ -485,6 +489,15 @@
204 switch ( child->getNodeKind() )
205 {
206 case store::StoreConsts::elementNode:
207+ if (inTextContent)
208+ {
209+ hasChildrenElements = true;
210+ processTextContent(sctx, typeManager, schemaValidator, parent,
211+ hasChildrenElements, textNodeValue, textContent, loc);
212+ textNodeValue = "";
213+ inTextContent = false;
214+ textContent.clear();
215+ }
216 processElement(sctx, typeManager, schemaValidator, parent, child, loc);
217 break;
218
219@@ -498,100 +511,104 @@
220
221 case store::StoreConsts::textNode:
222 {
223+ // keep on adding the text
224+ inTextContent = true;
225 zstring childStringValue;
226 child->getStringValue2(childStringValue);
227- schemaValidator.text(childStringValue);
228-
229- store::Item_t typeQName = schemaValidator.getTypeQName();
230-
231- store::Item_t validatedTextNode;
232-
233- TypeIdentifier_t typeIdentifier =
234- TypeIdentifier::createNamedType(
235- Unmarshaller::newString( typeQName->getNamespace() ),
236- Unmarshaller::newString( typeQName->getLocalName() )
237- );
238-
239- //xqType is NULL, create_type can't find it
240- xqtref_t xqType = typeManager->create_type(*typeIdentifier);
241-
242-#if 0 // enable this to debug children values
243- if ( typeQName.getp() && xqType.getp() )
244- {
245- cout << " - text: '" << childStringValue << "' T: " <<
246- typeQName->getLocalName() << "\n"; cout.flush();
247- cout << " xqT: " << xqType->toString() << " content_kind: " <<
248- (long)xqType->content_kind() << " tKind:" << (long)xqType->type_kind() << " \n";
249- cout.flush();
250- }
251- else
252- cout << " - text2: '" << childStringValue << "' tQN: " <<
253- (typeQName ? typeQName->getStringValue() : "NULL") <<
254- " xqT:" << ( xqType.getp() ? xqType.getp()->toString() : "NULL" )
255- << "\n"; cout.flush();
256-#endif
257-
258- if ( xqType != NULL &&
259- xqType->content_kind() == XQType::SIMPLE_CONTENT_KIND )
260- {
261- store::NsBindings nsBindings;
262- parent->getNamespaceBindings(nsBindings);
263- std::vector<store::Item_t> typedValues;
264-
265- processTextValue(sctx,
266- typeManager,
267- nsBindings,
268- typeQName,
269- childStringValue,
270- typedValues,
271- loc);
272-
273- if ( typedValues.size() == 1 ) // hack around serialization bug
274- GENV_ITEMFACTORY->createTextNode(validatedTextNode, parent,
275- typedValues[0]);
276- else
277- GENV_ITEMFACTORY->createTextNode(validatedTextNode, parent,
278- typedValues);
279- }
280- else if ( xqType!=NULL &&
281- (xqType->content_kind()==XQType::ELEMENT_ONLY_CONTENT_KIND ||
282- xqType->content_kind()==XQType::EMPTY_CONTENT_KIND ))
283- {
284- // if text not valid the schemaValidator should have already
285- // thrown an error
286-
287- // XQ XP Datamodel Spec: http://www.w3.org/TR/xpath-datamodel/
288- // section 6.7.4 Construction from a PSVI
289- if ( !utf8::is_whitespace(childStringValue) )
290- {
291- zstring empty;
292- GENV_ITEMFACTORY->createTextNode(validatedTextNode,
293- parent,
294- empty);
295- //cout << " -- create empty text : ElementOnly || Empty" << endl;
296- }
297- else
298- {
299- //cout << " -- skip this text: (ElemOnly || Empty) && whitespace" << endl;
300- }
301- }
302- else
303- //if ( xqType!=NULL &&
304- // xqType->content_kind()==XQType::MIXED_CONTENT_KIND )
305- {
306- // if text not valid the schemaValidator should have already
307- // thrown an error
308- GENV_ITEMFACTORY->createTextNode(validatedTextNode,
309- parent,
310- childStringValue);
311- //cout << " -- create empty text: Mixed" << endl;
312- }
313+ textNodeValue += childStringValue;
314+ textContent.push_back(child.getp());
315 }
316 break;
317
318 case store::StoreConsts::piNode:
319 {
320 //cout << " - pi: " << child->getStringValue() << "\n";cout.flush();
321+ if ( inTextContent )
322+ {
323+ textContent.push_back(child.getp());
324+ }
325+ else
326+ {
327+ store::Item_t piNode;
328+ zstring piTarget =child->getTarget();
329+ zstring childStringValue;
330+ child->getStringValue2(childStringValue);
331+ zstring childBaseUri;
332+ child->getBaseURI(childBaseUri);
333+
334+ GENV_ITEMFACTORY->createPiNode(piNode, parent, piTarget,
335+ childStringValue, childBaseUri);
336+ }
337+ }
338+ break;
339+
340+ case store::StoreConsts::commentNode:
341+ {
342+ //cout << " - comment: " << child->getStringValue() <<
343+ // "\n"; cout.flush();
344+ if ( inTextContent )
345+ {
346+ textContent.push_back(child.getp());
347+ }
348+ else
349+ {
350+ store::Item_t commentNode;
351+ zstring childStringValue;
352+ child->getStringValue2(childStringValue);
353+ GENV_ITEMFACTORY->createCommentNode(commentNode, parent, childStringValue);
354+ }
355+ }
356+ break;
357+
358+ case store::StoreConsts::anyNode:
359+ //cout << " - any: " << child->getStringValue() <<"\n";cout.flush();
360+ ZORBA_ASSERT(false);
361+ break;
362+
363+ default:
364+ ZORBA_ASSERT(false);
365+ }
366+ }
367+ }
368+
369+ if (inTextContent)
370+ {
371+ processTextContent(sctx, typeManager, schemaValidator, parent,
372+ hasChildrenElements, textNodeValue, textContent, loc);
373+ textNodeValue = "";
374+ inTextContent = false;
375+ }
376+}
377+
378+void Validator::processTextContent(
379+ const static_context* sctx,
380+ TypeManager* typeManager,
381+ EventSchemaValidator& schemaValidator,
382+ store::Item* parent,
383+ bool hasChildrenElements,
384+ zstring& textNodeValue,
385+ std::vector<store::Item*>& textContent,
386+ const QueryLoc& loc)
387+{
388+ for ( std::size_t i = 0; i<textContent.size(); i++)
389+ {
390+ store::Item* child = textContent[i];
391+ switch ( child->getNodeKind() )
392+ {
393+ case store::StoreConsts::textNode:
394+ {
395+ if (hasChildrenElements)
396+ {
397+ zstring childStringValue;
398+ child->getStringValue2(childStringValue);
399+ finishTextNode(sctx, typeManager, schemaValidator, parent,
400+ childStringValue, loc);
401+ }
402+ }
403+ break;
404+
405+ case store::StoreConsts::piNode:
406+ {
407 store::Item_t piNode;
408 zstring piTarget =child->getTarget();
409 zstring childStringValue;
410@@ -601,31 +618,134 @@
411
412 GENV_ITEMFACTORY->createPiNode(piNode, parent, piTarget,
413 childStringValue, childBaseUri);
414- }
415- break;
416+ }
417+ break;
418
419- case store::StoreConsts::commentNode:
420- {
421- //cout << " - comment: " << child->getStringValue() <<
422- //"\n"; cout.flush();
423+ case store::StoreConsts::commentNode:
424+ {
425 store::Item_t commentNode;
426 zstring childStringValue;
427 child->getStringValue2(childStringValue);
428 GENV_ITEMFACTORY->createCommentNode(commentNode, parent, childStringValue);
429- }
430+ }
431+ break;
432+
433+ case store::StoreConsts::elementNode:
434+ case store::StoreConsts::attributeNode:
435+ case store::StoreConsts::documentNode:
436+ case store::StoreConsts::anyNode:
437+ //cout << " - any: " << child->getStringValue() <<"\n";cout.flush();
438+ ZORBA_ASSERT(false);
439 break;
440
441- case store::StoreConsts::anyNode:
442- //cout << " - any: " << child->getStringValue() <<"\n";cout.flush();
443- ZORBA_ASSERT(false);
444- break;
445-
446- default:
447- ZORBA_ASSERT(false);
448- }
449- }
450- }
451-}
452+ default:
453+ ZORBA_ASSERT(false);
454+ }
455+ }
456+
457+ if (!hasChildrenElements)
458+ {
459+ finishTextNode(sctx, typeManager, schemaValidator, parent,
460+ textNodeValue, loc);
461+ }
462+}
463+
464+void Validator::finishTextNode(
465+ const static_context* sctx,
466+ TypeManager* typeManager,
467+ EventSchemaValidator& schemaValidator,
468+ store::Item* parent,
469+ zstring& textNodeValue,
470+ const QueryLoc& loc)
471+{
472+ schemaValidator.text(textNodeValue);
473+
474+ store::Item_t typeQName = schemaValidator.getTypeQName();
475+
476+ store::Item_t validatedTextNode;
477+
478+ TypeIdentifier_t typeIdentifier =
479+ TypeIdentifier::createNamedType(
480+ Unmarshaller::newString( typeQName->getNamespace() ),
481+ Unmarshaller::newString( typeQName->getLocalName() )
482+ );
483+
484+ //xqType is NULL, create_type can't find it
485+ xqtref_t xqType = typeManager->create_type(*typeIdentifier);
486+
487+#if 0 // enable this to debug children values
488+ if ( typeQName.getp() && xqType.getp() )
489+ {
490+ cout << " - text: '" << textNodeValue << "' T: " <<
491+ typeQName->getLocalName() << "\n"; cout.flush();
492+ cout << " xqT: " << xqType->toString() << " content_kind: " <<
493+ (long)xqType->content_kind() << " tKind:" << (long)xqType->type_kind() << " \n";
494+ cout.flush();
495+ }
496+ else
497+ cout << " - text2: '" << textNodeValue << "' tQN: " <<
498+ (typeQName ? typeQName->getStringValue() : "NULL") <<
499+ " xqT:" << ( xqType.getp() ? xqType.getp()->toString() : "NULL" )
500+ << "\n"; cout.flush();
501+#endif
502+
503+ if ( xqType != NULL &&
504+ xqType->content_kind() == XQType::SIMPLE_CONTENT_KIND )
505+ {
506+ store::NsBindings nsBindings;
507+ parent->getNamespaceBindings(nsBindings);
508+ std::vector<store::Item_t> typedValues;
509+
510+ processTextValue(sctx,
511+ typeManager,
512+ nsBindings,
513+ typeQName,
514+ textNodeValue,
515+ typedValues,
516+ loc);
517+
518+ if ( typedValues.size() == 1 ) // hack around serialization bug
519+ GENV_ITEMFACTORY->createTextNode(validatedTextNode, parent,
520+ typedValues[0]);
521+ else
522+ GENV_ITEMFACTORY->createTextNode(validatedTextNode, parent,
523+ typedValues);
524+ }
525+ else if ( xqType!=NULL &&
526+ (xqType->content_kind()==XQType::ELEMENT_ONLY_CONTENT_KIND ||
527+ xqType->content_kind()==XQType::EMPTY_CONTENT_KIND ))
528+ {
529+ // if text not valid the schemaValidator should have already
530+ // thrown an error
531+
532+ // XQ XP Datamodel Spec: http://www.w3.org/TR/xpath-datamodel/
533+ // section 6.7.4 Construction from a PSVI
534+ if ( !utf8::is_whitespace(textNodeValue) )
535+ {
536+ zstring empty;
537+ GENV_ITEMFACTORY->createTextNode(validatedTextNode,
538+ parent,
539+ empty);
540+ //cout << " -- create empty text : ElementOnly || Empty" << endl;
541+ }
542+ else
543+ {
544+ //cout << " -- skip this text: (ElemOnly || Empty) && whitespace" << endl;
545+ }
546+ }
547+ else
548+ //if ( xqType!=NULL &&
549+ // xqType->content_kind()==XQType::MIXED_CONTENT_KIND )
550+ {
551+ // if text not valid the schemaValidator should have already
552+ // thrown an error
553+ GENV_ITEMFACTORY->createTextNode(validatedTextNode,
554+ parent,
555+ textNodeValue);
556+ //cout << " -- create empty text: Mixed" << endl;
557+ }
558+}
559+
560
561
562 void Validator::processNamespaces (
563
564=== modified file 'src/types/schema/validate.h'
565--- src/types/schema/validate.h 2012-04-24 12:39:38 +0000
566+++ src/types/schema/validate.h 2012-04-27 21:01:19 +0000
567@@ -20,6 +20,8 @@
568 #ifndef ZORBA_NO_XMLSCHEMA
569
570
571+#include <vector>
572+
573 #include "common/shared_types.h"
574
575 #include "compiler/parser/parse_constants.h"
576@@ -117,6 +119,24 @@
577 store::Iterator_t children,
578 const QueryLoc& loc);
579
580+ static void processTextContent(
581+ const static_context* sctx,
582+ TypeManager* typeManager,
583+ EventSchemaValidator& schemaValidator,
584+ store::Item* parent,
585+ bool hasChildrenElements,
586+ zstring& textNodeValue,
587+ std::vector<store::Item*>& textContent,
588+ const QueryLoc& loc);
589+
590+ static void finishTextNode(
591+ const static_context* sctx,
592+ TypeManager* typeManager,
593+ EventSchemaValidator& schemaValidator,
594+ store::Item* parent,
595+ zstring& textNodeValue,
596+ const QueryLoc& loc);
597+
598 static store::Item_t processElement(
599 const static_context* sctx,
600 TypeManager* typeManager,
601
602=== modified file 'src/util/http_util.cpp'
603--- src/util/http_util.cpp 2012-04-24 12:39:38 +0000
604+++ src/util/http_util.cpp 2012-04-27 21:01:19 +0000
605@@ -23,6 +23,7 @@
606 #include <api/unmarshaller.h>
607 #include "http_util.h"
608 #include "error_util.h"
609+#include "zorbamisc/ns_consts.h"
610
611
612 namespace zorba {
613@@ -51,10 +52,10 @@
614 Item lNodeName = lFactory->createQName("http://expath.org/ns/http-client", "http", "request");
615 Item lEmptyItem;
616 NsBindings nsPairs;
617- nsPairs.push_back(std::make_pair(String("xs"), String("http://www.w3.org/2001/XMLSchema")));
618+ nsPairs.push_back(std::make_pair(String(XML_SCHEMA_PREFIX), String(XML_SCHEMA_NS)));
619 Item lRequestElement = lFactory->createElementNode(lEmptyItem, lNodeName,
620- lFactory->createQName("http://www.w3.org/2001/XMLSchema",
621- "xs", "untyped"),
622+ lFactory->createQName(XML_SCHEMA_NS,
623+ XML_SCHEMA_PREFIX, "untyped"),
624 true, false, nsPairs);
625 lFactory->createAttributeNode(lRequestElement, lFactory->createQName("", "method"), Item(), lFactory->createString("GET"));
626 lFactory->createAttributeNode(lRequestElement, lFactory->createQName("", "href"), Item(), lFactory->createString(theUri.c_str()));
627
628=== modified file 'src/zorbamisc/ns_consts.h'
629--- src/zorbamisc/ns_consts.h 2012-04-24 12:39:38 +0000
630+++ src/zorbamisc/ns_consts.h 2012-04-27 21:01:19 +0000
631@@ -31,9 +31,11 @@
632
633 #define XML_NS W3C_NS "XML/1998/namespace"
634 #define XML_SCHEMA_NS W3C_NS "2001/XMLSchema"
635+#define XML_SCHEMA_PREFIX "xs"
636
637 #define XQUERY_ERR_NS W3C_NS "2005/xqt-errors" //not predeclared in XQuery 3.0
638 #define XQUERY_LOCAL_FN_NS W3C_NS "2005/xquery-local-functions"
639+#define XQUERY_XPATH_FN_NS W3C_NS "2005/xpath-functions"
640 #define XQUERY_MATH_FN_NS W3C_NS "2005/xpath-functions/math" //not predeclared in XQuery 3.0
641
642 #define XSI_NS W3C_NS "2001/XMLSchema-instance"
643
644=== modified file 'src/zorbaserialization/serialize_zorba_types.cpp'
645--- src/zorbaserialization/serialize_zorba_types.cpp 2012-04-24 12:39:38 +0000
646+++ src/zorbaserialization/serialize_zorba_types.cpp 2012-04-27 21:01:19 +0000
647@@ -35,6 +35,8 @@
648 #include "store/api/item_factory.h"
649 //#include "store/api/tuples.h"
650
651+#include "zorbamisc/ns_consts.h"
652+
653 #include "zorbatypes/datetime.h"
654 #include "zorbatypes/collation_manager.h"
655 #include "zorbatypes/integer.h"
656@@ -455,7 +457,7 @@
657 type = obj->getType();
658 name_of_type = type->getLocalName();
659 const zstring& ns =type->getNamespace();
660- is_qname = (name_of_type == "QName" && ns == "http://www.w3.org/2001/XMLSchema");
661+ is_qname = (name_of_type == "QName" && ns == XML_SCHEMA_NS);
662 }
663
664 ar & is_qname;
665@@ -484,7 +486,7 @@
666 }
667 else if (!ar.is_serializing_out())
668 {
669- GENV_ITEMFACTORY->createQName(type, "http://www.w3.org/2001/XMLSchema", "xs", "QName");
670+ GENV_ITEMFACTORY->createQName(type, XML_SCHEMA_NS, XML_SCHEMA_PREFIX, "QName");
671 }
672
673 if(!ar.is_serializing_out())
674@@ -982,7 +984,7 @@
675 // store::simplestore::ElementNode *elem_node = dynamic_cast<store::simplestore::ElementNode*>(obj);
676 // haveTypedValue = elem_node->haveTypedValue();
677 // haveEmptyValue = elem_node->haveEmptyValue();
678- if(!ZSTREQ(name_of_type->getNamespace(), "http://www.w3.org/2001/XMLSchema") ||
679+ if(!ZSTREQ(name_of_type->getNamespace(), XML_SCHEMA_NS) ||
680 !ZSTREQ(name_of_type->getLocalName(), "untyped"))
681 haveTypedValue = true;
682 }

Subscribers

People subscribed via source and target branches