Merge lp:~zorba-coders/zorba/markos-scratch into lp:zorba

Proposed by Markos Zaharioudakis
Status: Merged
Approved by: Markos Zaharioudakis
Approved revision: 11008
Merged at revision: 11180
Proposed branch: lp:~zorba-coders/zorba/markos-scratch
Merge into: lp:zorba
Diff against target: 2677 lines (+606/-457)
14 files modified
src/api/base64impl.cpp (+11/-10)
src/api/itemfactoryimpl.cpp (+38/-23)
src/diagnostics/diagnostic_en.xml (+64/-30)
src/diagnostics/pregenerated/dict_en.cpp (+17/-9)
src/diagnostics/pregenerated/dict_zed_keys.h (+15/-7)
src/runtime/qnames/qnames_impl.cpp (+19/-16)
src/store/naive/atomic_items.cpp (+23/-11)
src/store/naive/node_items.cpp (+1/-1)
src/types/casting.cpp (+278/-182)
src/types/schema/XercesParseUtils.cpp (+96/-128)
src/types/schema/schema.cpp (+11/-9)
src/zorbatypes/URI.cpp (+18/-14)
src/zorbatypes/binary.cpp (+14/-16)
test/rbkt/ExpQueryResults/zorba/trycatch/trycatch4.xml.res (+1/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/markos-scratch
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Review via email: mp+142760@code.launchpad.net

Commit message

fixed error messages for FORG0001 and FOCA0002 + removed uses of XQUERY_EXCEPTION_VAR macros

Description of the change

fixed error messages for FORG0001 and FOCA0002 + removed uses of XQUERY_EXCEPTION_VAR macros

To post a comment you must log in.
Revision history for this message
Markos Zaharioudakis (markos-za) :
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/markos-scratch into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job markos-scratch-2013-01-10T19-34-59.262Z is finished.
  The final status was:

  2 tests did not succeed - changes not commited.

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

11008. By Markos Zaharioudakis

fixed error messages for FORG0001 and FOCA0002 + removed uses of XQUERY_EXCEPTION_VAR macros

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job markos-scratch-2013-01-11T09-13-19.538Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/api/base64impl.cpp'
--- src/api/base64impl.cpp 2012-09-19 21:16:15 +0000
+++ src/api/base64impl.cpp 2013-01-11 00:47:24 +0000
@@ -26,18 +26,19 @@
26#include "diagnostics/xquery_exception.h"26#include "diagnostics/xquery_exception.h"
27#include "util/base64_util.h"27#include "util/base64_util.h"
2828
29#define CATCH_BASE64_EXCEPTION() \29#define CATCH_BASE64_EXCEPTION() \
30 catch ( base64::exception const &e ) { \30 catch (const base64::exception& e) \
31 throw XQUERY_EXCEPTION( \31 { \
32 err::FORG0001, ERROR_PARAMS( e.invalid_char(), ZED( Base64BadChar ) ) \32 throw XQUERY_EXCEPTION(err::FORG0001, \
33 ); \33 ERROR_PARAMS(ZED(FORG0001_Base64BadChar_2), e.invalid_char())); \
34 } \34 } \
35 catch ( std::invalid_argument const& ) { \35 catch (const std::invalid_argument&) \
36 throw XQUERY_EXCEPTION( \36 { \
37 err::FORG0001, ERROR_PARAMS( "", ZED( Base64Multiple4 ) ) \37 throw XQUERY_EXCEPTION(err::FORG0001, \
38 ); \38 ERROR_PARAMS(ZED(FORG0001_Base64Multiple4))); \
39 }39 }
4040
41
41namespace zorba {42namespace zorba {
42namespace encoding {43namespace encoding {
4344
4445
=== modified file 'src/api/itemfactoryimpl.cpp'
--- src/api/itemfactoryimpl.cpp 2012-10-08 12:09:36 +0000
+++ src/api/itemfactoryimpl.cpp 2013-01-11 00:47:24 +0000
@@ -16,21 +16,29 @@
16#include "stdafx.h"16#include "stdafx.h"
1717
18#define __STDC_LIMIT_MACROS18#define __STDC_LIMIT_MACROS
19
19#include <zorba/item.h>20#include <zorba/item.h>
20#include <zorba/zorba_string.h>21#include <zorba/zorba_string.h>
22
21#include "diagnostics/xquery_diagnostics.h"23#include "diagnostics/xquery_diagnostics.h"
24#include "diagnostics/util_macros.h"
25
22#include "api/itemfactoryimpl.h"26#include "api/itemfactoryimpl.h"
2327
24#include "zorbatypes/duration.h"28#include "zorbatypes/duration.h"
29
25#include "system/globalenv.h"30#include "system/globalenv.h"
31
26#include "store/api/item_factory.h"32#include "store/api/item_factory.h"
27#include <store/api/store.h>33#include "store/api/store.h"
28#include "store/api/copymode.h"34#include "store/api/copymode.h"
35#include "store/api/item.h"
36
29#include "api/unmarshaller.h"37#include "api/unmarshaller.h"
38
30#include "types/casting.h"39#include "types/casting.h"
3140
32#include "store/api/item.h"41#include "runtime/util/item_iterator.h"
33#include <runtime/util/item_iterator.h>
3442
3543
36namespace zorba {44namespace zorba {
@@ -112,14 +120,16 @@
112 zstring const &lLocalname = Unmarshaller::getInternalString( aLocalname );120 zstring const &lLocalname = Unmarshaller::getInternalString( aLocalname );
113 121
114 if (!GenericCast::instance()->castableToNCName(lLocalname.c_str()))122 if (!GenericCast::instance()->castableToNCName(lLocalname.c_str()))
115 throw XQUERY_EXCEPTION(123 {
116 err::FORG0001, ERROR_PARAMS( lLocalname, ZED( MustBeNCName ) )124 RAISE_ERROR_NO_LOC(err::FORG0001,
117 );125 ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), lLocalname));
126 }
118127
119 if (lPrefix.size() && !GenericCast::instance()->castableToNCName(lPrefix.c_str()))128 if (lPrefix.size() && !GenericCast::instance()->castableToNCName(lPrefix.c_str()))
120 throw XQUERY_EXCEPTION(129 {
121 err::FORG0001, ERROR_PARAMS( lPrefix, ZED( MustBeNCName ) )130 RAISE_ERROR_NO_LOC(err::FORG0001,
122 );131 ERROR_PARAMS(ZED(FORG0001_PrefixNotNCName_2), lPrefix));
132 }
123 133
124 store::Item_t lItem;134 store::Item_t lItem;
125 theItemFactory->createQName(lItem, lNamespace, lPrefix, lLocalname);135 theItemFactory->createQName(lItem, lNamespace, lPrefix, lLocalname);
@@ -135,44 +145,51 @@
135 zstring const &lLocalname = Unmarshaller::getInternalString( aLocalname );145 zstring const &lLocalname = Unmarshaller::getInternalString( aLocalname );
136146
137 if (!GenericCast::instance()->castableToNCName(lLocalname.c_str()))147 if (!GenericCast::instance()->castableToNCName(lLocalname.c_str()))
138 throw XQUERY_EXCEPTION(148 {
139 err::FORG0001, ERROR_PARAMS( lLocalname, ZED( MustBeNCName ) )149 RAISE_ERROR_NO_LOC(err::FORG0001,
140 );150 ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), lLocalname));
151 }
141 152
142 store::Item_t lItem;153 store::Item_t lItem;
143 theItemFactory->createQName(lItem, lNamespace, zstring(), lLocalname);154 theItemFactory->createQName(lItem, lNamespace, zstring(), lLocalname);
144 return &*lItem;155 return &*lItem;
145}156}
146 157
158
147Item159Item
148ItemFactoryImpl::createQName(const String& aQNameString)160ItemFactoryImpl::createQName(const String& aQNameString)
149{161{
150 zstring const &lQNameString = Unmarshaller::getInternalString( aQNameString );162 const zstring& lQNameString = Unmarshaller::getInternalString( aQNameString );
151 store::Item_t lItem;163 store::Item_t lItem;
152164
153 size_t lOpen = lQNameString.find("{");165 size_t lOpen = lQNameString.find("{");
154 size_t lClose = lQNameString.find("}");166 size_t lClose = lQNameString.find("}");
155167
156 if (lOpen == 0 && lClose != std::string::npos) {168 if (lOpen == 0 && lClose != std::string::npos)
169 {
157 zstring const &lNamespace = lQNameString.substr(1, lClose - 1);170 zstring const &lNamespace = lQNameString.substr(1, lClose - 1);
158 zstring const &lLocalname = lQNameString.substr(lClose+1);171 zstring const &lLocalname = lQNameString.substr(lClose+1);
159 theItemFactory->createQName(lItem, lNamespace, zstring(), lLocalname);172 theItemFactory->createQName(lItem, lNamespace, zstring(), lLocalname);
173
160 if (!GenericCast::instance()->castableToNCName(lLocalname.c_str()))174 if (!GenericCast::instance()->castableToNCName(lLocalname.c_str()))
161 throw XQUERY_EXCEPTION(175 {
162 err::FORG0001, ERROR_PARAMS( lLocalname, ZED( MustBeNCName ) )176 RAISE_ERROR_NO_LOC(err::FORG0001,
163 );177 ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), lLocalname));
178 }
164 }179 }
165 return &*lItem;180 return &*lItem;
166}181}
167182
183
168Item ItemFactoryImpl::createNCName(const String& aValue)184Item ItemFactoryImpl::createNCName(const String& aValue)
169{185{
170 zstring lString = Unmarshaller::getInternalString(aValue);186 zstring lString = Unmarshaller::getInternalString(aValue);
171187
172 if (!GenericCast::instance()->castableToNCName(lString.c_str()))188 if (!GenericCast::instance()->castableToNCName(lString.c_str()))
173 throw XQUERY_EXCEPTION(189 {
174 err::FORG0001, ERROR_PARAMS( lString, ZED( MustBeNCName ) )190 RAISE_ERROR_NO_LOC(err::FORG0001,
175 );191 ERROR_PARAMS(ZED(FORG0001_NameNotNCName_2), lString));
192 }
176 193
177 store::Item_t lItem;194 store::Item_t lItem;
178 theItemFactory->createNCName(lItem, lString);195 theItemFactory->createNCName(lItem, lString);
@@ -191,9 +208,7 @@
191 }208 }
192 else209 else
193 {210 {
194 throw ZORBA_EXCEPTION(211 throw ZORBA_EXCEPTION(zerr::ZSTR0040_TYPE_ERROR, ERROR_PARAMS(lMessage));
195 zerr::ZSTR0040_TYPE_ERROR, ERROR_PARAMS( lMessage )
196 );
197 }212 }
198 return &*lItem;213 return &*lItem;
199}214}
200215
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml 2013-01-08 08:34:08 +0000
+++ src/diagnostics/diagnostic_en.xml 2013-01-11 00:47:24 +0000
@@ -455,6 +455,10 @@
455 is of nonzero length and is not in the lexical space of \c xs:anyURI.455 is of nonzero length and is not in the lexical space of \c xs:anyURI.
456 </comment>456 </comment>
457 <value>${"1": }invalid URI literal${: 2}</value>457 <value>${"1": }invalid URI literal${: 2}</value>
458
459 <entry key="BadHexDigit_3">
460 <value>'$3': invalid hexedecimal digit</value>
461 </entry>
458 </diagnostic>462 </diagnostic>
459463
460 <diagnostic code="XQST0047">464 <diagnostic code="XQST0047">
@@ -1020,7 +1024,20 @@
1020 <comment>1024 <comment>
1021 Invalid lexical value.1025 Invalid lexical value.
1022 </comment>1026 </comment>
1023 <value>"$1": invalid lexical value${: 2}</value>1027 <value>$1</value>
1028
1029 <entry key="BadLexicalQName_2">
1030 <value>"$2": value is not a valid lexical QName</value>
1031 </entry>
1032
1033 <entry key="NoURIforPrefix_2">
1034 <value>no namespace URI provided for prefix in lexical QName "$2"</value>
1035 </entry>
1036
1037 <entry key="NoCastTo_234">
1038 <value>"$2": value of type $3 is not castable to type $4</value>
1039 </entry>
1040
1024 </diagnostic>1041 </diagnostic>
10251042
1026 <diagnostic code="FOCA0003">1043 <diagnostic code="FOCA0003">
@@ -1188,7 +1205,52 @@
1188 <comment>1205 <comment>
1189 Invalid value for cast/constructor.1206 Invalid value for cast/constructor.
1190 </comment>1207 </comment>
1191 <value>${"1": }invalid value for cast/constructor${: 2}</value>1208
1209 <value>$1</value>
1210
1211 <entry key="NoCastTo_234">
1212 <value>"$2": value of type $3 is not castable to type $4</value>
1213 </entry>
1214
1215 <entry key="NoCastTo_234o">
1216 <value>"$2": value is not castable to type $3${: 4}</value>
1217 </entry>
1218
1219 <entry key="LocalNotNCName_2">
1220 <value>"$2": local name in qname is not an xs:NCName</value>
1221 </entry>
1222
1223 <entry key="PrefixNotNCName_2">
1224 <value>"$2": prefix in qname is not an xs:NCName</value>
1225 </entry>
1226
1227 <entry key="NameNotNCName_2">
1228 <value>"$2": name is not an xs:NCName</value>
1229 </entry>
1230
1231 <entry key="PrefixNotBound_2">
1232 <value>"$2": prefix has no known namespace binding</value>
1233 </entry>
1234
1235 <entry key="Base64BadChar_2">
1236 <value>"$2": invalid Base64 character</value>
1237 </entry>
1238
1239 <entry key="Base64Multiple4">
1240 <value>Base64 data must be a multiple of 4 characters</value>
1241 </entry>
1242
1243 <entry key="HexBinaryMustBeEven">
1244 <value>HexBinary value must contain an even number of characters</value>
1245 </entry>
1246
1247 <entry key="BadHexDigit_2">
1248 <value>'$2': invalid hexedecimal digit</value>
1249 </entry>
1250
1251 <entry key="NoTypeInCtx_2">
1252 <value>"$2": type no defined in current context</value>
1253 </entry>
1192 </diagnostic>1254 </diagnostic>
11931255
1194 <diagnostic code="FORG0002">1256 <diagnostic code="FORG0002">
@@ -3029,10 +3091,6 @@
3029 <value>"$2": invalid authority for "file" scheme</value>3091 <value>"$2": invalid authority for "file" scheme</value>
3030 </entry>3092 </entry>
30313093
3032 <entry key="BadHexDigit_3">
3033 <value>'$3': invalid hexedecimal digit</value>
3034 </entry>
3035
3036 <entry key="BadHexSequence">3094 <entry key="BadHexSequence">
3037 <value>invalid hexedecimal sequence</value>3095 <value>invalid hexedecimal sequence</value>
3038 </entry>3096 </entry>
@@ -3113,14 +3171,6 @@
3113 <value>unsupported XQuery version</value>3171 <value>unsupported XQuery version</value>
3114 </entry>3172 </entry>
31153173
3116 <entry key="Base64BadChar">
3117 <value>invalid Base64 character</value>
3118 </entry>
3119
3120 <entry key="Base64Multiple4">
3121 <value>Base64 data must be a multiple of 4 characters</value>
3122 </entry>
3123
3124 <entry key="BaseURI">3174 <entry key="BaseURI">
3125 <value>base URI</value>3175 <value>base URI</value>
3126 </entry>3176 </entry>
@@ -3129,10 +3179,6 @@
3129 <value>box condition has more columns than index</value>3179 <value>box condition has more columns than index</value>
3130 </entry>3180 </entry>
31313181
3132 <entry key="CastFromToFailed_34">
3133 <value>$3 to $4 cast failed</value>
3134 </entry>
3135
3136 <entry key="CharExpected_3">3182 <entry key="CharExpected_3">
3137 <value>'$3' expected</value>3183 <value>'$3' expected</value>
3138 </entry>3184 </entry>
@@ -3285,10 +3331,6 @@
3285 <value>valid values are: yes, no, omit</value>3331 <value>valid values are: yes, no, omit</value>
3286 </entry>3332 </entry>
32873333
3288 <entry key="HexBinaryMustBeEven">
3289 <value>HexBinary value must contain an even number of characters</value>
3290 </entry>
3291
3292 <entry key="IncompleteKeyInIndexBuild">3334 <entry key="IncompleteKeyInIndexBuild">
3293 <value>incomplete key during index build</value>3335 <value>incomplete key during index build</value>
3294 </entry>3336 </entry>
@@ -3309,10 +3351,6 @@
3309 <value>must be absolute</value>3351 <value>must be absolute</value>
3310 </entry>3352 </entry>
33113353
3312 <entry key="MustBeNCName">
3313 <value>must be an xs:NCName</value>
3314 </entry>
3315
3316 <entry key="NoAttrNodesInDocument">3354 <entry key="NoAttrNodesInDocument">
3317 <value>document node must not contain attribute nodes</value>3355 <value>document node must not contain attribute nodes</value>
3318 </entry>3356 </entry>
@@ -3445,10 +3483,6 @@
3445 <value>can not treat as "$4"</value>3483 <value>can not treat as "$4"</value>
3446 </entry>3484 </entry>
34473485
3448 <entry key="NoTypeInCtx">
3449 <value>undefined type in current context</value>
3450 </entry>
3451
3452 <entry key="NoTypeInMainModule_4">3486 <entry key="NoTypeInMainModule_4">
3453 <value>type of variable "$4" is not among the in-scope types of the main module</value>3487 <value>type of variable "$4" is not among the in-scope types of the main module</value>
3454 </entry>3488 </entry>
34553489
=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp 2013-01-08 08:34:08 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp 2013-01-11 00:47:24 +0000
@@ -31,7 +31,7 @@
31 { "FOAR0001", "division by zero" },31 { "FOAR0001", "division by zero" },
32 { "FOAR0002", "numeric operation overflow/underflow${: 1}" },32 { "FOAR0002", "numeric operation overflow/underflow${: 1}" },
33 { "FOCA0001", "\"$1\": value too large for decimal" },33 { "FOCA0001", "\"$1\": value too large for decimal" },
34 { "FOCA0002", "\"$1\": invalid lexical value${: 2}" },34 { "FOCA0002", "$1" },
35 { "FOCA0003", "\"$1\": value too large for integer" },35 { "FOCA0003", "\"$1\": value too large for integer" },
36 { "FOCA0005", "NaN supplied as float/double value" },36 { "FOCA0005", "NaN supplied as float/double value" },
37 { "FOCA0006", "\"$1\": string to be cast to decimal has too many digits of precision" },37 { "FOCA0006", "\"$1\": string to be cast to decimal has too many digits of precision" },
@@ -56,7 +56,7 @@
56 { "FOFI0002", "invalid argument in format-integer: $1" },56 { "FOFI0002", "invalid argument in format-integer: $1" },
57 { "FONS0004", "\"$1\": no namespace found for prefix" },57 { "FONS0004", "\"$1\": no namespace found for prefix" },
58 { "FONS0005", "base-URI not defined in the static context" },58 { "FONS0005", "base-URI not defined in the static context" },
59 { "FORG0001", "${\"1\": }invalid value for cast/constructor${: 2}" },59 { "FORG0001", "$1" },
60 { "FORG0002", "\"$1\": invalid argument to fn:resolve-uri()${: 2}" },60 { "FORG0002", "\"$1\": invalid argument to fn:resolve-uri()${: 2}" },
61 { "FORG0003", "fn:zero-or-one() called with a sequnce containing more than one item" },61 { "FORG0003", "fn:zero-or-one() called with a sequnce containing more than one item" },
62 { "FORG0004", "fn:one-or-more() called with a sequence containing no items" },62 { "FORG0004", "fn:one-or-more() called with a sequence containing no items" },
@@ -537,7 +537,6 @@
537 { "~BadCharInBraces_3", "'$3': illegal character within { }" },537 { "~BadCharInBraces_3", "'$3': illegal character within { }" },
538 { "~BadDecDigit_3", "'$3': invalid decimal digit" },538 { "~BadDecDigit_3", "'$3': invalid decimal digit" },
539 { "~BadFileURIAuthority_2", "\"$2\": invalid authority for \"file\" scheme" },539 { "~BadFileURIAuthority_2", "\"$2\": invalid authority for \"file\" scheme" },
540 { "~BadHexDigit_3", "'$3': invalid hexedecimal digit" },
541 { "~BadHexSequence", "invalid hexedecimal sequence" },540 { "~BadHexSequence", "invalid hexedecimal sequence" },
542 { "~BadItem", "invalid item" },541 { "~BadItem", "invalid item" },
543 { "~BadIterator", "invalid iterator" },542 { "~BadIterator", "invalid iterator" },
@@ -560,11 +559,8 @@
560 { "~BadXMLForXQDoc_3", "can not parse as XML for xqdoc: $3" },559 { "~BadXMLForXQDoc_3", "can not parse as XML for xqdoc: $3" },
561 { "~BadXMLNoOpeningTag", "closing tag without matching opening tag" },560 { "~BadXMLNoOpeningTag", "closing tag without matching opening tag" },
562 { "~BadXQueryVersion", "unsupported XQuery version" },561 { "~BadXQueryVersion", "unsupported XQuery version" },
563 { "~Base64BadChar", "invalid Base64 character" },
564 { "~Base64Multiple4", "Base64 data must be a multiple of 4 characters" },
565 { "~BaseURI", "base URI" },562 { "~BaseURI", "base URI" },
566 { "~BoxCondTooManyColumns", "box condition has more columns than index" },563 { "~BoxCondTooManyColumns", "box condition has more columns than index" },
567 { "~CastFromToFailed_34", "$3 to $4 cast failed" },
568 { "~CharExpected_3", "'$3' expected" },564 { "~CharExpected_3", "'$3' expected" },
569 { "~CloneNotImplemented", "clone() not implemented for expression" },565 { "~CloneNotImplemented", "clone() not implemented for expression" },
570 { "~ClosingBraceWithoutOpen", "'}' encountered without '{' first" },566 { "~ClosingBraceWithoutOpen", "'}' encountered without '{' first" },
@@ -592,6 +588,20 @@
592 { "~ExprReturnsTooManyUpdateLists", "expression does not return a pending update list" },588 { "~ExprReturnsTooManyUpdateLists", "expression does not return a pending update list" },
593 { "~ExternFnDeterministic", "only external functions may be declared deterministic" },589 { "~ExternFnDeterministic", "only external functions may be declared deterministic" },
594 { "~ExternFnNondeterministic", "only external functions may be declared nondeterministic" },590 { "~ExternFnNondeterministic", "only external functions may be declared nondeterministic" },
591 { "~FOCA0002_BadLexicalQName_2", "\"$2\": value is not a valid lexical QName" },
592 { "~FOCA0002_NoCastTo_234", "\"$2\": value of type $3 is not castable to type $4" },
593 { "~FOCA0002_NoURIforPrefix_2", "no namespace URI provided for prefix in lexical QName \"$2\"" },
594 { "~FORG0001_BadHexDigit_2", "'$2': invalid hexedecimal digit" },
595 { "~FORG0001_Base64BadChar_2", "\"$2\": invalid Base64 character" },
596 { "~FORG0001_Base64Multiple4", "Base64 data must be a multiple of 4 characters" },
597 { "~FORG0001_HexBinaryMustBeEven", "HexBinary value must contain an even number of characters" },
598 { "~FORG0001_LocalNotNCName_2", "\"$2\": local name in qname is not an xs:NCName" },
599 { "~FORG0001_NameNotNCName_2", "\"$2\": name is not an xs:NCName" },
600 { "~FORG0001_NoCastTo_234", "\"$2\": value of type $3 is not castable to type $4" },
601 { "~FORG0001_NoCastTo_234o", "\"$2\": value is not castable to type $3${: 4}" },
602 { "~FORG0001_NoTypeInCtx_2", "\"$2\": type no defined in current context" },
603 { "~FORG0001_PrefixNotBound_2", "\"$2\": prefix has no known namespace binding" },
604 { "~FORG0001_PrefixNotNCName_2", "\"$2\": prefix in qname is not an xs:NCName" },
595 { "~FTST0009_BadStemmerLang", "for current stemmer" },605 { "~FTST0009_BadStemmerLang", "for current stemmer" },
596 { "~FTST0009_BadStopWordsLang", "for current stop words" },606 { "~FTST0009_BadStopWordsLang", "for current stop words" },
597 { "~FTST0009_BadThesaurusLang", "for given thesaurus" },607 { "~FTST0009_BadThesaurusLang", "for given thesaurus" },
@@ -614,7 +624,6 @@
614 { "~GoodValuesAreXMLEtc", "valid values are: xml, html, xhtml, text, binary, json, jsoniq" },624 { "~GoodValuesAreXMLEtc", "valid values are: xml, html, xhtml, text, binary, json, jsoniq" },
615 { "~GoodValuesAreYesNo", "valid values are: yes, no" },625 { "~GoodValuesAreYesNo", "valid values are: yes, no" },
616 { "~GoodValuesAreYesNoOmit", "valid values are: yes, no, omit" },626 { "~GoodValuesAreYesNoOmit", "valid values are: yes, no, omit" },
617 { "~HexBinaryMustBeEven", "HexBinary value must contain an even number of characters" },
618 { "~IncompleteKeyInIndexBuild", "incomplete key during index build" },627 { "~IncompleteKeyInIndexBuild", "incomplete key during index build" },
619 { "~IncompleteKeyInIndexRefresh", "incomplete key during index refresh" },628 { "~IncompleteKeyInIndexRefresh", "incomplete key during index refresh" },
620 { "~JNDY0021_IllegalCharacter_2", "'$2': illegal JSON character" },629 { "~JNDY0021_IllegalCharacter_2", "'$2': illegal JSON character" },
@@ -648,7 +657,6 @@
648 { "~LibModVersionMismatch_3", "XQuery library version can not be imported by a $3 version module" },657 { "~LibModVersionMismatch_3", "XQuery library version can not be imported by a $3 version module" },
649 { "~ModuleNotFound", "module not found" },658 { "~ModuleNotFound", "module not found" },
650 { "~MustBeAbsoluteURI", "must be absolute" },659 { "~MustBeAbsoluteURI", "must be absolute" },
651 { "~MustBeNCName", "must be an xs:NCName" },
652 { "~NoAttrNodesInDocument", "document node must not contain attribute nodes" },660 { "~NoAttrNodesInDocument", "document node must not contain attribute nodes" },
653 { "~NoBindURI", "namespace URI can not be bound to prefix" },661 { "~NoBindURI", "namespace URI can not be bound to prefix" },
654 { "~NoCastToCInt_2", "\"$2\": 2nd operand can not be cast from \"xs:integer\" to C++ \"int\"" },662 { "~NoCastToCInt_2", "\"$2\": 2nd operand can not be cast from \"xs:integer\" to C++ \"int\"" },
@@ -682,7 +690,6 @@
682 { "~NoSerializationCallbackForTraceStream", "no SerializationCallback for required trace stream" },690 { "~NoSerializationCallbackForTraceStream", "no SerializationCallback for required trace stream" },
683 { "~NoSourceURI", "no URI" },691 { "~NoSourceURI", "no URI" },
684 { "~NoTreatAs_4", "can not treat as \"$4\"" },692 { "~NoTreatAs_4", "can not treat as \"$4\"" },
685 { "~NoTypeInCtx", "undefined type in current context" },
686 { "~NoTypeInMainModule_4", "type of variable \"$4\" is not among the in-scope types of the main module" },693 { "~NoTypeInMainModule_4", "type of variable \"$4\" is not among the in-scope types of the main module" },
687 { "~NoTypeInModule_45", "type of variable \"$4\" is not among the in-scope types module \"$5\"" },694 { "~NoTypeInModule_45", "type of variable \"$4\" is not among the in-scope types module \"$5\"" },
688 { "~NoURIAuthority", "no authority" },695 { "~NoURIAuthority", "no authority" },
@@ -897,6 +904,7 @@
897 { "~XPTY0004_NoTypePromote_23", "$2 can not be promoted to type $3" },904 { "~XPTY0004_NoTypePromote_23", "$2 can not be promoted to type $3" },
898 { "~XPTY0117_NodeCast", "Cannot cast node to xs:QName" },905 { "~XPTY0117_NodeCast", "Cannot cast node to xs:QName" },
899 { "~XPTY0117_NotationParam_23", "$2 can not be promoted to parameter type xs:NOTATION of function $3()" },906 { "~XPTY0117_NotationParam_23", "$2 can not be promoted to parameter type xs:NOTATION of function $3()" },
907 { "~XQST0046_BadHexDigit_3", "'$3': invalid hexedecimal digit" },
900 { "~XQST0106_CONFLICTING", "conflicting" },908 { "~XQST0106_CONFLICTING", "conflicting" },
901 { "~XQST0106_THE_SAME", "the same" },909 { "~XQST0106_THE_SAME", "the same" },
902 { "~XUDY0021_AttributeName", "\"$3\": attribute with the same name already exists" },910 { "~XUDY0021_AttributeName", "\"$3\": attribute with the same name already exists" },
903911
=== modified file 'src/diagnostics/pregenerated/dict_zed_keys.h'
--- src/diagnostics/pregenerated/dict_zed_keys.h 2013-01-08 08:34:08 +0000
+++ src/diagnostics/pregenerated/dict_zed_keys.h 2013-01-11 00:47:24 +0000
@@ -46,6 +46,7 @@
46#define ZED_XPTY0004_MultiValuedGroupingKey "~XPTY0004_MultiValuedGroupingKey"46#define ZED_XPTY0004_MultiValuedGroupingKey "~XPTY0004_MultiValuedGroupingKey"
47#define ZED_XPTY0117_NodeCast "~XPTY0117_NodeCast"47#define ZED_XPTY0117_NodeCast "~XPTY0117_NodeCast"
48#define ZED_XPTY0117_NotationParam_23 "~XPTY0117_NotationParam_23"48#define ZED_XPTY0117_NotationParam_23 "~XPTY0117_NotationParam_23"
49#define ZED_XQST0046_BadHexDigit_3 "~XQST0046_BadHexDigit_3"
49#define ZED_XQST0106_THE_SAME "~XQST0106_THE_SAME"50#define ZED_XQST0106_THE_SAME "~XQST0106_THE_SAME"
50#define ZED_XQST0106_CONFLICTING "~XQST0106_CONFLICTING"51#define ZED_XQST0106_CONFLICTING "~XQST0106_CONFLICTING"
51#define ZED_XPDY0002_VariableHasNoValue_2 "~XPDY0002_VariableHasNoValue_2"52#define ZED_XPDY0002_VariableHasNoValue_2 "~XPDY0002_VariableHasNoValue_2"
@@ -55,6 +56,20 @@
55#define ZED_FTST0009_BadStemmerLang "~FTST0009_BadStemmerLang"56#define ZED_FTST0009_BadStemmerLang "~FTST0009_BadStemmerLang"
56#define ZED_FTST0009_BadThesaurusLang "~FTST0009_BadThesaurusLang"57#define ZED_FTST0009_BadThesaurusLang "~FTST0009_BadThesaurusLang"
57#define ZED_FTST0009_BadTokenizerLang "~FTST0009_BadTokenizerLang"58#define ZED_FTST0009_BadTokenizerLang "~FTST0009_BadTokenizerLang"
59#define ZED_FOCA0002_BadLexicalQName_2 "~FOCA0002_BadLexicalQName_2"
60#define ZED_FOCA0002_NoURIforPrefix_2 "~FOCA0002_NoURIforPrefix_2"
61#define ZED_FOCA0002_NoCastTo_234 "~FOCA0002_NoCastTo_234"
62#define ZED_FORG0001_NoCastTo_234 "~FORG0001_NoCastTo_234"
63#define ZED_FORG0001_NoCastTo_234o "~FORG0001_NoCastTo_234o"
64#define ZED_FORG0001_LocalNotNCName_2 "~FORG0001_LocalNotNCName_2"
65#define ZED_FORG0001_PrefixNotNCName_2 "~FORG0001_PrefixNotNCName_2"
66#define ZED_FORG0001_NameNotNCName_2 "~FORG0001_NameNotNCName_2"
67#define ZED_FORG0001_PrefixNotBound_2 "~FORG0001_PrefixNotBound_2"
68#define ZED_FORG0001_Base64BadChar_2 "~FORG0001_Base64BadChar_2"
69#define ZED_FORG0001_Base64Multiple4 "~FORG0001_Base64Multiple4"
70#define ZED_FORG0001_HexBinaryMustBeEven "~FORG0001_HexBinaryMustBeEven"
71#define ZED_FORG0001_BadHexDigit_2 "~FORG0001_BadHexDigit_2"
72#define ZED_FORG0001_NoTypeInCtx_2 "~FORG0001_NoTypeInCtx_2"
58#define ZED_XUST0001_CONCAT "~XUST0001_CONCAT"73#define ZED_XUST0001_CONCAT "~XUST0001_CONCAT"
59#define ZED_XUST0001_TRYCATCH "~XUST0001_TRYCATCH"74#define ZED_XUST0001_TRYCATCH "~XUST0001_TRYCATCH"
60#define ZED_XUST0001_Generic "~XUST0001_Generic"75#define ZED_XUST0001_Generic "~XUST0001_Generic"
@@ -107,7 +122,6 @@
107#define ZED_BadCharInBraces_3 "~BadCharInBraces_3"122#define ZED_BadCharInBraces_3 "~BadCharInBraces_3"
108#define ZED_BadDecDigit_3 "~BadDecDigit_3"123#define ZED_BadDecDigit_3 "~BadDecDigit_3"
109#define ZED_BadFileURIAuthority_2 "~BadFileURIAuthority_2"124#define ZED_BadFileURIAuthority_2 "~BadFileURIAuthority_2"
110#define ZED_BadHexDigit_3 "~BadHexDigit_3"
111#define ZED_BadHexSequence "~BadHexSequence"125#define ZED_BadHexSequence "~BadHexSequence"
112#define ZED_BadItem "~BadItem"126#define ZED_BadItem "~BadItem"
113#define ZED_BadIterator "~BadIterator"127#define ZED_BadIterator "~BadIterator"
@@ -128,11 +142,8 @@
128#define ZED_BadXMLNoOpeningTag "~BadXMLNoOpeningTag"142#define ZED_BadXMLNoOpeningTag "~BadXMLNoOpeningTag"
129#define ZED_BadXMLForXQDoc_3 "~BadXMLForXQDoc_3"143#define ZED_BadXMLForXQDoc_3 "~BadXMLForXQDoc_3"
130#define ZED_BadXQueryVersion "~BadXQueryVersion"144#define ZED_BadXQueryVersion "~BadXQueryVersion"
131#define ZED_Base64BadChar "~Base64BadChar"
132#define ZED_Base64Multiple4 "~Base64Multiple4"
133#define ZED_BaseURI "~BaseURI"145#define ZED_BaseURI "~BaseURI"
134#define ZED_BoxCondTooManyColumns "~BoxCondTooManyColumns"146#define ZED_BoxCondTooManyColumns "~BoxCondTooManyColumns"
135#define ZED_CastFromToFailed_34 "~CastFromToFailed_34"
136#define ZED_CharExpected_3 "~CharExpected_3"147#define ZED_CharExpected_3 "~CharExpected_3"
137#define ZED_CloneNotImplemented "~CloneNotImplemented"148#define ZED_CloneNotImplemented "~CloneNotImplemented"
138#define ZED_ClosingBraceWithoutOpen "~ClosingBraceWithoutOpen"149#define ZED_ClosingBraceWithoutOpen "~ClosingBraceWithoutOpen"
@@ -171,13 +182,11 @@
171#define ZED_GoodValuesAreXMLEtc "~GoodValuesAreXMLEtc"182#define ZED_GoodValuesAreXMLEtc "~GoodValuesAreXMLEtc"
172#define ZED_GoodValuesAreYesNo "~GoodValuesAreYesNo"183#define ZED_GoodValuesAreYesNo "~GoodValuesAreYesNo"
173#define ZED_GoodValuesAreYesNoOmit "~GoodValuesAreYesNoOmit"184#define ZED_GoodValuesAreYesNoOmit "~GoodValuesAreYesNoOmit"
174#define ZED_HexBinaryMustBeEven "~HexBinaryMustBeEven"
175#define ZED_IncompleteKeyInIndexBuild "~IncompleteKeyInIndexBuild"185#define ZED_IncompleteKeyInIndexBuild "~IncompleteKeyInIndexBuild"
176#define ZED_IncompleteKeyInIndexRefresh "~IncompleteKeyInIndexRefresh"186#define ZED_IncompleteKeyInIndexRefresh "~IncompleteKeyInIndexRefresh"
177#define ZED_LibModVersionMismatch_3 "~LibModVersionMismatch_3"187#define ZED_LibModVersionMismatch_3 "~LibModVersionMismatch_3"
178#define ZED_ModuleNotFound "~ModuleNotFound"188#define ZED_ModuleNotFound "~ModuleNotFound"
179#define ZED_MustBeAbsoluteURI "~MustBeAbsoluteURI"189#define ZED_MustBeAbsoluteURI "~MustBeAbsoluteURI"
180#define ZED_MustBeNCName "~MustBeNCName"
181#define ZED_NoAttrNodesInDocument "~NoAttrNodesInDocument"190#define ZED_NoAttrNodesInDocument "~NoAttrNodesInDocument"
182#define ZED_NoBindURI "~NoBindURI"191#define ZED_NoBindURI "~NoBindURI"
183#define ZED_NoCastToCInt_2 "~NoCastToCInt_2"192#define ZED_NoCastToCInt_2 "~NoCastToCInt_2"
@@ -211,7 +220,6 @@
211#define ZED_NoSerializationCallbackForTraceStream "~NoSerializationCallbackForTraceStream"220#define ZED_NoSerializationCallbackForTraceStream "~NoSerializationCallbackForTraceStream"
212#define ZED_NoSourceURI "~NoSourceURI"221#define ZED_NoSourceURI "~NoSourceURI"
213#define ZED_NoTreatAs_4 "~NoTreatAs_4"222#define ZED_NoTreatAs_4 "~NoTreatAs_4"
214#define ZED_NoTypeInCtx "~NoTypeInCtx"
215#define ZED_NoTypeInMainModule_4 "~NoTypeInMainModule_4"223#define ZED_NoTypeInMainModule_4 "~NoTypeInMainModule_4"
216#define ZED_NoTypeInModule_45 "~NoTypeInModule_45"224#define ZED_NoTypeInModule_45 "~NoTypeInModule_45"
217#define ZED_NoURIAuthority "~NoURIAuthority"225#define ZED_NoURIAuthority "~NoURIAuthority"
218226
=== modified file 'src/runtime/qnames/qnames_impl.cpp'
--- src/runtime/qnames/qnames_impl.cpp 2012-09-19 21:16:15 +0000
+++ src/runtime/qnames/qnames_impl.cpp 2013-01-11 00:47:24 +0000
@@ -31,6 +31,8 @@
31#include "store/api/item_factory.h"31#include "store/api/item_factory.h"
32#include "store/api/item.h"32#include "store/api/item.h"
3333
34#include "diagnostics/util_macros.h"
35
3436
35namespace zorba {37namespace zorba {
36#define GENV_GCAST (*GenericCast::instance ())38#define GENV_GCAST (*GenericCast::instance ())
@@ -66,19 +68,22 @@
66 resLocal = qname.substr(index+1, qname.size() - index);68 resLocal = qname.substr(index+1, qname.size() - index);
6769
68 // must check for FOCA0002 first70 // must check for FOCA0002 first
69 if (!GENV_GCAST.castableToNCName(resPre) || ! GENV_GCAST.castableToNCName(resLocal))71 if (!GENV_GCAST.castableToNCName(resPre) ||
70 throw XQUERY_EXCEPTION(72 ! GENV_GCAST.castableToNCName(resLocal))
71 err::FOCA0002, ERROR_PARAMS( qname ), ERROR_LOC(loc)73 {
72 );74 RAISE_ERROR(err::FOCA0002, loc,
75 ERROR_PARAMS(ZED(FOCA0002_BadLexicalQName_2), qname));
76 }
73 }77 }
74 else78 else
75 {79 {
76 resLocal = qname;80 resLocal = qname;
7781
78 if (! GENV_GCAST.castableToNCName(resLocal))82 if (! GENV_GCAST.castableToNCName(resLocal))
79 throw XQUERY_EXCEPTION(83 {
80 err::FOCA0002, ERROR_PARAMS( qname ), ERROR_LOC(loc)84 RAISE_ERROR(err::FOCA0002, loc,
81 );85 ERROR_PARAMS(ZED(FOCA0002_BadLexicalQName_2), qname));
86 }
82 }87 }
8388
84 if (consumeNext(itemElem, theChild1, planState ))89 if (consumeNext(itemElem, theChild1, planState ))
@@ -100,9 +105,7 @@
100 }105 }
101106
102 if (!found && !resPre.empty())107 if (!found && !resPre.empty())
103 throw XQUERY_EXCEPTION(108 RAISE_ERROR(err::FONS0004, loc, ERROR_PARAMS(resPre));
104 err::FONS0004, ERROR_PARAMS( resPre ), ERROR_LOC( loc )
105 );
106 }109 }
107110
108 GENV_ITEMFACTORY->createQName(result, resNs, resPre, resLocal);111 GENV_ITEMFACTORY->createQName(result, resNs, resPre, resLocal);
@@ -146,9 +149,10 @@
146 if (index != zstring::npos)149 if (index != zstring::npos)
147 {150 {
148 if (resNs.empty())151 if (resNs.empty())
149 throw XQUERY_EXCEPTION(152 {
150 err::FOCA0002, ERROR_PARAMS( resNs ), ERROR_LOC(loc)153 RAISE_ERROR(err::FOCA0002, loc,
151 );154 ERROR_PARAMS(ZED(FOCA0002_NoURIforPrefix_2), qname));
155 }
152156
153 resPre = qname.substr(0, index);157 resPre = qname.substr(0, index);
154 resLocal = qname.substr(index+1, qname.size() - index);158 resLocal = qname.substr(index+1, qname.size() - index);
@@ -161,9 +165,8 @@
161 if ((index != zstring::npos && ! GENV_GCAST.castableToNCName(resPre)) ||165 if ((index != zstring::npos && ! GENV_GCAST.castableToNCName(resPre)) ||
162 ! GENV_GCAST.castableToNCName(resLocal))166 ! GENV_GCAST.castableToNCName(resLocal))
163 {167 {
164 throw XQUERY_EXCEPTION(168 RAISE_ERROR(err::FOCA0002, loc,
165 err::FOCA0002, ERROR_PARAMS( qname ), ERROR_LOC(loc)169 ERROR_PARAMS(ZED(FOCA0002_BadLexicalQName_2), qname));
166 );
167 }170 }
168171
169 GENV_ITEMFACTORY->createQName(result, resNs, resPre, resLocal);172 GENV_ITEMFACTORY->createQName(result, resNs, resPre, resLocal);
170173
=== modified file 'src/store/naive/atomic_items.cpp'
--- src/store/naive/atomic_items.cpp 2012-12-25 20:27:54 +0000
+++ src/store/naive/atomic_items.cpp 2013-01-11 00:47:24 +0000
@@ -2679,7 +2679,10 @@
2679 catch ( std::range_error const& )2679 catch ( std::range_error const& )
2680 {2680 {
2681 RAISE_ERROR_NO_LOC(err::FORG0001,2681 RAISE_ERROR_NO_LOC(err::FORG0001,
2682 ERROR_PARAMS(theValue, ZED(CastFromToFailed_34), "integer", "long"));2682 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
2683 getStringValue(),
2684 "xs:integer",
2685 "xs:long"));
2683 }2686 }
2684}2687}
26852688
@@ -2693,7 +2696,10 @@
2693 catch ( std::range_error const& ) 2696 catch ( std::range_error const& )
2694 {2697 {
2695 RAISE_ERROR_NO_LOC(err::FORG0001,2698 RAISE_ERROR_NO_LOC(err::FORG0001,
2696 ERROR_PARAMS(theValue, ZED(CastFromToFailed_34), "integer", "unsignedInt"));2699 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
2700 getStringValue(),
2701 "xs:integer",
2702 "xs:unsignedInt"));
2697 }2703 }
2698}2704}
26992705
@@ -2793,10 +2799,11 @@
2793 }2799 }
2794 catch ( std::range_error const& )2800 catch ( std::range_error const& )
2795 {2801 {
2796 throw XQUERY_EXCEPTION(2802 RAISE_ERROR_NO_LOC(err::FORG0001,
2797 err::FORG0001,2803 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
2798 ERROR_PARAMS( theValue, ZED( CastFromToFailed_34 ), "integer", "long" )2804 getStringValue(),
2799 );2805 "xs:nonPositiveInteger",
2806 "xs:long"));
2800 }2807 }
2801}2808}
28022809
@@ -2882,6 +2889,7 @@
2882 }2889 }
2883}2890}
28842891
2892
2885store::Item* NonNegativeIntegerItem::getType() const2893store::Item* NonNegativeIntegerItem::getType() const
2886{2894{
2887 return GET_STORE().theSchemaTypeNames[store::XS_NON_NEGATIVE_INTEGER];2895 return GET_STORE().theSchemaTypeNames[store::XS_NON_NEGATIVE_INTEGER];
@@ -2893,26 +2901,30 @@
2893 return xs_decimal(theValue);2901 return xs_decimal(theValue);
2894}2902}
28952903
2904
2896xs_integer NonNegativeIntegerItem::getIntegerValue() const2905xs_integer NonNegativeIntegerItem::getIntegerValue() const
2897{2906{
2898 return xs_integer(theValue);2907 return xs_integer(theValue);
2899}2908}
29002909
2910
2901xs_long NonNegativeIntegerItem::getLongValue() const2911xs_long NonNegativeIntegerItem::getLongValue() const
2902{2912{
2903 try2913 try
2904 {2914 {
2905 return to_xs_long(theValue);2915 return to_xs_long(theValue);
2906 }2916 }
2907 catch ( std::range_error const& )2917 catch (const std::range_error& )
2908 {2918 {
2909 throw XQUERY_EXCEPTION(2919 RAISE_ERROR_NO_LOC(err::FORG0001,
2910 err::FORG0001,2920 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
2911 ERROR_PARAMS( theValue, ZED( CastFromToFailed_34 ), "integer", "long" )2921 getStringValue(),
2912 );2922 "xs:nonNegativeInteger",
2923 "xs:long"));
2913 }2924 }
2914}2925}
29152926
2927
2916zstring NonNegativeIntegerItem::getStringValue() const2928zstring NonNegativeIntegerItem::getStringValue() const
2917{2929{
2918 return theValue.toString();2930 return theValue.toString();
29192931
=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp 2013-01-08 08:34:08 +0000
+++ src/store/naive/node_items.cpp 2013-01-11 00:47:24 +0000
@@ -3333,7 +3333,7 @@
3333 if (!otherAttr->isHidden() && otherAttr->getNodeName()->equals(attrName))3333 if (!otherAttr->isHidden() && otherAttr->getNodeName()->equals(attrName))
3334 {3334 {
3335 throw XQUERY_EXCEPTION(err::XUDY0021,3335 throw XQUERY_EXCEPTION(err::XUDY0021,
3336 ERROR_PARAMS(ZED(XUDY0021_AttributeName), "", attrName->getStringValue()));3336 ERROR_PARAMS(ZED(XUDY0021_AttributeName), "", attrName->getStringValue()));
3337 }3337 }
3338 }3338 }
3339 }3339 }
33403340
=== modified file 'src/types/casting.cpp'
--- src/types/casting.cpp 2013-01-10 13:14:51 +0000
+++ src/types/casting.cpp 2013-01-11 00:47:24 +0000
@@ -96,29 +96,89 @@
96};96};
9797
9898
99void throwTypeException(const Diagnostic& errcode, const ErrorInfo& info)99void throwXPTY0004Exception(const ErrorInfo& info)
100{ 100{
101 if (info.theSourceType)101 if (info.theSourceType)
102 { 102 {
103 throw XQUERY_EXCEPTION_VAR(errcode,103 RAISE_ERROR(err::XPTY0004, info.theLoc,
104 ERROR_PARAMS(*info.theSourceType, ZED(NoCastTo_34o), *info.theTargetType),104 ERROR_PARAMS(*info.theSourceType, ZED(NoCastTo_34o), *info.theTargetType));
105 ERROR_LOC(info.theLoc));105 }
106 } 106 else
107 else 107 {
108 {108 TypeManager& tm = GENV_TYPESYSTEM;
109 TypeManager& tm = GENV_TYPESYSTEM;109
110 110 xqtref_t sourceType =
111 xqtref_t sourceType =111 tm.create_builtin_atomic_type(info.theSourceTypeCode,
112 tm.create_builtin_atomic_type(info.theSourceTypeCode,112 TypeConstants::QUANT_ONE);
113 TypeConstants::QUANT_ONE);113
114114 xqtref_t targetType =
115 xqtref_t targetType =115 tm.create_builtin_atomic_type(info.theTargetTypeCode,
116 tm.create_builtin_atomic_type(info.theTargetTypeCode,116 TypeConstants::QUANT_ONE);
117 TypeConstants::QUANT_ONE);117
118118 RAISE_ERROR(err::XPTY0004, info.theLoc,
119 throw XQUERY_EXCEPTION_VAR(errcode,119 ERROR_PARAMS(*sourceType, ZED(NoCastTo_34o), *targetType));
120 ERROR_PARAMS(*sourceType, ZED(NoCastTo_34o), *targetType),120 }
121 ERROR_LOC(info.theLoc)); 121}
122
123
124void throwFOCA0002Exception(const zstring& str, const ErrorInfo& info)
125{
126 if (info.theSourceType)
127 {
128 RAISE_ERROR(err::FOCA0002, info.theLoc,
129 ERROR_PARAMS(ZED(FOCA0002_NoCastTo_234),
130 str,
131 info.theSourceType->toSchemaString(),
132 info.theTargetType->toSchemaString()));
133 }
134 else
135 {
136 TypeManager& tm = GENV_TYPESYSTEM;
137
138 xqtref_t sourceType =
139 tm.create_builtin_atomic_type(info.theSourceTypeCode,
140 TypeConstants::QUANT_ONE);
141
142 xqtref_t targetType =
143 tm.create_builtin_atomic_type(info.theTargetTypeCode,
144 TypeConstants::QUANT_ONE);
145
146 RAISE_ERROR(err::FOCA0002, info.theLoc,
147 ERROR_PARAMS(ZED(FOCA0002_NoCastTo_234),
148 str,
149 sourceType->toSchemaString(),
150 targetType->toSchemaString()));
151 }
152}
153
154
155void throwFORG0001Exception(const zstring& str, const ErrorInfo& info)
156{
157 if (info.theTargetType)
158 {
159 RAISE_ERROR(err::FORG0001, info.theLoc,
160 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
161 str,
162 info.theSourceType->toSchemaString(),
163 info.theTargetType->toSchemaString()));
164 }
165 else
166 {
167 TypeManager& tm = GENV_TYPESYSTEM;
168
169 xqtref_t sourceType =
170 tm.create_builtin_atomic_type(info.theSourceTypeCode,
171 TypeConstants::QUANT_ONE);
172
173 xqtref_t targetType =
174 tm.create_builtin_atomic_type(info.theTargetTypeCode,
175 TypeConstants::QUANT_ONE);
176
177 RAISE_ERROR(err::FORG0001, info.theLoc,
178 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
179 str,
180 sourceType->toSchemaString(),
181 targetType->toSchemaString()));
122 } 182 }
123}183}
124184
@@ -134,7 +194,7 @@
134 zstring& strval, \194 zstring& strval, \
135 store::ItemFactory*, \195 store::ItemFactory*, \
136 const namespace_context* nsCtx, \196 const namespace_context* nsCtx, \
137 const ErrorInfo& aErrorInfo) \197 const ErrorInfo& errInfo) \
138{ \198{ \
139 result = (aItem); \199 result = (aItem); \
140} \200} \
@@ -175,7 +235,7 @@
175 zstring& strval, \235 zstring& strval, \
176 store::ItemFactory* aFactory, \236 store::ItemFactory* aFactory, \
177 const namespace_context* nsCtx, \237 const namespace_context* nsCtx, \
178 const ErrorInfo& aErrorInfo) \238 const ErrorInfo& errInfo) \
179239
180240
181241
@@ -194,11 +254,11 @@
194 }254 }
195 catch (std::invalid_argument const&) 255 catch (std::invalid_argument const&)
196 {256 {
197 throwTypeException(err::FORG0001, aErrorInfo);257 throwFORG0001Exception(strval, errInfo);
198 }258 }
199 catch ( std::range_error const& ) 259 catch (const std::range_error& )
200 {260 {
201 throw XQUERY_EXCEPTION(err::FOAR0002, ERROR_PARAMS(strval));261 RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
202 }262 }
203}263}
204264
@@ -212,11 +272,11 @@
212 }272 }
213 catch (std::invalid_argument const& ) 273 catch (std::invalid_argument const& )
214 {274 {
215 throwTypeException(err::FORG0001, aErrorInfo);275 throwFORG0001Exception(strval, errInfo);
216 }276 }
217 catch (std::range_error const& ) 277 catch (const std::range_error& )
218 {278 {
219 throw XQUERY_EXCEPTION(err::FOAR0002, ERROR_PARAMS(strval));279 RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
220 }280 }
221}281}
222282
@@ -228,9 +288,9 @@
228 xs_decimal const n(strval.c_str());288 xs_decimal const n(strval.c_str());
229 aFactory->createDecimal(result, n);289 aFactory->createDecimal(result, n);
230 }290 }
231 catch ( std::exception const& ) 291 catch (const std::exception& )
232 {292 {
233 throwTypeException( err::FORG0001, aErrorInfo );293 throwFORG0001Exception(strval, errInfo);
234 }294 }
235}295}
236296
@@ -242,13 +302,31 @@
242 xs_integer const n(strval.c_str());302 xs_integer const n(strval.c_str());
243 aFactory->createInteger(result, n);303 aFactory->createInteger(result, n);
244 }304 }
245 catch ( std::invalid_argument const& ) 305 catch (const std::invalid_argument& )
246 {306 {
247 throwTypeException( err::FORG0001, aErrorInfo );307 throwFORG0001Exception(strval, errInfo);
248 }308 }
249 catch ( std::range_error const& ) 309 catch (const std::range_error& )
250 {310 {
251 throwTypeException( err::FOAR0002, aErrorInfo );311 RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
312 }
313}
314
315
316T1_TO_T2(str, uint)
317{
318 try
319 {
320 const xs_nonNegativeInteger n(strval.c_str());
321 aFactory->createNonNegativeInteger(result, n);
322 }
323 catch (const std::invalid_argument& )
324 {
325 throwFORG0001Exception(strval, errInfo);
326 }
327 catch (const std::range_error& )
328 {
329 RAISE_ERROR(err::FOAR0002, errInfo.theLoc, ERROR_PARAMS(strval));
252 }330 }
253}331}
254332
@@ -263,7 +341,8 @@
263 aFactory->createDuration(result, &d);341 aFactory->createDuration(result, &d);
264 return;342 return;
265 }343 }
266 throwTypeException(err::FORG0001, aErrorInfo);344
345 throwFORG0001Exception(strval, errInfo);
267}346}
268347
269348
@@ -277,7 +356,8 @@
277 aFactory->createYearMonthDuration(result, &d);356 aFactory->createYearMonthDuration(result, &d);
278 return;357 return;
279 }358 }
280 throwTypeException( err::FORG0001, aErrorInfo );359
360 throwFORG0001Exception(strval, errInfo);
281}361}
282362
283363
@@ -291,7 +371,8 @@
291 aFactory->createDayTimeDuration(result, &d);371 aFactory->createDayTimeDuration(result, &d);
292 return;372 return;
293 }373 }
294 throwTypeException( err::FORG0001, aErrorInfo );374
375 throwFORG0001Exception(strval, errInfo);
295}376}
296377
297378
@@ -303,7 +384,8 @@
303 aFactory->createDateTime(result, &dt);384 aFactory->createDateTime(result, &dt);
304 return;385 return;
305 }386 }
306 throwTypeException( err::FORG0001, aErrorInfo );387
388 throwFORG0001Exception(strval, errInfo);
307}389}
308390
309391
@@ -315,7 +397,8 @@
315 aFactory->createTime(result, &t);397 aFactory->createTime(result, &t);
316 return;398 return;
317 }399 }
318 throwTypeException( err::FORG0001, aErrorInfo );400
401 throwFORG0001Exception(strval, errInfo);
319}402}
320403
321404
@@ -327,7 +410,8 @@
327 aFactory->createDate(result, &d);410 aFactory->createDate(result, &d);
328 return;411 return;
329 }412 }
330 throwTypeException( err::FORG0001, aErrorInfo );413
414 throwFORG0001Exception(strval, errInfo);
331}415}
332416
333417
@@ -339,7 +423,8 @@
339 aFactory->createGYearMonth(result, &ym);423 aFactory->createGYearMonth(result, &ym);
340 return;424 return;
341 }425 }
342 throwTypeException( err::FORG0001, aErrorInfo );426
427 throwFORG0001Exception(strval, errInfo);
343}428}
344429
345430
@@ -351,7 +436,8 @@
351 aFactory->createGYear(result, &y);436 aFactory->createGYear(result, &y);
352 return;437 return;
353 }438 }
354 throwTypeException( err::FORG0001, aErrorInfo );439
440 throwFORG0001Exception(strval, errInfo);
355}441}
356442
357443
@@ -364,7 +450,7 @@
364 return;450 return;
365 }451 }
366452
367 throwTypeException( err::FORG0001, aErrorInfo );453 throwFORG0001Exception(strval, errInfo);
368}454}
369455
370456
@@ -376,7 +462,8 @@
376 aFactory->createGDay(result, &d);462 aFactory->createGDay(result, &d);
377 return;463 return;
378 }464 }
379 throwTypeException( err::FORG0001, aErrorInfo );465
466 throwFORG0001Exception(strval, errInfo);
380}467}
381468
382469
@@ -389,7 +476,7 @@
389 return;476 return;
390 }477 }
391478
392 throwTypeException( err::FORG0001, aErrorInfo );479 throwFORG0001Exception(strval, errInfo);
393}480}
394481
395482
@@ -426,14 +513,16 @@
426 }513 }
427 else514 else
428 {515 {
429 throwTypeException( err::FORG0001, aErrorInfo );516 throwFORG0001Exception(strval, errInfo);
430 }517 }
431518
432 pos = str - strval.c_str();519 pos = str - strval.c_str();
433 ascii::skip_whitespace(strval.c_str(), len, &pos);520 ascii::skip_whitespace(strval.c_str(), len, &pos);
434521
435 if (pos != len)522 if (pos != len)
436 throwTypeException( err::FORG0001, aErrorInfo );523 {
524 throwFORG0001Exception(strval, errInfo);
525 }
437526
438 aFactory->createBoolean(result, lRetValue);527 aFactory->createBoolean(result, lRetValue);
439}528}
@@ -448,7 +537,7 @@
448 return;537 return;
449 }538 }
450539
451 throwTypeException( err::FORG0001, aErrorInfo );540 throwFORG0001Exception(strval, errInfo);
452}541}
453542
454543
@@ -460,7 +549,8 @@
460 aFactory->createHexBinary(result, n);549 aFactory->createHexBinary(result, n);
461 return;550 return;
462 }551 }
463 throwTypeException( err::FORG0001, aErrorInfo );552
553 throwFORG0001Exception(strval, errInfo);
464}554}
465555
466556
@@ -474,7 +564,7 @@
474 }564 }
475 catch (ZorbaException& e)565 catch (ZorbaException& e)
476 {566 {
477 e.set_diagnostic( err::FORG0001 );567 e.set_diagnostic(err::FORG0001);
478 throw;568 throw;
479 }569 }
480}570}
@@ -488,7 +578,7 @@
488 zstring::size_type lidx = strval.rfind(":", strval.size(), 1);578 zstring::size_type lidx = strval.rfind(":", strval.size(), 1);
489579
490 if (idx != lidx)580 if (idx != lidx)
491 throwTypeException(err::FORG0001, aErrorInfo);581 throwFORG0001Exception(strval, errInfo);
492582
493 zstring nsuri;583 zstring nsuri;
494 zstring prefix;584 zstring prefix;
@@ -507,20 +597,26 @@
507 {597 {
508 prefix = strval.substr(0, idx);598 prefix = strval.substr(0, idx);
509599
510 if (!GenericCast::instance()->castableToNCName(prefix))600 if (!GenericCast::castableToNCName(prefix))
511 throwTypeException(err::FORG0001, aErrorInfo);601 {
602 RAISE_ERROR(err::FORG0001, errInfo.theLoc,
603 ERROR_PARAMS(ZED(FORG0001_PrefixNotNCName_2), prefix));
604 }
512605
513 if (nsCtx)606 if (nsCtx)
514 {607 {
515 if (!nsCtx->findBinding(prefix, nsuri))608 if (!nsCtx->findBinding(prefix, nsuri))
516 throw XQUERY_EXCEPTION(err::FONS0004, ERROR_PARAMS(prefix));609 RAISE_ERROR(err::FONS0004, errInfo.theLoc, ERROR_PARAMS(prefix));
517 }610 }
518611
519 local = strval.substr(idx + 1);612 local = strval.substr(idx + 1);
520 }613 }
521614
522 if (!GenericCast::instance()->castableToNCName(local))615 if (!GenericCast::castableToNCName(local))
523 throwTypeException( err::FORG0001, aErrorInfo );616 {
617 RAISE_ERROR(err::FORG0001, errInfo.theLoc,
618 ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), local));
619 }
524620
525 aFactory->createQName(result, nsuri, prefix, local);621 aFactory->createQName(result, nsuri, prefix, local);
526}622}
@@ -541,11 +637,15 @@
541 local = strval.substr(pos+1, strval.size());637 local = strval.substr(pos+1, strval.size());
542 }638 }
543 else639 else
640 {
544 local = strval;641 local = strval;
642 }
545643
546 if (!nsCtx->findBinding(prefix, uri))644 if (!nsCtx->findBinding(prefix, uri))
547 ZORBA_ERROR_DESC_OSS(err::FORG0001, "Prefix '" << prefix645 {
548 << "' not found in current namespace context.");646 RAISE_ERROR(err::FORG0001, errInfo.theLoc,
647 ERROR_PARAMS(ZED(FORG0001_PrefixNotBound_2), prefix));
648 }
549649
550 store::Item_t qname;650 store::Item_t qname;
551 aFactory->createQName(qname, uri, prefix, local);651 aFactory->createQName(qname, uri, prefix, local);
@@ -565,7 +665,7 @@
565{665{
566 zstring strval2;666 zstring strval2;
567 aItem->getStringValue2(strval2);667 aItem->getStringValue2(strval2);
568 str_flt(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);668 str_flt(result, aItem, strval2, aFactory, nsCtx, errInfo);
569}669}
570670
571671
@@ -573,7 +673,7 @@
573{673{
574 zstring strval2;674 zstring strval2;
575 aItem->getStringValue2(strval2);675 aItem->getStringValue2(strval2);
576 str_dbl(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);676 str_dbl(result, aItem, strval2, aFactory, nsCtx, errInfo);
577}677}
578678
579679
@@ -581,7 +681,7 @@
581{681{
582 zstring strval2;682 zstring strval2;
583 aItem->getStringValue2(strval2);683 aItem->getStringValue2(strval2);
584 str_dec(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);684 str_dec(result, aItem, strval2, aFactory, nsCtx, errInfo);
585}685}
586686
587687
@@ -589,7 +689,7 @@
589{689{
590 zstring strval2;690 zstring strval2;
591 aItem->getStringValue2(strval2);691 aItem->getStringValue2(strval2);
592 str_int(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);692 str_int(result, aItem, strval2, aFactory, nsCtx, errInfo);
593}693}
594694
595695
@@ -597,7 +697,7 @@
597{697{
598 zstring strval2;698 zstring strval2;
599 aItem->getStringValue2(strval2);699 aItem->getStringValue2(strval2);
600 str_dur(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);700 str_dur(result, aItem, strval2, aFactory, nsCtx, errInfo);
601}701}
602702
603703
@@ -605,7 +705,7 @@
605{705{
606 zstring strval2;706 zstring strval2;
607 aItem->getStringValue2(strval2);707 aItem->getStringValue2(strval2);
608 str_yMD(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);708 str_yMD(result, aItem, strval2, aFactory, nsCtx, errInfo);
609}709}
610710
611711
@@ -613,7 +713,7 @@
613{713{
614 zstring strval2;714 zstring strval2;
615 aItem->getStringValue2(strval2);715 aItem->getStringValue2(strval2);
616 str_dTD(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);716 str_dTD(result, aItem, strval2, aFactory, nsCtx, errInfo);
617}717}
618718
619719
@@ -621,7 +721,7 @@
621{721{
622 zstring strval2;722 zstring strval2;
623 aItem->getStringValue2(strval2);723 aItem->getStringValue2(strval2);
624 str_dT(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);724 str_dT(result, aItem, strval2, aFactory, nsCtx, errInfo);
625}725}
626726
627727
@@ -629,7 +729,7 @@
629{729{
630 zstring strval2;730 zstring strval2;
631 aItem->getStringValue2(strval2);731 aItem->getStringValue2(strval2);
632 str_tim(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);732 str_tim(result, aItem, strval2, aFactory, nsCtx, errInfo);
633}733}
634734
635735
@@ -637,7 +737,7 @@
637{737{
638 zstring strval2;738 zstring strval2;
639 aItem->getStringValue2(strval2);739 aItem->getStringValue2(strval2);
640 str_dat(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);740 str_dat(result, aItem, strval2, aFactory, nsCtx, errInfo);
641}741}
642742
643743
@@ -645,7 +745,7 @@
645{745{
646 zstring strval2;746 zstring strval2;
647 aItem->getStringValue2(strval2);747 aItem->getStringValue2(strval2);
648 str_gYM(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);748 str_gYM(result, aItem, strval2, aFactory, nsCtx, errInfo);
649}749}
650750
651751
@@ -653,7 +753,7 @@
653{753{
654 zstring strval2;754 zstring strval2;
655 aItem->getStringValue2(strval2);755 aItem->getStringValue2(strval2);
656 str_gYr(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);756 str_gYr(result, aItem, strval2, aFactory, nsCtx, errInfo);
657}757}
658758
659759
@@ -661,7 +761,7 @@
661{761{
662 zstring strval2;762 zstring strval2;
663 aItem->getStringValue2(strval2);763 aItem->getStringValue2(strval2);
664 str_gMD(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);764 str_gMD(result, aItem, strval2, aFactory, nsCtx, errInfo);
665}765}
666766
667767
@@ -669,7 +769,7 @@
669{769{
670 zstring strval2;770 zstring strval2;
671 aItem->getStringValue2(strval2);771 aItem->getStringValue2(strval2);
672 str_gDay(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);772 str_gDay(result, aItem, strval2, aFactory, nsCtx, errInfo);
673}773}
674774
675775
@@ -677,7 +777,7 @@
677{777{
678 zstring strval2;778 zstring strval2;
679 aItem->getStringValue2(strval2);779 aItem->getStringValue2(strval2);
680 str_gMon(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);780 str_gMon(result, aItem, strval2, aFactory, nsCtx, errInfo);
681}781}
682782
683783
@@ -685,7 +785,7 @@
685{785{
686 zstring strval2;786 zstring strval2;
687 aItem->getStringValue2(strval2);787 aItem->getStringValue2(strval2);
688 str_bool(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);788 str_bool(result, aItem, strval2, aFactory, nsCtx, errInfo);
689}789}
690790
691791
@@ -693,7 +793,7 @@
693{793{
694 zstring strval2;794 zstring strval2;
695 aItem->getStringValue2(strval2);795 aItem->getStringValue2(strval2);
696 str_b64(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);796 str_b64(result, aItem, strval2, aFactory, nsCtx, errInfo);
697}797}
698798
699799
@@ -701,7 +801,7 @@
701{801{
702 zstring strval2;802 zstring strval2;
703 aItem->getStringValue2(strval2);803 aItem->getStringValue2(strval2);
704 str_hxB(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);804 str_hxB(result, aItem, strval2, aFactory, nsCtx, errInfo);
705}805}
706806
707807
@@ -709,7 +809,7 @@
709{809{
710 zstring strval2;810 zstring strval2;
711 aItem->getStringValue2(strval2);811 aItem->getStringValue2(strval2);
712 str_aURI(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);812 str_aURI(result, aItem, strval2, aFactory, nsCtx, errInfo);
713}813}
714814
715815
@@ -717,13 +817,13 @@
717{817{
718 zstring strval2;818 zstring strval2;
719 aItem->getStringValue2(strval2);819 aItem->getStringValue2(strval2);
720 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);820 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
721}821}
722822
723823
724T1_TO_T2(flt, str)824T1_TO_T2(flt, str)
725{825{
726 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);826 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
727}827}
728828
729829
@@ -740,9 +840,9 @@
740 xs_decimal const n( aItem->getFloatValue() );840 xs_decimal const n( aItem->getFloatValue() );
741 aFactory->createDecimal(result, n);841 aFactory->createDecimal(result, n);
742 }842 }
743 catch ( std::exception const& /*e*/ ) 843 catch (const std::exception&)
744 {844 {
745 throwTypeException( err::FOCA0002, aErrorInfo );845 throwFOCA0002Exception(aItem->getStringValue(), errInfo);
746 }846 }
747}847}
748848
@@ -753,9 +853,9 @@
753 {853 {
754 aFactory->createInteger(result, xs_integer(aItem->getFloatValue()));854 aFactory->createInteger(result, xs_integer(aItem->getFloatValue()));
755 }855 }
756 catch ( std::exception const& ) 856 catch (const std::exception&)
757 {857 {
758 throwTypeException( err::FOCA0002, aErrorInfo );858 throwFOCA0002Exception(aItem->getStringValue(), errInfo);
759 }859 }
760}860}
761861
@@ -770,13 +870,13 @@
770{870{
771 zstring strval2;871 zstring strval2;
772 aItem->getStringValue2(strval2);872 aItem->getStringValue2(strval2);
773 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);873 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
774}874}
775875
776876
777T1_TO_T2(dbl, str)877T1_TO_T2(dbl, str)
778{878{
779 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);879 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
780}880}
781881
782882
@@ -793,9 +893,9 @@
793 xs_decimal const n( aItem->getDoubleValue() );893 xs_decimal const n( aItem->getDoubleValue() );
794 aFactory->createDecimal(result, n);894 aFactory->createDecimal(result, n);
795 }895 }
796 catch ( std::exception const& ) 896 catch (const std::exception&)
797 {897 {
798 throwTypeException(err::FOCA0002, aErrorInfo);898 throwFOCA0002Exception(aItem->getStringValue(), errInfo);
799 }899 }
800}900}
801901
@@ -806,9 +906,9 @@
806 {906 {
807 aFactory->createInteger(result, xs_integer(aItem->getDoubleValue()));907 aFactory->createInteger(result, xs_integer(aItem->getDoubleValue()));
808 }908 }
809 catch ( std::exception const& ) 909 catch (const std::exception& )
810 {910 {
811 throwTypeException( err::FOCA0002, aErrorInfo );911 throwFOCA0002Exception(aItem->getStringValue(), errInfo);
812 }912 }
813}913}
814914
@@ -823,13 +923,13 @@
823{923{
824 zstring strval2;924 zstring strval2;
825 aItem->getStringValue2(strval2);925 aItem->getStringValue2(strval2);
826 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);926 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
827}927}
828928
829929
830T1_TO_T2(dec, str)930T1_TO_T2(dec, str)
831{931{
832 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);932 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
833}933}
834934
835935
@@ -861,13 +961,13 @@
861{961{
862 zstring strval2;962 zstring strval2;
863 aItem->getStringValue2(strval2);963 aItem->getStringValue2(strval2);
864 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);964 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
865}965}
866966
867967
868T1_TO_T2(int, str)968T1_TO_T2(int, str)
869{969{
870 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);970 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
871}971}
872972
873973
@@ -899,13 +999,13 @@
899{999{
900 zstring strval2;1000 zstring strval2;
901 aItem->getStringValue2(strval2);1001 aItem->getStringValue2(strval2);
902 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1002 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
903}1003}
9041004
9051005
906T1_TO_T2(dur, str)1006T1_TO_T2(dur, str)
907{1007{
908 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1008 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
909}1009}
9101010
9111011
@@ -929,13 +1029,13 @@
929{1029{
930 zstring strval2;1030 zstring strval2;
931 aItem->getStringValue2(strval2);1031 aItem->getStringValue2(strval2);
932 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1032 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
933}1033}
9341034
9351035
936T1_TO_T2(yMD, str)1036T1_TO_T2(yMD, str)
937{1037{
938 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1038 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
939}1039}
9401040
9411041
@@ -959,13 +1059,13 @@
959{1059{
960 zstring strval2;1060 zstring strval2;
961 aItem->getStringValue2(strval2);1061 aItem->getStringValue2(strval2);
962 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1062 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
963}1063}
9641064
9651065
966T1_TO_T2(dTD, str)1066T1_TO_T2(dTD, str)
967{1067{
968 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1068 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
969}1069}
9701070
9711071
@@ -989,13 +1089,13 @@
989{1089{
990 zstring strval2;1090 zstring strval2;
991 aItem->getStringValue2(strval2);1091 aItem->getStringValue2(strval2);
992 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1092 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
993}1093}
9941094
9951095
996T1_TO_T2(dT, str)1096T1_TO_T2(dT, str)
997{1097{
998 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1098 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
999}1099}
10001100
10011101
@@ -1059,13 +1159,13 @@
1059{1159{
1060 zstring strval2;1160 zstring strval2;
1061 aItem->getStringValue2(strval2);1161 aItem->getStringValue2(strval2);
1062 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1162 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1063}1163}
10641164
10651165
1066T1_TO_T2(tim, str)1166T1_TO_T2(tim, str)
1067{1167{
1068 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1168 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1069}1169}
10701170
10711171
@@ -1073,13 +1173,13 @@
1073{1173{
1074 zstring strval2;1174 zstring strval2;
1075 aItem->getStringValue2(strval2);1175 aItem->getStringValue2(strval2);
1076 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1176 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1077}1177}
10781178
10791179
1080T1_TO_T2(dat, str)1180T1_TO_T2(dat, str)
1081{1181{
1082 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1182 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1083}1183}
10841184
10851185
@@ -1135,13 +1235,13 @@
1135{1235{
1136 zstring strval2;1236 zstring strval2;
1137 aItem->getStringValue2(strval2);1237 aItem->getStringValue2(strval2);
1138 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1238 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1139}1239}
11401240
11411241
1142T1_TO_T2(gYM, str)1242T1_TO_T2(gYM, str)
1143{1243{
1144 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1244 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1145}1245}
11461246
11471247
@@ -1149,13 +1249,13 @@
1149{1249{
1150 zstring strval2;1250 zstring strval2;
1151 aItem->getStringValue2(strval2);1251 aItem->getStringValue2(strval2);
1152 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1252 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1153}1253}
11541254
11551255
1156T1_TO_T2(gYr, str)1256T1_TO_T2(gYr, str)
1157{1257{
1158 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1258 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1159}1259}
11601260
11611261
@@ -1163,13 +1263,13 @@
1163{1263{
1164 zstring strval2;1264 zstring strval2;
1165 aItem->getStringValue2(strval2);1265 aItem->getStringValue2(strval2);
1166 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1266 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1167}1267}
11681268
11691269
1170T1_TO_T2(gMD, str)1270T1_TO_T2(gMD, str)
1171{1271{
1172 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1272 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1173}1273}
11741274
11751275
@@ -1177,13 +1277,13 @@
1177{1277{
1178 zstring strval2;1278 zstring strval2;
1179 aItem->getStringValue2(strval2);1279 aItem->getStringValue2(strval2);
1180 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1280 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1181}1281}
11821282
11831283
1184T1_TO_T2(gDay, str)1284T1_TO_T2(gDay, str)
1185{1285{
1186 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1286 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1187}1287}
11881288
11891289
@@ -1191,13 +1291,13 @@
1191{1291{
1192 zstring strval2;1292 zstring strval2;
1193 aItem->getStringValue2(strval2);1293 aItem->getStringValue2(strval2);
1194 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1294 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1195}1295}
11961296
11971297
1198T1_TO_T2(gMon, str)1298T1_TO_T2(gMon, str)
1199{1299{
1200 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1300 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1201}1301}
12021302
12031303
@@ -1205,13 +1305,13 @@
1205{1305{
1206 zstring strval2;1306 zstring strval2;
1207 aItem->getStringValue2(strval2);1307 aItem->getStringValue2(strval2);
1208 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1308 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1209}1309}
12101310
12111311
1212T1_TO_T2(bool, str)1312T1_TO_T2(bool, str)
1213{1313{
1214 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1314 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1215}1315}
12161316
12171317
@@ -1255,13 +1355,13 @@
1255{1355{
1256 zstring strval2;1356 zstring strval2;
1257 aItem->getStringValue2(strval2);1357 aItem->getStringValue2(strval2);
1258 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1358 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1259}1359}
12601360
12611361
1262T1_TO_T2(b64, str)1362T1_TO_T2(b64, str)
1263{1363{
1264 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1364 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1265}1365}
12661366
12671367
@@ -1286,13 +1386,13 @@
1286{1386{
1287 zstring strval2;1387 zstring strval2;
1288 aItem->getStringValue2(strval2);1388 aItem->getStringValue2(strval2);
1289 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1389 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1290}1390}
12911391
12921392
1293T1_TO_T2(hxB, str)1393T1_TO_T2(hxB, str)
1294{1394{
1295 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1395 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1296}1396}
12971397
12981398
@@ -1307,13 +1407,13 @@
1307{1407{
1308 zstring strval2;1408 zstring strval2;
1309 aItem->getStringValue2(strval2);1409 aItem->getStringValue2(strval2);
1310 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1410 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1311}1411}
13121412
13131413
1314T1_TO_T2(aURI, str)1414T1_TO_T2(aURI, str)
1315{1415{
1316 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1416 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1317}1417}
13181418
13191419
@@ -1321,13 +1421,13 @@
1321{1421{
1322 zstring strval2;1422 zstring strval2;
1323 aItem->getStringValue2(strval2);1423 aItem->getStringValue2(strval2);
1324 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1424 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1325}1425}
13261426
13271427
1328T1_TO_T2(QN, str)1428T1_TO_T2(QN, str)
1329{1429{
1330 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1430 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1331}1431}
13321432
13331433
@@ -1335,13 +1435,13 @@
1335{1435{
1336 zstring strval2;1436 zstring strval2;
1337 aItem->getStringValue2(strval2);1437 aItem->getStringValue2(strval2);
1338 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1438 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1339}1439}
13401440
13411441
1342T1_TO_T2(NOT, str)1442T1_TO_T2(NOT, str)
1343{1443{
1344 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1444 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1345}1445}
13461446
13471447
@@ -1349,13 +1449,13 @@
1349{1449{
1350 zstring strval2;1450 zstring strval2;
1351 aItem->getStringValue2(strval2);1451 aItem->getStringValue2(strval2);
1352 str_uA(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1452 str_uA(result, aItem, strval2, aFactory, nsCtx, errInfo);
1353}1453}
13541454
13551455
1356T1_TO_T2(uint, str)1456T1_TO_T2(uint, str)
1357{1457{
1358 uA_str(result, aItem, strval, aFactory, nsCtx, aErrorInfo);1458 uA_str(result, aItem, strval, aFactory, nsCtx, errInfo);
1359}1459}
13601460
13611461
@@ -1387,7 +1487,7 @@
1387{1487{
1388 zstring strval2;1488 zstring strval2;
1389 aItem->getStringValue2(strval2);1489 aItem->getStringValue2(strval2);
1390 str_int(result, aItem, strval2, aFactory, nsCtx, aErrorInfo);1490 str_int(result, aItem, strval2, aFactory, nsCtx, errInfo);
1391}1491}
13921492
13931493
@@ -1398,9 +1498,9 @@
1398 xs_nonNegativeInteger const n(aItem->getFloatValue());1498 xs_nonNegativeInteger const n(aItem->getFloatValue());
1399 aFactory->createNonNegativeInteger(result, n);1499 aFactory->createNonNegativeInteger(result, n);
1400 }1500 }
1401 catch ( std::exception const& ) 1501 catch (const std::exception& )
1402 {1502 {
1403 throwTypeException( err::FOCA0002, aErrorInfo );1503 throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1404 }1504 }
1405}1505}
14061506
@@ -1412,9 +1512,9 @@
1412 xs_nonNegativeInteger const n(aItem->getIntegerValue());1512 xs_nonNegativeInteger const n(aItem->getIntegerValue());
1413 aFactory->createNonNegativeInteger(result, n);1513 aFactory->createNonNegativeInteger(result, n);
1414 }1514 }
1415 catch ( std::exception const& ) 1515 catch (const std::exception& )
1416 {1516 {
1417 throwTypeException( err::FOCA0002, aErrorInfo );1517 throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1418 }1518 }
1419}1519}
14201520
@@ -1426,9 +1526,9 @@
1426 xs_integer const n(aItem->getIntegerValue());1526 xs_integer const n(aItem->getIntegerValue());
1427 aFactory->createInteger(result, n);1527 aFactory->createInteger(result, n);
1428 }1528 }
1429 catch ( std::exception const& ) 1529 catch (const std::exception& )
1430 {1530 {
1431 throwTypeException( err::FOCA0002, aErrorInfo );1531 throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1432 }1532 }
1433}1533}
14341534
@@ -1440,9 +1540,9 @@
1440 xs_nonNegativeInteger const n(aItem->getDoubleValue());1540 xs_nonNegativeInteger const n(aItem->getDoubleValue());
1441 aFactory->createInteger(result, n);1541 aFactory->createInteger(result, n);
1442 }1542 }
1443 catch ( std::exception const& ) 1543 catch (const std::exception& )
1444 {1544 {
1445 throwTypeException( err::FOCA0002, aErrorInfo );1545 throwFOCA0002Exception(aItem->getStringValue(), errInfo);
1446 }1546 }
1447}1547}
14481548
@@ -1463,24 +1563,6 @@
1463}1563}
14641564
14651565
1466T1_TO_T2(str, uint)
1467{
1468 try
1469 {
1470 xs_nonNegativeInteger const n(strval.c_str());
1471 aFactory->createNonNegativeInteger(result, n);
1472 }
1473 catch ( std::invalid_argument const& )
1474 {
1475 throwTypeException( err::FORG0001, aErrorInfo );
1476 }
1477 catch ( std::range_error const& )
1478 {
1479 throwTypeException( err::FOCA0002, aErrorInfo );
1480 }
1481}
1482
1483
1484T1_TO_T2(NUL, str)1566T1_TO_T2(NUL, str)
1485{1567{
1486 zstring val("null");1568 zstring val("null");
@@ -1496,7 +1578,7 @@
1496 const store::Item* aItem,1578 const store::Item* aItem,
1497 store::SchemaTypeCode aTargetAtomicType,1579 store::SchemaTypeCode aTargetAtomicType,
1498 store::ItemFactory* factory,1580 store::ItemFactory* factory,
1499 const ErrorInfo& aErrorInfo)1581 const ErrorInfo& errInfo)
1500{1582{
1501 zstring strval;1583 zstring strval;
1502 aItem->getStringValue2(strval);1584 aItem->getStringValue2(strval);
@@ -1557,7 +1639,7 @@
1557 ascii::normalize_whitespace(strval);1639 ascii::normalize_whitespace(strval);
1558 ascii::trim_whitespace(strval);1640 ascii::trim_whitespace(strval);
15591641
1560 if (GenericCast::instance()->castableToNCName(strval))1642 if (GenericCast::castableToNCName(strval))
1561 {1643 {
1562 factory->createNCName(result, strval);1644 factory->createNCName(result, strval);
1563 return;1645 return;
@@ -1566,7 +1648,7 @@
1566 }1648 }
1567 case store::XS_ID:1649 case store::XS_ID:
1568 {1650 {
1569 if (GenericCast::instance()->castableToNCName(strval))1651 if (GenericCast::castableToNCName(strval))
1570 {1652 {
1571 factory->createID(result, strval);1653 factory->createID(result, strval);
1572 return;1654 return;
@@ -1575,7 +1657,7 @@
1575 }1657 }
1576 case store::XS_IDREF:1658 case store::XS_IDREF:
1577 {1659 {
1578 if (GenericCast::instance()->castableToNCName(strval))1660 if (GenericCast::castableToNCName(strval))
1579 {1661 {
1580 factory->createIDREF(result, strval);1662 factory->createIDREF(result, strval);
1581 return;1663 return;
@@ -1584,7 +1666,7 @@
1584 }1666 }
1585 case store::XS_ENTITY:1667 case store::XS_ENTITY:
1586 {1668 {
1587 if (GenericCast::instance()->castableToNCName(strval))1669 if (GenericCast::castableToNCName(strval))
1588 {1670 {
1589 factory->createENTITY(result, strval);1671 factory->createENTITY(result, strval);
1590 return;1672 return;
@@ -1595,7 +1677,7 @@
1595 ZORBA_ASSERT(false);1677 ZORBA_ASSERT(false);
1596 }1678 }
15971679
1598 throwTypeException(err::FORG0001, aErrorInfo);1680 throwFORG0001Exception(strval, errInfo);
1599}1681}
16001682
16011683
@@ -1795,7 +1877,7 @@
1795 ZORBA_ASSERT(false);1877 ZORBA_ASSERT(false);
1796 }1878 }
17971879
1798 throwTypeException(err::FORG0001, errInfo);1880 throwFORG0001Exception(aItem->getStringValue(), errInfo);
1799}1881}
18001882
18011883
@@ -2047,6 +2129,7 @@
2047 const QueryLoc& loc)2129 const QueryLoc& loc)
2048{2130{
2049 const TypeManager* ttm = targetType->get_manager();2131 const TypeManager* ttm = targetType->get_manager();
2132
2050 if (ttm != tm && ttm != &GENV_TYPESYSTEM && !TypeOps::is_in_scope(tm, *targetType))2133 if (ttm != tm && ttm != &GENV_TYPESYSTEM && !TypeOps::is_in_scope(tm, *targetType))
2051 {2134 {
2052 RAISE_ERROR(err::XPTY0004, loc,2135 RAISE_ERROR(err::XPTY0004, loc,
@@ -2129,8 +2212,13 @@
2129 }2212 }
2130 }2213 }
21312214
2215 xqtref_t sourceType = tm->create_value_type(item);
2216
2132 RAISE_ERROR(err::FORG0001, loc,2217 RAISE_ERROR(err::FORG0001, loc,
2133 ERROR_PARAMS(item->getStringValue(), ZED(NoCastTo_34o), udt->toSchemaString()));2218 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234),
2219 item->getStringValue(),
2220 sourceType->toSchemaString(),
2221 udt->toSchemaString()));
2134 } // union2222 } // union
2135#endif // ZORBA_NO_XMLSCHEMA2223#endif // ZORBA_NO_XMLSCHEMA
2136 } // list or union2224 } // list or union
@@ -2195,7 +2283,7 @@
2195 CastFunc castFunc = theCastMatrix[theMapping[sourceTypeCode]]2283 CastFunc castFunc = theCastMatrix[theMapping[sourceTypeCode]]
2196 [theMapping[targetTypeCode]];2284 [theMapping[targetTypeCode]];
2197 if (castFunc == 0)2285 if (castFunc == 0)
2198 throwTypeException(err::XPTY0004, errInfo);2286 throwXPTY0004Exception(errInfo);
21992287
2200 (*castFunc)(result, item, str, factory, nsCtx, errInfo);2288 (*castFunc)(result, item, str, factory, nsCtx, errInfo);
2201 }2289 }
@@ -2323,7 +2411,7 @@
23232411
2324 if (sourceTypeCode == store::XS_ANY_ATOMIC)2412 if (sourceTypeCode == store::XS_ANY_ATOMIC)
2325 {2413 {
2326 throwTypeException(err::XPTY0004, errInfo);2414 throwXPTY0004Exception(errInfo);
2327 }2415 }
23282416
2329 if (targetTypeCode == store::XS_NCNAME &&2417 if (targetTypeCode == store::XS_NCNAME &&
@@ -2331,14 +2419,14 @@
2331 sourceTypeCode != store::XS_NCNAME &&2419 sourceTypeCode != store::XS_NCNAME &&
2332 sourceTypeCode != store::XS_UNTYPED_ATOMIC)2420 sourceTypeCode != store::XS_UNTYPED_ATOMIC)
2333 {2421 {
2334 throwTypeException(err::XPTY0004, errInfo);2422 throwXPTY0004Exception(errInfo);
2335 }2423 }
23362424
2337 CastFunc castFunc = theCastMatrix[theMapping[sourceTypeCode]]2425 CastFunc castFunc = theCastMatrix[theMapping[sourceTypeCode]]
2338 [theMapping[targetTypeCode]];2426 [theMapping[targetTypeCode]];
2339 if (castFunc == 0)2427 if (castFunc == 0)
2340 {2428 {
2341 throwTypeException(err::XPTY0004, errInfo);2429 throwXPTY0004Exception(errInfo);
2342 }2430 }
23432431
2344 if (theMapping[sourceTypeCode] == theMapping[store::XS_STRING])2432 if (theMapping[sourceTypeCode] == theMapping[store::XS_STRING])
@@ -2392,19 +2480,21 @@
2392 ERROR_PARAMS(ZED(BadType_23o), *sourceType, ZED(NoCastTo_45o), "QName"));2480 ERROR_PARAMS(ZED(BadType_23o), *sourceType, ZED(NoCastTo_45o), "QName"));
2393 }2481 }
23942482
2395 ErrorInfo errorInfo(sourceType.getp(), rtm.QNAME_TYPE_ONE.getp(), loc);2483 ErrorInfo errInfo(sourceType.getp(), rtm.QNAME_TYPE_ONE.getp(), loc);
23962484
2397 zstring strval;2485 zstring strval;
2398 item->getStringValue2(strval);2486 item->getStringValue2(strval);
2487
2399 ascii::trim_whitespace(strval);2488 ascii::trim_whitespace(strval);
24002489
2401 zstring::size_type idx = strval.find(":");2490 zstring::size_type idx = strval.find(":");
2402 zstring::size_type lidx = strval.rfind(":", strval.size(), 1);2491 zstring::size_type lidx = strval.rfind(":", strval.size(), 1);
2492
2403 if (idx != lidx)2493 if (idx != lidx)
2404 throwTypeException(err::FORG0001, errorInfo);2494 throwFORG0001Exception(strval, errInfo);
24052495
2496 zstring nsuri;
2406 zstring prefix;2497 zstring prefix;
2407 zstring nsuri;
2408 zstring local;2498 zstring local;
24092499
2410 if (idx == zstring::npos)2500 if (idx == zstring::npos)
@@ -2420,20 +2510,26 @@
2420 {2510 {
2421 prefix = strval.substr(0, idx);2511 prefix = strval.substr(0, idx);
24222512
2423 if (!GenericCast::instance()->castableToNCName(prefix))2513 if (!GenericCast::castableToNCName(prefix))
2424 throwTypeException(err::FORG0001, errorInfo);2514 {
2515 RAISE_ERROR(err::FORG0001, errInfo.theLoc,
2516 ERROR_PARAMS(ZED(FORG0001_PrefixNotNCName_2), prefix));
2517 }
24252518
2426 if (nsCtx)2519 if (nsCtx)
2427 {2520 {
2428 if (!nsCtx->findBinding(prefix, nsuri))2521 if (!nsCtx->findBinding(prefix, nsuri))
2429 throw XQUERY_EXCEPTION(err::FONS0004, ERROR_PARAMS(prefix));2522 RAISE_ERROR(err::FONS0004, errInfo.theLoc, ERROR_PARAMS(prefix));
2430 }2523 }
24312524
2432 local = strval.substr(idx + 1);2525 local = strval.substr(idx + 1);
2433 }2526 }
24342527
2435 if (!GenericCast::instance()->castableToNCName(local.c_str()))2528 if (!GenericCast::castableToNCName(local))
2436 throwTypeException(err::FORG0001, errorInfo );2529 {
2530 RAISE_ERROR(err::FORG0001, errInfo.theLoc,
2531 ERROR_PARAMS(ZED(FORG0001_LocalNotNCName_2), local));
2532 }
24372533
2438 return GENV_ITEMFACTORY->createQName(result, nsuri, prefix, local);2534 return GENV_ITEMFACTORY->createQName(result, nsuri, prefix, local);
2439}2535}
24402536
=== modified file 'src/types/schema/XercesParseUtils.cpp'
--- src/types/schema/XercesParseUtils.cpp 2012-09-19 21:16:15 +0000
+++ src/types/schema/XercesParseUtils.cpp 2013-01-11 00:47:24 +0000
@@ -67,9 +67,8 @@
67 }67 }
68 else68 else
69 {69 {
70 throw XQUERY_EXCEPTION(70 throw XQUERY_EXCEPTION(err::FORG0001,
71 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "boolean" )71 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:boolean"));
72 );
73 }72 }
74}73}
7574
@@ -96,9 +95,8 @@
96 }95 }
97 else96 else
98 {97 {
99 throw XQUERY_EXCEPTION(98 throw XQUERY_EXCEPTION(err::FORG0001,
100 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "integer" )99 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:integer"));
101 );
102 }100 }
103}101}
104102
@@ -125,10 +123,8 @@
125 }123 }
126 else124 else
127 {125 {
128 throw XQUERY_EXCEPTION(126 throw XQUERY_EXCEPTION(err::FORG0001,
129 err::FORG0001,127 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:positiveInteger"));
130 ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "positiveInteger" )
131 );
132 }128 }
133}129}
134130
@@ -155,10 +151,8 @@
155 }151 }
156 else152 else
157 {153 {
158 throw XQUERY_EXCEPTION(154 throw XQUERY_EXCEPTION(err::FORG0001,
159 err::FORG0001,155 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:nonPositiveInteger"));
160 ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "nonPositiveInteger" )
161 );
162 }156 }
163}157}
164158
@@ -185,13 +179,12 @@
185 }179 }
186 else180 else
187 {181 {
188 throw XQUERY_EXCEPTION(182 throw XQUERY_EXCEPTION(err::FORG0001,
189 err::FORG0001,183 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:negativeInteger"));
190 ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "negativeInteger" )
191 );
192 }184 }
193}185}
194186
187
195bool XercesParseUtils::parseXSNonNegativeInteger(188bool XercesParseUtils::parseXSNonNegativeInteger(
196 const zstring& textValue,189 const zstring& textValue,
197 store::Item_t &result)190 store::Item_t &result)
@@ -214,13 +207,12 @@
214 }207 }
215 else208 else
216 {209 {
217 throw XQUERY_EXCEPTION(210 throw XQUERY_EXCEPTION(err::FORG0001,
218 err::FORG0001,211 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:nonNegativeInteger"));
219 ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "nonNegativeInteger" )
220 );
221 }212 }
222}213}
223214
215
224bool XercesParseUtils::parseXSUnsignedByte(216bool XercesParseUtils::parseXSUnsignedByte(
225 const zstring& textValue,217 const zstring& textValue,
226 store::Item_t &result)218 store::Item_t &result)
@@ -243,13 +235,12 @@
243 }235 }
244 else236 else
245 {237 {
246 throw XQUERY_EXCEPTION(238 throw XQUERY_EXCEPTION(err::FORG0001,
247 err::FORG0001, 239 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:unsignedByte"));
248 ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "unsignedByte" )
249 );
250 }240 }
251}241}
252242
243
253bool XercesParseUtils::parseXSUnsignedShort(244bool XercesParseUtils::parseXSUnsignedShort(
254 const zstring& textValue,245 const zstring& textValue,
255 store::Item_t &result)246 store::Item_t &result)
@@ -272,12 +263,12 @@
272 }263 }
273 else264 else
274 {265 {
275 throw XQUERY_EXCEPTION(266 throw XQUERY_EXCEPTION(err::FORG0001,
276 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "unsignedShort" )267 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:unsignedShort"));
277 );
278 }268 }
279}269}
280270
271
281bool XercesParseUtils::parseXSUnsignedInt(272bool XercesParseUtils::parseXSUnsignedInt(
282 const zstring& textValue,273 const zstring& textValue,
283 store::Item_t &result)274 store::Item_t &result)
@@ -300,14 +291,15 @@
300 }291 }
301 else292 else
302 {293 {
303 throw XQUERY_EXCEPTION(294 throw XQUERY_EXCEPTION(err::FORG0001,
304 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "unsignedInt" )295 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:unsignedInt"));
305 );
306 }296 }
307}297}
308298
299
309bool XercesParseUtils::parseXSUnsignedLong(300bool XercesParseUtils::parseXSUnsignedLong(
310 const zstring& textValue, store::Item_t &result)301 const zstring& textValue,
302 store::Item_t &result)
311{303{
312 XMLCh* content = XMLString::transcode(textValue.c_str()); 304 XMLCh* content = XMLString::transcode(textValue.c_str());
313 XSValue::DataType datatype = XSValue::dt_unsignedLong;305 XSValue::DataType datatype = XSValue::dt_unsignedLong;
@@ -327,13 +319,12 @@
327 }319 }
328 else320 else
329 {321 {
330 throw XQUERY_EXCEPTION(322 throw XQUERY_EXCEPTION(err::FORG0001,
331 err::FORG0001, 323 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:unsignedLong"));
332 ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "unsignedLong" )
333 );
334 }324 }
335}325}
336326
327
337bool XercesParseUtils::parseXSByte(328bool XercesParseUtils::parseXSByte(
338 const zstring& textValue,329 const zstring& textValue,
339 store::Item_t &result)330 store::Item_t &result)
@@ -356,12 +347,12 @@
356 }347 }
357 else348 else
358 {349 {
359 throw XQUERY_EXCEPTION(350 throw XQUERY_EXCEPTION(err::FORG0001,
360 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "byte" )351 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:byte"));
361 );
362 }352 }
363}353}
364354
355
365bool XercesParseUtils::parseXSShort(356bool XercesParseUtils::parseXSShort(
366 const zstring& textValue,357 const zstring& textValue,
367 store::Item_t &result)358 store::Item_t &result)
@@ -384,12 +375,12 @@
384 }375 }
385 else376 else
386 {377 {
387 throw XQUERY_EXCEPTION(378 throw XQUERY_EXCEPTION(err::FORG0001,
388 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "short" )379 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:short"));
389 );
390 }380 }
391}381}
392382
383
393bool XercesParseUtils::parseXSInt(384bool XercesParseUtils::parseXSInt(
394 const zstring& textValue,385 const zstring& textValue,
395 store::Item_t &result)386 store::Item_t &result)
@@ -412,12 +403,12 @@
412 }403 }
413 else404 else
414 {405 {
415 throw XQUERY_EXCEPTION(406 throw XQUERY_EXCEPTION(err::FORG0001,
416 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "int" )407 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:int"));
417 );
418 }408 }
419}409}
420410
411
421bool XercesParseUtils::parseXSLong(412bool XercesParseUtils::parseXSLong(
422 const zstring& textValue,413 const zstring& textValue,
423 store::Item_t &result)414 store::Item_t &result)
@@ -440,12 +431,12 @@
440 }431 }
441 else432 else
442 {433 {
443 throw XQUERY_EXCEPTION(434 throw XQUERY_EXCEPTION(err::FORG0001,
444 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "long" )435 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:long"));
445 );
446 }436 }
447}437}
448438
439
449bool XercesParseUtils::parseXSFloat(440bool XercesParseUtils::parseXSFloat(
450 const zstring& textValue,441 const zstring& textValue,
451 store::Item_t &result)442 store::Item_t &result)
@@ -470,7 +461,8 @@
470 //textValue = textValue.trim(" \n\r\t",4);461 //textValue = textValue.trim(" \n\r\t",4);
471 zstring textValue2;462 zstring textValue2;
472 utf8::normalize_whitespace(textValue, &textValue2);463 utf8::normalize_whitespace(textValue, &textValue2);
473 try {464 try
465 {
474 xs_float const n(textValue2.c_str());466 xs_float const n(textValue2.c_str());
475 return GENV_ITEMFACTORY->createFloat(result, n);467 return GENV_ITEMFACTORY->createFloat(result, n);
476 }468 }
@@ -479,11 +471,11 @@
479 }471 }
480 }472 }
481473
482 throw XQUERY_EXCEPTION(474 throw XQUERY_EXCEPTION(err::FORG0001,
483 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "float" )475 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:float"));
484 );
485}476}
486477
478
487bool XercesParseUtils::parseXSDouble(479bool XercesParseUtils::parseXSDouble(
488 const zstring& textValue,480 const zstring& textValue,
489 store::Item_t &result)481 store::Item_t &result)
@@ -517,11 +509,11 @@
517 }509 }
518 }510 }
519511
520 throw XQUERY_EXCEPTION(512 throw XQUERY_EXCEPTION(err::FORG0001,
521 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "double" )513 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:double"));
522 );
523}514}
524515
516
525bool XercesParseUtils::parseXSDecimal(517bool XercesParseUtils::parseXSDecimal(
526 const zstring& textValue,518 const zstring& textValue,
527 store::Item_t &result)519 store::Item_t &result)
@@ -542,12 +534,12 @@
542 }534 }
543 else535 else
544 {536 {
545 throw XQUERY_EXCEPTION(537 throw XQUERY_EXCEPTION(err::FORG0001,
546 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "decimal" )538 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:decimal"));
547 );
548 }539 }
549}540}
550541
542
551// string types543// string types
552bool XercesParseUtils::parseXSString(544bool XercesParseUtils::parseXSString(
553 const zstring& textValue,545 const zstring& textValue,
@@ -560,6 +552,7 @@
560 return factory->createString(result, textValue2);552 return factory->createString(result, textValue2);
561}553}
562554
555
563bool XercesParseUtils::parseXSNormalizedString(556bool XercesParseUtils::parseXSNormalizedString(
564 const zstring& textValue,557 const zstring& textValue,
565 store::Item_t &result)558 store::Item_t &result)
@@ -600,9 +593,8 @@
600 }593 }
601 else594 else
602 {595 {
603 throw XQUERY_EXCEPTION(596 throw XQUERY_EXCEPTION(err::FORG0001,
604 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "NMToken" )597 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:NMToken"));
605 );
606 }598 }
607}599}
608600
@@ -629,9 +621,8 @@
629 }621 }
630 else622 else
631 {623 {
632 throw XQUERY_EXCEPTION(624 throw XQUERY_EXCEPTION(err::FORG0001,
633 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "NMToken" )625 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:NMToken"));
634 );
635 }626 }
636}627}
637628
@@ -659,9 +650,8 @@
659 }650 }
660 else651 else
661 {652 {
662 throw XQUERY_EXCEPTION(653 throw XQUERY_EXCEPTION(err::FORG0001,
663 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "Name" )654 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:Name"));
664 );
665 }655 }
666}656}
667657
@@ -688,9 +678,8 @@
688 }678 }
689 else679 else
690 {680 {
691 throw XQUERY_EXCEPTION(681 throw XQUERY_EXCEPTION(err::FORG0001,
692 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "NCName" )682 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:NCName"));
693 );
694 }683 }
695}684}
696685
@@ -717,9 +706,8 @@
717 }706 }
718 else707 else
719 {708 {
720 throw XQUERY_EXCEPTION(709 throw XQUERY_EXCEPTION(err::FORG0001,
721 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "ID" )710 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:ID"));
722 );
723 }711 }
724}712}
725713
@@ -746,9 +734,8 @@
746 }734 }
747 else735 else
748 {736 {
749 throw XQUERY_EXCEPTION(737 throw XQUERY_EXCEPTION(err::FORG0001,
750 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "IDREF" )738 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:IDREF"));
751 );
752 }739 }
753}740}
754741
@@ -775,9 +762,8 @@
775 }762 }
776 else763 else
777 {764 {
778 throw XQUERY_EXCEPTION(765 throw XQUERY_EXCEPTION(err::FORG0001,
779 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "ENTITY" )766 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:ENTITY"));
780 );
781 }767 }
782}768}
783769
@@ -804,9 +790,8 @@
804 }790 }
805 else791 else
806 {792 {
807 throw XQUERY_EXCEPTION(793 throw XQUERY_EXCEPTION(err::FORG0001,
808 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "NOTATION" )794 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:NOTATION"));
809 );
810 }795 }
811}796}
812797
@@ -855,9 +840,8 @@
855 }840 }
856 }841 }
857842
858 throw XQUERY_EXCEPTION(843 throw XQUERY_EXCEPTION(err::FORG0001,
859 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "dateTime" )844 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:dateTime"));
860 );
861}845}
862846
863847
@@ -896,9 +880,8 @@
896 }880 }
897 }881 }
898882
899 throw XQUERY_EXCEPTION(883 throw XQUERY_EXCEPTION(err::FORG0001,
900 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "date" )884 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:date"));
901 );
902}885}
903886
904887
@@ -942,9 +925,8 @@
942 }925 }
943 }926 }
944927
945 throw XQUERY_EXCEPTION(928 throw XQUERY_EXCEPTION(err::FORG0001,
946 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "time" )929 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:time"));
947 );
948}930}
949931
950932
@@ -978,9 +960,8 @@
978 }960 }
979 }961 }
980962
981 throw XQUERY_EXCEPTION(963 throw XQUERY_EXCEPTION(err::FORG0001,
982 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gYearMonth" )964 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gYearMonth"));
983 );
984}965}
985966
986967
@@ -1013,9 +994,8 @@
1013 }994 }
1014 }995 }
1015 996
1016 throw XQUERY_EXCEPTION(997 throw XQUERY_EXCEPTION(err::FORG0001,
1017 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gYear" )998 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gYear"));
1018 );
1019}999}
10201000
10211001
@@ -1048,9 +1028,8 @@
1048 }1028 }
1049 }1029 }
10501030
1051 throw XQUERY_EXCEPTION(1031 throw XQUERY_EXCEPTION(err::FORG0001,
1052 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gMonthDay" )1032 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gMonthDay"));
1053 );
1054}1033}
10551034
10561035
@@ -1082,9 +1061,8 @@
1082 }1061 }
1083 }1062 }
10841063
1085 throw XQUERY_EXCEPTION(1064 throw XQUERY_EXCEPTION(err::FORG0001,
1086 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gDay" )1065 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gDay"));
1087 );
1088}1066}
10891067
10901068
@@ -1116,9 +1094,8 @@
1116 }1094 }
1117 }1095 }
11181096
1119 throw XQUERY_EXCEPTION(1097 throw XQUERY_EXCEPTION(err::FORG0001,
1120 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "gDay" )1098 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:gDay"));
1121 );
1122}1099}
11231100
11241101
@@ -1154,9 +1131,8 @@
1154 return factory->createDuration(result, &tValue);1131 return factory->createDuration(result, &tValue);
1155 }1132 }
11561133
1157 throw XQUERY_EXCEPTION(1134 throw XQUERY_EXCEPTION(err::FORG0001,
1158 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "duration" )1135 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:duration"));
1159 );
1160}1136}
11611137
11621138
@@ -1172,10 +1148,8 @@
1172 return factory->createYearMonthDuration(result, &d);1148 return factory->createYearMonthDuration(result, &d);
1173 }1149 }
11741150
1175 throw XQUERY_EXCEPTION(1151 throw XQUERY_EXCEPTION(err::FORG0001,
1176 err::FORG0001,1152 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:yearMonthDuration"));
1177 ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "yearMonthDuration" )
1178 );
1179}1153}
11801154
11811155
@@ -1191,10 +1165,8 @@
1191 return factory->createDayTimeDuration(result, &d);1165 return factory->createDayTimeDuration(result, &d);
1192 }1166 }
11931167
1194 throw XQUERY_EXCEPTION(1168 throw XQUERY_EXCEPTION(err::FORG0001,
1195 err::FORG0001,1169 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:dayTimeDuration"));
1196 ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "dayTimeDuration" )
1197 );
1198}1170}
11991171
12001172
@@ -1241,10 +1213,8 @@
1241 return factory->createBase64Binary(result, tValue);1213 return factory->createBase64Binary(result, tValue);
1242 }1214 }
12431215
1244 throw XQUERY_EXCEPTION(1216 throw XQUERY_EXCEPTION(err::FORG0001,
1245 err::FORG0001,1217 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:base64Binary"));
1246 ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "base64Binary" )
1247 );
1248}1218}
12491219
12501220
@@ -1269,9 +1239,8 @@
1269 return factory->createHexBinary(result, tValue);1239 return factory->createHexBinary(result, tValue);
1270 }1240 }
12711241
1272 throw XQUERY_EXCEPTION(1242 throw XQUERY_EXCEPTION(err::FORG0001,
1273 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "hexBinary" )1243 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:hexBinary"));
1274 );
1275}1244}
12761245
12771246
@@ -1296,9 +1265,8 @@
1296 return factory->createAnyURI(result, textValue2);1265 return factory->createAnyURI(result, textValue2);
1297 }1266 }
12981267
1299 throw XQUERY_EXCEPTION(1268 throw XQUERY_EXCEPTION(err::FORG0001,
1300 err::FORG0001, ERROR_PARAMS( textValue, ZED( NoCastTo_34o ), "anyURI" )1269 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, "xs:anyURI"));
1301 );
1302}1270}
13031271
13041272
13051273
=== modified file 'src/types/schema/schema.cpp'
--- src/types/schema/schema.cpp 2013-01-08 08:34:08 +0000
+++ src/types/schema/schema.cpp 2013-01-11 00:47:24 +0000
@@ -1691,7 +1691,7 @@
1691 if (!xsiTypeDV)1691 if (!xsiTypeDV)
1692 {1692 {
1693 RAISE_ERROR(err::FORG0001, loc,1693 RAISE_ERROR(err::FORG0001, loc,
1694 ERROR_PARAMS(targetType, ZED(NoTypeInCtx)));1694 ERROR_PARAMS(ZED(FORG0001_NoTypeInCtx_2), targetType->toSchemaString()));
1695 }1695 }
16961696
1697 // workaround for validating xs:NOTATION with Xerces1697 // workaround for validating xs:NOTATION with Xerces
@@ -1712,8 +1712,8 @@
1712 }1712 }
1713 else1713 else
1714 {1714 {
1715 ZORBA_ERROR_DESC_OSS(err::FORG0001, "Prefix '" << prefix <<1715 RAISE_ERROR(err::FORG0001, loc,
1716 "' not found in current namespace context.");1716 ERROR_PARAMS(ZED(FORG0001_PrefixNotBound_2), prefix));
1717 }1717 }
1718 }1718 }
1719 else1719 else
@@ -1725,7 +1725,7 @@
1725 else1725 else
1726 {1726 {
1727 RAISE_ERROR(err::FORG0001, loc,1727 RAISE_ERROR(err::FORG0001, loc,
1728 ERROR_PARAMS(targetType, ZED(NoTypeInCtx)));1728 ERROR_PARAMS(ZED(FORG0001_NoTypeInCtx_2), targetType->toSchemaString()));
1729 }1729 }
1730 }1730 }
1731 catch (XMLException& idve)1731 catch (XMLException& idve)
@@ -1734,7 +1734,10 @@
1734 transcode(idve.getMessage(), msg);1734 transcode(idve.getMessage(), msg);
17351735
1736 RAISE_ERROR(err::FORG0001, loc,1736 RAISE_ERROR(err::FORG0001, loc,
1737 ERROR_PARAMS(textValue, ZED(NoCastTo_34o), targetType, msg));1737 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o),
1738 textValue,
1739 targetType->toSchemaString(),
1740 msg));
1738 }1741 }
1739 catch(const OutOfMemoryException&)1742 catch(const OutOfMemoryException&)
1740 {1743 {
@@ -1831,7 +1834,7 @@
1831 if (atomicTextValues.empty())1834 if (atomicTextValues.empty())
1832 {1835 {
1833 RAISE_ERROR(err::FORG0001, loc,1836 RAISE_ERROR(err::FORG0001, loc,
1834 ERROR_PARAMS(textValue, ZED(NoCastTo_34o), udt->toSchemaString()));1837 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, udt->toSchemaString()));
1835 }1838 }
18361839
1837 for (csize i = 0; i < atomicTextValues.size() ; ++i)1840 for (csize i = 0; i < atomicTextValues.size() ; ++i)
@@ -1881,7 +1884,7 @@
1881 }1884 }
18821885
1883 RAISE_ERROR(err::FORG0001, loc,1886 RAISE_ERROR(err::FORG0001, loc,
1884 ERROR_PARAMS(textValue, ZED(NoCastTo_34o), udt->toSchemaString()));1887 ERROR_PARAMS(ZED(FORG0001_NoCastTo_234o), textValue, udt->toSchemaString()));
1885}1888}
18861889
18871890
@@ -1906,8 +1909,7 @@
1906 const UserDefinedXQType* udXQType =1909 const UserDefinedXQType* udXQType =
1907 static_cast<const UserDefinedXQType*>(aTargetType.getp());1910 static_cast<const UserDefinedXQType*>(aTargetType.getp());
19081911
1909 ZORBA_ASSERT( udXQType->isAtomic() || udXQType->isList() ||1912 ZORBA_ASSERT(udXQType->isAtomic() || udXQType->isList() || udXQType->isUnion());
1910 udXQType->isUnion() );
19111913
19121914
1913 switch ( udXQType->getTypeCategory() )1915 switch ( udXQType->getTypeCategory() )
19141916
=== modified file 'src/zorbatypes/URI.cpp'
--- src/zorbatypes/URI.cpp 2012-09-19 21:16:15 +0000
+++ src/zorbatypes/URI.cpp 2013-01-11 00:47:24 +0000
@@ -945,26 +945,30 @@
945 {945 {
946 if ( lIndex + 2 >= lEnd )946 if ( lIndex + 2 >= lEnd )
947 {947 {
948 throw XQUERY_EXCEPTION(948 throw XQUERY_EXCEPTION(err::XQST0046,
949 err::XQST0046, ERROR_PARAMS( uri, ZED( BadHexSequence ) )949 ERROR_PARAMS(uri, ZED(BadHexSequence)));
950 );
951 }950 }
951
952 unicode::code_point lHex1 = lCodepoints[++lIndex];952 unicode::code_point lHex1 = lCodepoints[++lIndex];
953 if(!ascii::is_xdigit(lHex1))953
954 throw XQUERY_EXCEPTION(954 if (!ascii::is_xdigit(lHex1))
955 err::XQST0046, ERROR_PARAMS( uri, ZED( BadHexDigit_3 ), lHex1 )955 {
956 );956 throw XQUERY_EXCEPTION(err::XQST0046,
957 ERROR_PARAMS(uri, ZED(XQST0046_BadHexDigit_3), lHex1));
958 }
959
957 unicode::code_point lHex2 = lCodepoints[++lIndex];960 unicode::code_point lHex2 = lCodepoints[++lIndex];
958 if(!ascii::is_xdigit(lHex2))961
959 throw XQUERY_EXCEPTION(962 if (!ascii::is_xdigit(lHex2))
960 err::XQST0046, ERROR_PARAMS( uri, ZED( BadHexDigit_3 ), lHex2 )963 {
961 );964 throw XQUERY_EXCEPTION(err::XQST0046,
965 ERROR_PARAMS(uri, ZED(XQST0046_BadHexDigit_3), lHex2));
966 }
962 }967 }
963 else if (!is_unreserved_char(lCp) && !is_path_character(lCp) && valid)968 else if (!is_unreserved_char(lCp) && !is_path_character(lCp) && valid)
964 {969 {
965 throw XQUERY_EXCEPTION(970 throw XQUERY_EXCEPTION(err::XQST0046,
966 err::XQST0046, ERROR_PARAMS( uri, ZED( BadUnicodeChar_3 ), lCp )971 ERROR_PARAMS(uri, ZED(BadUnicodeChar_3), lCp));
967 );
968 }972 }
969 ++lIndex;973 ++lIndex;
970 }974 }
971975
=== modified file 'src/zorbatypes/binary.cpp'
--- src/zorbatypes/binary.cpp 2012-09-19 21:16:15 +0000
+++ src/zorbatypes/binary.cpp 2013-01-11 00:47:24 +0000
@@ -28,16 +28,16 @@
28#include "util/base64_util.h"28#include "util/base64_util.h"
29#include "util/stl_util.h"29#include "util/stl_util.h"
3030
31#define CATCH_BASE64_EXCEPTION() \31#define CATCH_BASE64_EXCEPTION() \
32 catch ( base64::exception const &e ) { \32 catch (const base64::exception& e) \
33 throw XQUERY_EXCEPTION( \33 { \
34 err::FORG0001, ERROR_PARAMS( e.invalid_char(), ZED( Base64BadChar ) ) \34 throw XQUERY_EXCEPTION(err::FORG0001, \
35 ); \35 ERROR_PARAMS(ZED(FORG0001_Base64BadChar_2), e.invalid_char())); \
36 } \36 } \
37 catch ( std::invalid_argument const& ) { \37 catch (const std::invalid_argument& ) \
38 throw XQUERY_EXCEPTION( \38 { \
39 err::FORG0001, ERROR_PARAMS( "", ZED( Base64Multiple4 ) ) \39 throw XQUERY_EXCEPTION(err::FORG0001, \
40 ); \40 ERROR_PARAMS(ZED(FORG0001_Base64Multiple4))); \
41 }41 }
4242
43using namespace std;43using namespace std;
@@ -330,9 +330,8 @@
330330
331 if (len % 2 != 0) 331 if (len % 2 != 0)
332 {332 {
333 throw XQUERY_EXCEPTION(333 throw XQUERY_EXCEPTION(err::FORG0001,
334 err::FORG0001, ERROR_PARAMS( "", ZED( HexBinaryMustBeEven ) )334 ERROR_PARAMS(ZED(FORG0001_HexBinaryMustBeEven)));
335 );
336 }335 }
337336
338 for (size_t i = 0; i < len; ++i)337 for (size_t i = 0; i < len; ++i)
@@ -349,9 +348,8 @@
349 }348 }
350 else349 else
351 {350 {
352 throw XQUERY_EXCEPTION(351 throw XQUERY_EXCEPTION(err::FORG0001,
353 err::FORG0001, ERROR_PARAMS( lChar, ZED( BadHexDigit_3 ), lChar )352 ERROR_PARAMS(ZED(FORG0001_BadHexDigit_2), lChar));
354 );
355 }353 }
356 }354 }
357}355}
358356
=== modified file 'test/rbkt/ExpQueryResults/zorba/trycatch/trycatch4.xml.res'
--- test/rbkt/ExpQueryResults/zorba/trycatch/trycatch4.xml.res 2012-09-19 21:16:15 +0000
+++ test/rbkt/ExpQueryResults/zorba/trycatch/trycatch4.xml.res 2013-01-11 00:47:24 +0000
@@ -1,1 +1,1 @@
1Ha! It worked err:FORG0001 "xs:string": invalid value for cast/constructor: can not cast to "xs:integer"1Ha! It worked err:FORG0001 "a": value of type xs:string is not castable to type xs:integer

Subscribers

People subscribed via source and target branches