You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mu...@apache.org on 2023/10/28 12:27:38 UTC
(xalan-java) branch xalan-j_xslt3.0 updated: committing refactoring of codebase, to address the issues raised within the jira issue https://issues.apache.org/jira/browse/XALANJ-2705. please study this commit in detail, about how we've addressed this issue.
This is an automated email from the ASF dual-hosted git repository.
mukulg pushed a commit to branch xalan-j_xslt3.0
in repository https://gitbox.apache.org/repos/asf/xalan-java.git
The following commit(s) were added to refs/heads/xalan-j_xslt3.0 by this push:
new dd97be57 committing refactoring of codebase, to address the issues raised within the jira issue https://issues.apache.org/jira/browse/XALANJ-2705. please study this commit in detail, about how we've addressed this issue.
new 94b9a8af Merge pull request #111 from mukulga/xalan-j_xslt3.0_mukul
dd97be57 is described below
commit dd97be573d65f20cd2e7e5dbae307eebcebd48c5
Author: Mukul Gandhi <ga...@gmail.com>
AuthorDate: Sat Oct 28 17:47:47 2023 +0530
committing refactoring of codebase, to address the issues raised within the jira issue https://issues.apache.org/jira/browse/XALANJ-2705. please study this commit in detail, about how we've addressed this issue.
---
.classpath | 3 +
.gitignore | 11 +-
.settings/org.eclipse.jdt.core.prefs | 254 ------
...2.processor_1.2.1.html => LICENSE.EPL_v1.0.html | 0
NOTICE.txt | 12 +-
build.xml | 23 +-
lib/xpath31_types.jar | Bin 0 -> 47567 bytes
src/org/apache/xalan/templates/AVTPartXPath.java | 3 +-
src/org/apache/xalan/templates/ElemChoose.java | 3 +-
src/org/apache/xalan/templates/ElemCopyOf.java | 7 +-
.../apache/xalan/templates/ElemForEachGroup.java | 33 +-
src/org/apache/xalan/templates/ElemFunction.java | 27 +-
src/org/apache/xalan/templates/ElemIf.java | 3 +-
.../apache/xalan/templates/ElemLiteralResult.java | 3 +-
src/org/apache/xalan/templates/ElemSequence.java | 5 +-
src/org/apache/xalan/templates/ElemValueOf.java | 5 +-
src/org/apache/xalan/templates/ElemVariable.java | 5 +-
.../xalan/templates/XSConstructorFunctionUtil.java | 29 +-
.../xslt/util/XslTransformEvaluationHelper.java | 7 +-
src/org/apache/xml/dtm/DTMManager.java | 3 +-
src/org/apache/xpath/XPath.java | 3 +-
src/org/apache/xpath/XPathContext.java | 5 +-
src/org/apache/xpath/axes/PredicatedNodeTest.java | 3 +-
src/org/apache/xpath/compiler/OpCodes.java | 9 +-
src/org/apache/xpath/composite/QuantifiedExpr.java | 3 +-
.../xpath/composite/SequenceTypeSupport.java | 35 +-
.../xpath/composite/SimpleSequenceConstructor.java | 3 +-
.../xpath/functions/FuncCodePointsToString.java | 3 +-
.../apache/xpath/functions/FuncCodepointEqual.java | 5 +-
src/org/apache/xpath/functions/FuncCompare.java | 3 +-
src/org/apache/xpath/functions/FuncConcat.java | 3 +-
.../apache/xpath/functions/FuncContainsToken.java | 3 +-
.../apache/xpath/functions/FuncCurrentDate.java | 3 +-
.../xpath/functions/FuncCurrentDateTime.java | 3 +-
.../apache/xpath/functions/FuncCurrentTime.java | 3 +-
src/org/apache/xpath/functions/FuncData.java | 9 +-
.../xpath/functions/FuncDaysFromDuration.java | 5 +-
.../apache/xpath/functions/FuncDistinctValues.java | 7 +-
.../xpath/functions/FuncHoursFromDuration.java | 5 +-
.../xpath/functions/FuncImplicitTimezone.java | 3 +-
src/org/apache/xpath/functions/FuncIndexOf.java | 9 +-
.../apache/xpath/functions/FuncInsertBefore.java | 3 +-
src/org/apache/xpath/functions/FuncMax.java | 17 +-
src/org/apache/xpath/functions/FuncMin.java | 17 +-
.../xpath/functions/FuncMinutesFromDuration.java | 5 +-
.../xpath/functions/FuncMonthsFromDuration.java | 5 +-
src/org/apache/xpath/functions/FuncRemove.java | 3 +-
.../xpath/functions/FuncSecondsFromDuration.java | 5 +-
src/org/apache/xpath/functions/FuncStringJoin.java | 7 +-
.../xpath/functions/FuncStringToCodepoints.java | 3 +-
.../apache/xpath/functions/FuncSubsequence.java | 3 +-
src/org/apache/xpath/functions/FuncSubstring.java | 3 +-
.../xpath/functions/FuncYearsFromDuration.java | 5 +-
.../XPathHigherOrderBuiltinFunctionsSupport.java | 5 +-
.../apache/xpath/functions/math/FuncMathAcos.java | 5 +-
.../apache/xpath/functions/math/FuncMathAsin.java | 5 +-
.../apache/xpath/functions/math/FuncMathAtan.java | 5 +-
.../apache/xpath/functions/math/FuncMathAtan2.java | 5 +-
.../apache/xpath/functions/math/FuncMathCos.java | 5 +-
.../apache/xpath/functions/math/FuncMathExp.java | 5 +-
.../apache/xpath/functions/math/FuncMathExp10.java | 5 +-
.../apache/xpath/functions/math/FuncMathLog.java | 5 +-
.../apache/xpath/functions/math/FuncMathLog10.java | 5 +-
.../apache/xpath/functions/math/FuncMathPi.java | 3 +-
.../apache/xpath/functions/math/FuncMathPow.java | 5 +-
.../apache/xpath/functions/math/FuncMathSin.java | 5 +-
.../apache/xpath/functions/math/FuncMathSqrt.java | 5 +-
.../apache/xpath/functions/math/FuncMathTan.java | 5 +-
src/org/apache/xpath/objects/ResultSequence.java | 2 +-
src/org/apache/xpath/objects/XNodeSet.java | 3 +-
src/org/apache/xpath/objects/XNumber.java | 3 +-
src/org/apache/xpath/objects/XObject.java | 23 +-
src/org/apache/xpath/operations/Div.java | 7 +-
src/org/apache/xpath/operations/InstanceOf.java | 33 +-
src/org/apache/xpath/operations/Minus.java | 11 +-
src/org/apache/xpath/operations/Mod.java | 3 +-
src/org/apache/xpath/operations/Mult.java | 11 +-
src/org/apache/xpath/operations/Neg.java | 3 +-
src/org/apache/xpath/operations/Plus.java | 15 +-
src/org/apache/xpath/operations/Range.java | 5 +-
.../apache/xpath/operations/SimpleMapOperator.java | 3 +-
.../apache/xpath/xs/types/XPath3DecimalFormat.java | 130 ---
src/org/apache/xpath/xs/types/XSAnyAtomicType.java | 52 --
src/org/apache/xpath/xs/types/XSAnySimpleType.java | 32 -
src/org/apache/xpath/xs/types/XSAnyType.java | 56 --
src/org/apache/xpath/xs/types/XSBoolean.java | 140 ----
src/org/apache/xpath/xs/types/XSCalendarType.java | 56 --
src/org/apache/xpath/xs/types/XSCtrType.java | 65 --
src/org/apache/xpath/xs/types/XSDate.java | 430 ----------
src/org/apache/xpath/xs/types/XSDateTime.java | 928 ---------------------
.../apache/xpath/xs/types/XSDayTimeDuration.java | 347 --------
src/org/apache/xpath/xs/types/XSDecimal.java | 169 ----
src/org/apache/xpath/xs/types/XSDouble.java | 211 -----
src/org/apache/xpath/xs/types/XSDuration.java | 482 -----------
src/org/apache/xpath/xs/types/XSFloat.java | 202 -----
src/org/apache/xpath/xs/types/XSInt.java | 113 ---
src/org/apache/xpath/xs/types/XSInteger.java | 176 ----
src/org/apache/xpath/xs/types/XSLong.java | 112 ---
src/org/apache/xpath/xs/types/XSNumericType.java | 55 --
src/org/apache/xpath/xs/types/XSString.java | 131 ---
src/org/apache/xpath/xs/types/XSTime.java | 442 ----------
src/org/apache/xpath/xs/types/XSUntyped.java | 78 --
src/org/apache/xpath/xs/types/XSUntypedAtomic.java | 95 ---
.../apache/xpath/xs/types/XSYearMonthDuration.java | 423 ----------
tests/fn_sort/gold/test10.out | 6 +-
tests/grouping/gold/test14.out | 2 +-
tests/grouping/sort/gold/test1.out | 2 +-
107 files changed, 342 insertions(+), 5425 deletions(-)
diff --git a/.classpath b/.classpath
index b4678427..f9a20b6a 100644
--- a/.classpath
+++ b/.classpath
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="tests"/>
<classpathentry kind="lib" path="lib/runtime.jar"/>
<classpathentry kind="lib" path="lib/regexp.jar"/>
<classpathentry kind="lib" path="tools/java_cup.jar"/>
@@ -11,6 +12,8 @@
<classpathentry kind="lib" path="lib/bsf.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
<classpathentry kind="lib" path="lib/rhino-1.7.14.jar"/>
+ <classpathentry kind="lib" path="lib/xpath31_types.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
diff --git a/.gitignore b/.gitignore
index f4d30d4c..adf03812 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,9 @@
-/bin/
-/build/
\ No newline at end of file
+/build/
+/.metadata/
+/src/org/apache/xalan/Version.java
+/src/org/apache/xalan/processor/XSLProcessorVersion.java
+/src/org/apache/xalan/xsltc/compiler/XPathLexer.java
+/src/org/apache/xalan/xsltc/compiler/XPathParser.java
+/src/org/apache/xalan/xsltc/compiler/sym.java
+/src/org/apache/xml/serializer/Version.java
+/xdocs/sources/entities.ent
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
index 5917cfb9..0fee6a9c 100644
--- a/.settings/org.eclipse.jdt.core.prefs
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -13,257 +13,3 @@ org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
-org.eclipse.jdt.core.formatter.lineSplit=80
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
diff --git a/LICENSE.org.eclipse.wst.xml.xpath2.processor_1.2.1.html b/LICENSE.EPL_v1.0.html
similarity index 100%
rename from LICENSE.org.eclipse.wst.xml.xpath2.processor_1.2.1.html
rename to LICENSE.EPL_v1.0.html
diff --git a/NOTICE.txt b/NOTICE.txt
index 7711900b..18237afd 100644
--- a/NOTICE.txt
+++ b/NOTICE.txt
@@ -70,13 +70,15 @@
software copyright (c) 1999.
=========================================================================
- Eclipse Web Tools Platform Project (https://projects.eclipse.org/projects/webtools)
+ Eclipse Web Tools Platform (WTP) Project (https://projects.eclipse.org/projects/webtools)
- Few of the algorithms for XPath expressions implementation and XML Schema
- data types implementation, for the XPath 3.1 processor have been borrowed
- from Eclipse Foundation's Web Tools Platform (WTP)'s XPath 2.0 processor.
+ This project reuses with few source code adaptations, of WTP's XPath 2.0 processor's
+ XML Schema datatypes implementation.
- See - LICENSE.org.eclipse.wst.xml.xpath2.processor_1.2.1.html
+ The source code that XalanJ's XSLT 3.0 and XPath 3.1 processors use for this dependency
+ is located at : https://github.com/xercesj/xalanj_xpath31_types.
+
+ See - LICENSE.EPL_v1.0.html
=========================================================================
Apache xml-commons xml-apis (redistribution of xml-apis.jar)
diff --git a/build.xml b/build.xml
index 55c7d38e..13a4ae8e 100644
--- a/build.xml
+++ b/build.xml
@@ -99,16 +99,18 @@ $Id$
<property name="xsltc.reldir" value="${xalan.reldir}/xsltc"/>
<!-- Jars to run Xalan Java (Interpretive, Compiled, or both) -->
- <property name="xmlapis.jar.name" value="xml-apis.jar"/>
- <property name="xmlapis.jar" value="${endorsed.dir}/${xmlapis.jar.name}"/>
- <property name="parser.jar.name" value="xercesImpl.jar"/>
- <property name="parser.jar" value="${endorsed.dir}/${parser.jar.name}"/>
- <property name="bcel.jar.name" value="bcel-6.7.0.jar"/>
- <property name="bcel.jar" value="${lib.dir}/${bcel.jar.name}"/>
- <property name="runtime.jar.name" value="runtime.jar"/>
- <property name="runtime.jar" value="${lib.dir}/${runtime.jar.name}"/>
- <property name="regexp.jar.name" value="regexp.jar"/>
- <property name="regexp.jar" value="${lib.dir}/${regexp.jar.name}"/>
+ <property name="xmlapis.jar.name" value="xml-apis.jar"/>
+ <property name="xmlapis.jar" value="${endorsed.dir}/${xmlapis.jar.name}"/>
+ <property name="parser.jar.name" value="xercesImpl.jar"/>
+ <property name="parser.jar" value="${endorsed.dir}/${parser.jar.name}"/>
+ <property name="bcel.jar.name" value="bcel-6.7.0.jar"/>
+ <property name="bcel.jar" value="${lib.dir}/${bcel.jar.name}"/>
+ <property name="xalanj_xpath31_types.jar.name" value="xpath31_types.jar"/>
+ <property name="xalanj_xpath31_types.jar" value="${lib.dir}/${xalanj_xpath31_types.jar.name}"/>
+ <property name="runtime.jar.name" value="runtime.jar"/>
+ <property name="runtime.jar" value="${lib.dir}/${runtime.jar.name}"/>
+ <property name="regexp.jar.name" value="regexp.jar"/>
+ <property name="regexp.jar" value="${lib.dir}/${regexp.jar.name}"/>
<!-- Jars to build Xalan Java (Interpretive, Compiled, or both) or build the docs -->
<property name="java_cup.jar.name" value="java_cup.jar"/>
@@ -231,6 +233,7 @@ $Id$
<pathelement location="${xmlapis.jar}" />
<pathelement location="${build.serializer.jar}" />
<pathelement location="${parser.jar}" />
+ <pathelement location="${xalanj_xpath31_types.jar}" />
</path>
<path id="xslt.boot.class.path">
<!-- Put this version of xalan in front of the jdk's for JDK 1.4+ -->
diff --git a/lib/xpath31_types.jar b/lib/xpath31_types.jar
new file mode 100644
index 00000000..a64586bb
Binary files /dev/null and b/lib/xpath31_types.jar differ
diff --git a/src/org/apache/xalan/templates/AVTPartXPath.java b/src/org/apache/xalan/templates/AVTPartXPath.java
index c1f19d77..3deee3c2 100644
--- a/src/org/apache/xalan/templates/AVTPartXPath.java
+++ b/src/org/apache/xalan/templates/AVTPartXPath.java
@@ -26,7 +26,8 @@ import org.apache.xpath.XPathContext;
import org.apache.xpath.XPathFactory;
import org.apache.xpath.compiler.XPathParser;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSAnyType;
+
+import xml.xpath31.processor.types.XSAnyType;
/**
* Simple string part of a complex AVT.
diff --git a/src/org/apache/xalan/templates/ElemChoose.java b/src/org/apache/xalan/templates/ElemChoose.java
index 8303a93e..74704646 100644
--- a/src/org/apache/xalan/templates/ElemChoose.java
+++ b/src/org/apache/xalan/templates/ElemChoose.java
@@ -28,7 +28,8 @@ import org.apache.xml.dtm.DTM;
import org.apache.xml.dtm.DTMManager;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSAnyType;
+
+import xml.xpath31.processor.types.XSAnyType;
/**
* Implementation of the XSLT 3.0 xsl:choose instruction.
diff --git a/src/org/apache/xalan/templates/ElemCopyOf.java b/src/org/apache/xalan/templates/ElemCopyOf.java
index 6828b74d..f608ef28 100644
--- a/src/org/apache/xalan/templates/ElemCopyOf.java
+++ b/src/org/apache/xalan/templates/ElemCopyOf.java
@@ -42,11 +42,12 @@ import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
-import org.apache.xpath.xs.types.XSAnyAtomicType;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
import org.xml.sax.SAXException;
+import xml.xpath31.processor.types.XSAnyAtomicType;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
+
/**
* Implementation of XSLT xsl:copy-of instruction.
*
diff --git a/src/org/apache/xalan/templates/ElemForEachGroup.java b/src/org/apache/xalan/templates/ElemForEachGroup.java
index 243dea1b..2bbc8f09 100644
--- a/src/org/apache/xalan/templates/ElemForEachGroup.java
+++ b/src/org/apache/xalan/templates/ElemForEachGroup.java
@@ -48,12 +48,13 @@ import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
import org.apache.xpath.operations.Variable;
-import org.apache.xpath.xs.types.XSBoolean;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDateTime;
-import org.apache.xpath.xs.types.XSNumericType;
-import org.apache.xpath.xs.types.XSString;
-import org.apache.xpath.xs.types.XSTime;
+
+import xml.xpath31.processor.types.XSBoolean;
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDateTime;
+import xml.xpath31.processor.types.XSNumericType;
+import xml.xpath31.processor.types.XSString;
+import xml.xpath31.processor.types.XSTime;
/**
* Implementation of the XSLT 3.0 xsl:for-each-group instruction.
@@ -334,7 +335,7 @@ public class ElemForEachGroup extends ElemTemplateElement
}
/**
- * Sort given xsl:for-each-group groups.
+ * Sort the provided xsl:for-each-group groups.
*
*
* @param xctxt the XPath runtime state for the sort
@@ -730,7 +731,7 @@ public class ElemForEachGroup extends ElemTemplateElement
xctxt.pushCurrentNode(sourceNode);
}
- /*
+ /**
* A class to support, reordering the xsl:for-each-group's groups as per definition of default
* sorted order (i.e, order of first appearance) when xsl:sort elements are not present within
* xsl:for-each-group.
@@ -769,9 +770,10 @@ public class ElemForEachGroup extends ElemTemplateElement
}
- /*
+ /**
* Method to support, validating the presence and count of xsl:for-each-group
- * attributes "group-by", "group-adjacent", "group-starting-with", "group-ending-with".
+ * attributes "group-by", "group-adjacent", "group-starting-with",
+ * "group-ending-with".
*/
private int getForEachGroupGroupingAttributesCount()
throws TransformerException {
@@ -797,13 +799,14 @@ public class ElemForEachGroup extends ElemTemplateElement
return forEachGroupGroupingAttributesCount;
}
- /*
- * This method, converts xsl:for-each-group grouping key's initial computed value,
+ /**
+ * This method, converts xsl:for-each-group grouping key's initially computed value,
* into a normalized data typed value of type java.lang.Object.
*
* For the purpose of, evaluating grouping key XPath expressions for xsl:for-each-group,
- * the grouping keys are treated as of type string, number, boolean, xs:date or
- * xs:dateTime. Any other data type for grouping key is converted to a string value.
+ * the following data types are currently supported : string, number, boolean, xs:date,
+ * xs:dateTime, xs:time. Any other data type for grouping key is converted to a
+ * string value.
*/
private Object getXPathEvaluationRawResult(XObject xpathEvalResult) {
Object xpathRawResult = null;
@@ -839,7 +842,7 @@ public class ElemForEachGroup extends ElemTemplateElement
return xpathRawResult;
}
- /*
+ /**
* Get XML document source nodes (represented as an 'DTMIterator' object), from
* a list of XNodeSet objects contained within a 'ResultSequence' object.
*/
diff --git a/src/org/apache/xalan/templates/ElemFunction.java b/src/org/apache/xalan/templates/ElemFunction.java
index d27b309b..d0f5f90b 100644
--- a/src/org/apache/xalan/templates/ElemFunction.java
+++ b/src/org/apache/xalan/templates/ElemFunction.java
@@ -40,23 +40,24 @@ import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNodeSetForDOM;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XRTreeFrag;
-import org.apache.xpath.xs.types.XSBoolean;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDateTime;
-import org.apache.xpath.xs.types.XSDayTimeDuration;
-import org.apache.xpath.xs.types.XSDecimal;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSDuration;
-import org.apache.xpath.xs.types.XSFloat;
-import org.apache.xpath.xs.types.XSInt;
-import org.apache.xpath.xs.types.XSInteger;
-import org.apache.xpath.xs.types.XSLong;
-import org.apache.xpath.xs.types.XSString;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.Text;
+import xml.xpath31.processor.types.XSBoolean;
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDateTime;
+import xml.xpath31.processor.types.XSDayTimeDuration;
+import xml.xpath31.processor.types.XSDecimal;
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSDuration;
+import xml.xpath31.processor.types.XSFloat;
+import xml.xpath31.processor.types.XSInt;
+import xml.xpath31.processor.types.XSInteger;
+import xml.xpath31.processor.types.XSLong;
+import xml.xpath31.processor.types.XSString;
+import xml.xpath31.processor.types.XSYearMonthDuration;
+
/**
* Implementation of XSLT xsl:function element.
*
diff --git a/src/org/apache/xalan/templates/ElemIf.java b/src/org/apache/xalan/templates/ElemIf.java
index 9bce512b..a0f62d35 100644
--- a/src/org/apache/xalan/templates/ElemIf.java
+++ b/src/org/apache/xalan/templates/ElemIf.java
@@ -28,7 +28,8 @@ import org.apache.xml.dtm.DTMManager;
import org.apache.xpath.XPath;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSAnyType;
+
+import xml.xpath31.processor.types.XSAnyType;
/**
* The XSLT xsl:if element, is used to perform conditional processing,
diff --git a/src/org/apache/xalan/templates/ElemLiteralResult.java b/src/org/apache/xalan/templates/ElemLiteralResult.java
index 34912616..02504e14 100644
--- a/src/org/apache/xalan/templates/ElemLiteralResult.java
+++ b/src/org/apache/xalan/templates/ElemLiteralResult.java
@@ -33,7 +33,6 @@ import org.apache.xml.serializer.SerializationHandler;
import org.apache.xml.utils.StringVector;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSAnyType;
import org.w3c.dom.Attr;
import org.w3c.dom.DOMException;
import org.w3c.dom.Document;
@@ -45,6 +44,8 @@ import org.w3c.dom.TypeInfo;
import org.w3c.dom.UserDataHandler;
import org.xml.sax.SAXException;
+import xml.xpath31.processor.types.XSAnyType;
+
/**
* Implement a Literal Result Element.
* @see <a href="https://www.w3.org/TR/xslt-30/#literal-result-element">literal-result-element within XSLT 3.0 Specification</a>
diff --git a/src/org/apache/xalan/templates/ElemSequence.java b/src/org/apache/xalan/templates/ElemSequence.java
index f257229b..87681f7b 100644
--- a/src/org/apache/xalan/templates/ElemSequence.java
+++ b/src/org/apache/xalan/templates/ElemSequence.java
@@ -49,13 +49,14 @@ import org.apache.xpath.objects.XString;
import org.apache.xpath.operations.Operation;
import org.apache.xpath.operations.Range;
import org.apache.xpath.operations.SimpleMapOperator;
-import org.apache.xpath.xs.types.XSAnyAtomicType;
-import org.apache.xpath.xs.types.XSNumericType;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import com.sun.org.apache.xml.internal.dtm.DTM;
+import xml.xpath31.processor.types.XSAnyAtomicType;
+import xml.xpath31.processor.types.XSNumericType;
+
/**
* Implementation of XSLT xsl:sequence element.
*
diff --git a/src/org/apache/xalan/templates/ElemValueOf.java b/src/org/apache/xalan/templates/ElemValueOf.java
index 10e56f1b..7af69c5d 100644
--- a/src/org/apache/xalan/templates/ElemValueOf.java
+++ b/src/org/apache/xalan/templates/ElemValueOf.java
@@ -45,11 +45,12 @@ import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
import org.apache.xpath.operations.Operation;
import org.apache.xpath.operations.Variable;
-import org.apache.xpath.xs.types.XSAnyType;
-import org.apache.xpath.xs.types.XSNumericType;
import org.w3c.dom.DOMException;
import org.xml.sax.SAXException;
+import xml.xpath31.processor.types.XSAnyType;
+import xml.xpath31.processor.types.XSNumericType;
+
/**
* Implementation of XSLT xsl:value-of element.
*
diff --git a/src/org/apache/xalan/templates/ElemVariable.java b/src/org/apache/xalan/templates/ElemVariable.java
index 9d2a55f3..75d3940f 100644
--- a/src/org/apache/xalan/templates/ElemVariable.java
+++ b/src/org/apache/xalan/templates/ElemVariable.java
@@ -49,11 +49,12 @@ import org.apache.xpath.objects.XString;
import org.apache.xpath.operations.Operation;
import org.apache.xpath.operations.Range;
import org.apache.xpath.operations.SimpleMapOperator;
-import org.apache.xpath.xs.types.XSAnyType;
-import org.apache.xpath.xs.types.XSNumericType;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
+import xml.xpath31.processor.types.XSAnyType;
+import xml.xpath31.processor.types.XSNumericType;
+
/**
* Implementation of XSLT xsl:variable element.
*
diff --git a/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java b/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java
index 235afdb0..8bc40699 100644
--- a/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java
+++ b/src/org/apache/xalan/templates/XSConstructorFunctionUtil.java
@@ -30,22 +30,23 @@ import org.apache.xpath.compiler.Keywords;
import org.apache.xpath.functions.FuncExtFunction;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSBoolean;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDateTime;
-import org.apache.xpath.xs.types.XSDayTimeDuration;
-import org.apache.xpath.xs.types.XSDecimal;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSDuration;
-import org.apache.xpath.xs.types.XSFloat;
-import org.apache.xpath.xs.types.XSInt;
-import org.apache.xpath.xs.types.XSInteger;
-import org.apache.xpath.xs.types.XSLong;
-import org.apache.xpath.xs.types.XSString;
-import org.apache.xpath.xs.types.XSTime;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
import org.xml.sax.SAXException;
+import xml.xpath31.processor.types.XSBoolean;
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDateTime;
+import xml.xpath31.processor.types.XSDayTimeDuration;
+import xml.xpath31.processor.types.XSDecimal;
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSDuration;
+import xml.xpath31.processor.types.XSFloat;
+import xml.xpath31.processor.types.XSInt;
+import xml.xpath31.processor.types.XSInteger;
+import xml.xpath31.processor.types.XSLong;
+import xml.xpath31.processor.types.XSString;
+import xml.xpath31.processor.types.XSTime;
+import xml.xpath31.processor.types.XSYearMonthDuration;
+
/**
* A utility class that primarily supports, evaluations of XSLT stylesheet
* function calls (for the stylesheet functions, defined with syntax
diff --git a/src/org/apache/xalan/xslt/util/XslTransformEvaluationHelper.java b/src/org/apache/xalan/xslt/util/XslTransformEvaluationHelper.java
index a63f1086..4299e11c 100644
--- a/src/org/apache/xalan/xslt/util/XslTransformEvaluationHelper.java
+++ b/src/org/apache/xalan/xslt/util/XslTransformEvaluationHelper.java
@@ -37,9 +37,10 @@ import org.apache.xpath.objects.XString;
import org.apache.xpath.operations.Range;
import org.apache.xpath.operations.SimpleMapOperator;
import org.apache.xpath.operations.Variable;
-import org.apache.xpath.xs.types.XSAnyType;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
+
+import xml.xpath31.processor.types.XSAnyType;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
/**
* This class, has few utility methods, to help with certain
diff --git a/src/org/apache/xml/dtm/DTMManager.java b/src/org/apache/xml/dtm/DTMManager.java
index 3a339bea..5e9fa2ce 100644
--- a/src/org/apache/xml/dtm/DTMManager.java
+++ b/src/org/apache/xml/dtm/DTMManager.java
@@ -30,11 +30,12 @@ import org.apache.xml.utils.PrefixResolver;
import org.apache.xml.utils.XMLStringFactory;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSAnyType;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
+import xml.xpath31.processor.types.XSAnyType;
+
/**
* A DTMManager instance can be used to create DTM and
* DTMIterator objects, and manage the DTM objects in the system.
diff --git a/src/org/apache/xpath/XPath.java b/src/org/apache/xpath/XPath.java
index 40410ff4..0f4736a6 100644
--- a/src/org/apache/xpath/XPath.java
+++ b/src/org/apache/xpath/XPath.java
@@ -45,7 +45,8 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSNumericType;
/**
* The XPath class wraps an expression object and provides general services
diff --git a/src/org/apache/xpath/XPathContext.java b/src/org/apache/xpath/XPathContext.java
index 6ed89a59..efc9b7ad 100644
--- a/src/org/apache/xpath/XPathContext.java
+++ b/src/org/apache/xpath/XPathContext.java
@@ -57,10 +57,11 @@ import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.DTMXRTreeFrag;
import org.apache.xpath.objects.XString;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSDayTimeDuration;
-import org.apache.xpath.xs.types.XSDuration;
import org.xml.sax.XMLReader;
+import xml.xpath31.processor.types.XSDayTimeDuration;
+import xml.xpath31.processor.types.XSDuration;
+
/**
* Default class for the runtime execution context for XPath.
*
diff --git a/src/org/apache/xpath/axes/PredicatedNodeTest.java b/src/org/apache/xpath/axes/PredicatedNodeTest.java
index 4cedf4fc..4b58bda7 100644
--- a/src/org/apache/xpath/axes/PredicatedNodeTest.java
+++ b/src/org/apache/xpath/axes/PredicatedNodeTest.java
@@ -31,7 +31,8 @@ import org.apache.xpath.compiler.Compiler;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.patterns.NodeTest;
-import org.apache.xpath.xs.types.XSInteger;
+
+import xml.xpath31.processor.types.XSInteger;
public abstract class PredicatedNodeTest extends NodeTest implements SubContextList
{
diff --git a/src/org/apache/xpath/compiler/OpCodes.java b/src/org/apache/xpath/compiler/OpCodes.java
index e73c0bd2..3649d195 100644
--- a/src/org/apache/xpath/compiler/OpCodes.java
+++ b/src/org/apache/xpath/compiler/OpCodes.java
@@ -733,8 +733,15 @@ public class OpCodes
* @xsl.usage advanced
*/
public static final int OP_INSTANCE_OF = 74;
+
+ /**
+ * For XPath 3.1 "cast as" expression.
+ *
+ * @xsl.usage advanced
+ */
+ public static final int OP_CAST_AS = 75;
/** The next free ID. Please keep this up to date. */
- private static final int NEXT_FREE_ID = 75;
+ private static final int NEXT_FREE_ID = 76;
}
diff --git a/src/org/apache/xpath/composite/QuantifiedExpr.java b/src/org/apache/xpath/composite/QuantifiedExpr.java
index 27c44d5f..f15e8b0a 100644
--- a/src/org/apache/xpath/composite/QuantifiedExpr.java
+++ b/src/org/apache/xpath/composite/QuantifiedExpr.java
@@ -40,7 +40,8 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XBoolean;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSBoolean;
+
+import xml.xpath31.processor.types.XSBoolean;
/*
* The XalanJ XPath parser, creates and populates an object of this class,
diff --git a/src/org/apache/xpath/composite/SequenceTypeSupport.java b/src/org/apache/xpath/composite/SequenceTypeSupport.java
index 56997fef..3679b304 100644
--- a/src/org/apache/xpath/composite/SequenceTypeSupport.java
+++ b/src/org/apache/xpath/composite/SequenceTypeSupport.java
@@ -36,26 +36,27 @@ import org.apache.xpath.objects.XNodeSetForDOM;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
-import org.apache.xpath.xs.types.XSBoolean;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDateTime;
-import org.apache.xpath.xs.types.XSDayTimeDuration;
-import org.apache.xpath.xs.types.XSDecimal;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSDuration;
-import org.apache.xpath.xs.types.XSFloat;
-import org.apache.xpath.xs.types.XSInt;
-import org.apache.xpath.xs.types.XSInteger;
-import org.apache.xpath.xs.types.XSLong;
-import org.apache.xpath.xs.types.XSNumericType;
-import org.apache.xpath.xs.types.XSString;
-import org.apache.xpath.xs.types.XSTime;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+import xml.xpath31.processor.types.XSBoolean;
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDateTime;
+import xml.xpath31.processor.types.XSDayTimeDuration;
+import xml.xpath31.processor.types.XSDecimal;
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSDuration;
+import xml.xpath31.processor.types.XSFloat;
+import xml.xpath31.processor.types.XSInt;
+import xml.xpath31.processor.types.XSInteger;
+import xml.xpath31.processor.types.XSLong;
+import xml.xpath31.processor.types.XSNumericType;
+import xml.xpath31.processor.types.XSString;
+import xml.xpath31.processor.types.XSTime;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
+import xml.xpath31.processor.types.XSYearMonthDuration;
+
/**
* This class provides few utility methods, to help evaluate
* XPath 3.1 sequence type expressions.
diff --git a/src/org/apache/xpath/composite/SimpleSequenceConstructor.java b/src/org/apache/xpath/composite/SimpleSequenceConstructor.java
index 25e73c0c..49c285e4 100644
--- a/src/org/apache/xpath/composite/SimpleSequenceConstructor.java
+++ b/src/org/apache/xpath/composite/SimpleSequenceConstructor.java
@@ -39,7 +39,8 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSNumericType;
/*
* The XalanJ XPath parser, creates and populates an object of this class,
diff --git a/src/org/apache/xpath/functions/FuncCodePointsToString.java b/src/org/apache/xpath/functions/FuncCodePointsToString.java
index 69ab7fc1..bff7d627 100644
--- a/src/org/apache/xpath/functions/FuncCodePointsToString.java
+++ b/src/org/apache/xpath/functions/FuncCodePointsToString.java
@@ -28,7 +28,8 @@ import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
import org.apache.xpath.operations.Variable;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the codepoints-to-string() function.
diff --git a/src/org/apache/xpath/functions/FuncCodepointEqual.java b/src/org/apache/xpath/functions/FuncCodepointEqual.java
index 1e0eba54..9c7a5bb6 100644
--- a/src/org/apache/xpath/functions/FuncCodepointEqual.java
+++ b/src/org/apache/xpath/functions/FuncCodepointEqual.java
@@ -23,8 +23,9 @@ import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSAnyType;
-import org.apache.xpath.xs.types.XSBoolean;
+
+import xml.xpath31.processor.types.XSAnyType;
+import xml.xpath31.processor.types.XSBoolean;
/**
* Implementation of the codepoint-equal() function.
diff --git a/src/org/apache/xpath/functions/FuncCompare.java b/src/org/apache/xpath/functions/FuncCompare.java
index c85ccd84..5ba4cf53 100644
--- a/src/org/apache/xpath/functions/FuncCompare.java
+++ b/src/org/apache/xpath/functions/FuncCompare.java
@@ -29,7 +29,8 @@ import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSInteger;
+
+import xml.xpath31.processor.types.XSInteger;
/**
* Implementation of the compare() function.
diff --git a/src/org/apache/xpath/functions/FuncConcat.java b/src/org/apache/xpath/functions/FuncConcat.java
index 948f4451..b26efbb7 100644
--- a/src/org/apache/xpath/functions/FuncConcat.java
+++ b/src/org/apache/xpath/functions/FuncConcat.java
@@ -28,7 +28,8 @@ import org.apache.xpath.XPathContext;
import org.apache.xpath.axes.SelfIteratorNoPredicate;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
-import org.apache.xpath.xs.types.XSAnyType;
+
+import xml.xpath31.processor.types.XSAnyType;
/**
* Execute the concat() function.
diff --git a/src/org/apache/xpath/functions/FuncContainsToken.java b/src/org/apache/xpath/functions/FuncContainsToken.java
index f337b420..3d32c0b9 100644
--- a/src/org/apache/xpath/functions/FuncContainsToken.java
+++ b/src/org/apache/xpath/functions/FuncContainsToken.java
@@ -34,7 +34,8 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSBoolean;
+
+import xml.xpath31.processor.types.XSBoolean;
/**
* Implementation of an XPath 3.1 function contains-token().
diff --git a/src/org/apache/xpath/functions/FuncCurrentDate.java b/src/org/apache/xpath/functions/FuncCurrentDate.java
index 925da226..ada9632c 100644
--- a/src/org/apache/xpath/functions/FuncCurrentDate.java
+++ b/src/org/apache/xpath/functions/FuncCurrentDate.java
@@ -26,7 +26,8 @@ import org.apache.xalan.res.XSLMessages;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSDate;
+
+import xml.xpath31.processor.types.XSDate;
/**
* Execute the current-date() function.
diff --git a/src/org/apache/xpath/functions/FuncCurrentDateTime.java b/src/org/apache/xpath/functions/FuncCurrentDateTime.java
index 08314a91..79f3c769 100644
--- a/src/org/apache/xpath/functions/FuncCurrentDateTime.java
+++ b/src/org/apache/xpath/functions/FuncCurrentDateTime.java
@@ -26,7 +26,8 @@ import org.apache.xalan.res.XSLMessages;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSDateTime;
+
+import xml.xpath31.processor.types.XSDateTime;
/**
* Execute the current-dateTime() function.
diff --git a/src/org/apache/xpath/functions/FuncCurrentTime.java b/src/org/apache/xpath/functions/FuncCurrentTime.java
index ceedfd01..535bdbe4 100644
--- a/src/org/apache/xpath/functions/FuncCurrentTime.java
+++ b/src/org/apache/xpath/functions/FuncCurrentTime.java
@@ -26,7 +26,8 @@ import org.apache.xalan.res.XSLMessages;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSTime;
+
+import xml.xpath31.processor.types.XSTime;
/**
* Execute the current-time() function.
diff --git a/src/org/apache/xpath/functions/FuncData.java b/src/org/apache/xpath/functions/FuncData.java
index 43bbf1f2..dad0bffd 100644
--- a/src/org/apache/xpath/functions/FuncData.java
+++ b/src/org/apache/xpath/functions/FuncData.java
@@ -30,10 +30,11 @@ import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
-import org.apache.xpath.xs.types.XSAnyAtomicType;
-import org.apache.xpath.xs.types.XSString;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
+
+import xml.xpath31.processor.types.XSAnyAtomicType;
+import xml.xpath31.processor.types.XSString;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
/**
* Implementation of an XPath 3.1 function data().
diff --git a/src/org/apache/xpath/functions/FuncDaysFromDuration.java b/src/org/apache/xpath/functions/FuncDaysFromDuration.java
index 896f388b..abfc042a 100644
--- a/src/org/apache/xpath/functions/FuncDaysFromDuration.java
+++ b/src/org/apache/xpath/functions/FuncDaysFromDuration.java
@@ -24,8 +24,9 @@ import org.apache.xpath.Expression;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDuration;
-import org.apache.xpath.xs.types.XSInteger;
+
+import xml.xpath31.processor.types.XSDuration;
+import xml.xpath31.processor.types.XSInteger;
/**
* Implementation of the days-from-duration() function.
diff --git a/src/org/apache/xpath/functions/FuncDistinctValues.java b/src/org/apache/xpath/functions/FuncDistinctValues.java
index 7dc9701e..d335ba4b 100644
--- a/src/org/apache/xpath/functions/FuncDistinctValues.java
+++ b/src/org/apache/xpath/functions/FuncDistinctValues.java
@@ -31,9 +31,10 @@ import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSAnyType;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
+
+import xml.xpath31.processor.types.XSAnyType;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
/**
* Execute the distinct-values() function.
diff --git a/src/org/apache/xpath/functions/FuncHoursFromDuration.java b/src/org/apache/xpath/functions/FuncHoursFromDuration.java
index d09c06d4..2d347ae6 100644
--- a/src/org/apache/xpath/functions/FuncHoursFromDuration.java
+++ b/src/org/apache/xpath/functions/FuncHoursFromDuration.java
@@ -24,8 +24,9 @@ import org.apache.xpath.Expression;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDuration;
-import org.apache.xpath.xs.types.XSInteger;
+
+import xml.xpath31.processor.types.XSDuration;
+import xml.xpath31.processor.types.XSInteger;
/**
* Implementation of the hours-from-duration() function.
diff --git a/src/org/apache/xpath/functions/FuncImplicitTimezone.java b/src/org/apache/xpath/functions/FuncImplicitTimezone.java
index a962d5a1..3dfa8da3 100644
--- a/src/org/apache/xpath/functions/FuncImplicitTimezone.java
+++ b/src/org/apache/xpath/functions/FuncImplicitTimezone.java
@@ -28,7 +28,8 @@ import org.apache.xalan.res.XSLMessages;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSDuration;
+
+import xml.xpath31.processor.types.XSDuration;
/**
* Execute the implicit-timezone() function.
diff --git a/src/org/apache/xpath/functions/FuncIndexOf.java b/src/org/apache/xpath/functions/FuncIndexOf.java
index 88df4e20..1941aaed 100644
--- a/src/org/apache/xpath/functions/FuncIndexOf.java
+++ b/src/org/apache/xpath/functions/FuncIndexOf.java
@@ -32,10 +32,11 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSAnyType;
-import org.apache.xpath.xs.types.XSInteger;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
+
+import xml.xpath31.processor.types.XSAnyType;
+import xml.xpath31.processor.types.XSInteger;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
/**
* Execute the index-of() function.
diff --git a/src/org/apache/xpath/functions/FuncInsertBefore.java b/src/org/apache/xpath/functions/FuncInsertBefore.java
index bcd92c4a..d304b387 100644
--- a/src/org/apache/xpath/functions/FuncInsertBefore.java
+++ b/src/org/apache/xpath/functions/FuncInsertBefore.java
@@ -24,7 +24,8 @@ import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the insert-before() function.
diff --git a/src/org/apache/xpath/functions/FuncMax.java b/src/org/apache/xpath/functions/FuncMax.java
index 8533a6dd..4ca832ec 100644
--- a/src/org/apache/xpath/functions/FuncMax.java
+++ b/src/org/apache/xpath/functions/FuncMax.java
@@ -32,14 +32,15 @@ import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
import org.apache.xpath.operations.Variable;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDayTimeDuration;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
-import org.apache.xpath.xs.types.XSString;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
+
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDayTimeDuration;
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
+import xml.xpath31.processor.types.XSString;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
+import xml.xpath31.processor.types.XSYearMonthDuration;
/**
* Implementation of an XPath 3.1 function fn:max.
diff --git a/src/org/apache/xpath/functions/FuncMin.java b/src/org/apache/xpath/functions/FuncMin.java
index 97631ac7..3cd0c66c 100644
--- a/src/org/apache/xpath/functions/FuncMin.java
+++ b/src/org/apache/xpath/functions/FuncMin.java
@@ -32,14 +32,15 @@ import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
import org.apache.xpath.operations.Variable;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDayTimeDuration;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
-import org.apache.xpath.xs.types.XSString;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
+
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDayTimeDuration;
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
+import xml.xpath31.processor.types.XSString;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
+import xml.xpath31.processor.types.XSYearMonthDuration;
/**
* Implementation of an XPath 3.1 function fn:min.
diff --git a/src/org/apache/xpath/functions/FuncMinutesFromDuration.java b/src/org/apache/xpath/functions/FuncMinutesFromDuration.java
index fa543429..c1e4d589 100644
--- a/src/org/apache/xpath/functions/FuncMinutesFromDuration.java
+++ b/src/org/apache/xpath/functions/FuncMinutesFromDuration.java
@@ -24,8 +24,9 @@ import org.apache.xpath.Expression;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDuration;
-import org.apache.xpath.xs.types.XSInteger;
+
+import xml.xpath31.processor.types.XSDuration;
+import xml.xpath31.processor.types.XSInteger;
/**
* Implementation of the minutes-from-duration() function.
diff --git a/src/org/apache/xpath/functions/FuncMonthsFromDuration.java b/src/org/apache/xpath/functions/FuncMonthsFromDuration.java
index a4076d0b..0602ba92 100644
--- a/src/org/apache/xpath/functions/FuncMonthsFromDuration.java
+++ b/src/org/apache/xpath/functions/FuncMonthsFromDuration.java
@@ -24,8 +24,9 @@ import org.apache.xpath.Expression;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDuration;
-import org.apache.xpath.xs.types.XSInteger;
+
+import xml.xpath31.processor.types.XSDuration;
+import xml.xpath31.processor.types.XSInteger;
/**
* Implementation of the months-from-duration() function.
diff --git a/src/org/apache/xpath/functions/FuncRemove.java b/src/org/apache/xpath/functions/FuncRemove.java
index 240c3d0f..1fcdf476 100644
--- a/src/org/apache/xpath/functions/FuncRemove.java
+++ b/src/org/apache/xpath/functions/FuncRemove.java
@@ -24,7 +24,8 @@ import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the remove() function.
diff --git a/src/org/apache/xpath/functions/FuncSecondsFromDuration.java b/src/org/apache/xpath/functions/FuncSecondsFromDuration.java
index 4c7d87a0..f7b93d58 100644
--- a/src/org/apache/xpath/functions/FuncSecondsFromDuration.java
+++ b/src/org/apache/xpath/functions/FuncSecondsFromDuration.java
@@ -24,8 +24,9 @@ import org.apache.xpath.Expression;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDecimal;
-import org.apache.xpath.xs.types.XSDuration;
+
+import xml.xpath31.processor.types.XSDecimal;
+import xml.xpath31.processor.types.XSDuration;
/**
* Implementation of the seconds-from-duration() function.
diff --git a/src/org/apache/xpath/functions/FuncStringJoin.java b/src/org/apache/xpath/functions/FuncStringJoin.java
index 7bf201dc..b714e01f 100644
--- a/src/org/apache/xpath/functions/FuncStringJoin.java
+++ b/src/org/apache/xpath/functions/FuncStringJoin.java
@@ -36,9 +36,10 @@ import org.apache.xpath.operations.Operation;
import org.apache.xpath.operations.Range;
import org.apache.xpath.operations.Variable;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSAnyType;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
+
+import xml.xpath31.processor.types.XSAnyType;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
/**
* Execute the string-join() function.
diff --git a/src/org/apache/xpath/functions/FuncStringToCodepoints.java b/src/org/apache/xpath/functions/FuncStringToCodepoints.java
index a0de7117..30255438 100644
--- a/src/org/apache/xpath/functions/FuncStringToCodepoints.java
+++ b/src/org/apache/xpath/functions/FuncStringToCodepoints.java
@@ -26,7 +26,8 @@ import org.apache.xpath.XPathCollationSupport;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSInteger;
+
+import xml.xpath31.processor.types.XSInteger;
/**
* Implementation of the string-to-codepoints() function.
diff --git a/src/org/apache/xpath/functions/FuncSubsequence.java b/src/org/apache/xpath/functions/FuncSubsequence.java
index 9a662a4f..d0273369 100644
--- a/src/org/apache/xpath/functions/FuncSubsequence.java
+++ b/src/org/apache/xpath/functions/FuncSubsequence.java
@@ -26,7 +26,8 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the subsequence() function.
diff --git a/src/org/apache/xpath/functions/FuncSubstring.java b/src/org/apache/xpath/functions/FuncSubstring.java
index 2db27c91..960fa47f 100644
--- a/src/org/apache/xpath/functions/FuncSubstring.java
+++ b/src/org/apache/xpath/functions/FuncSubstring.java
@@ -27,7 +27,8 @@ import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSNumericType;
/**
* Execute the Substring() function.
diff --git a/src/org/apache/xpath/functions/FuncYearsFromDuration.java b/src/org/apache/xpath/functions/FuncYearsFromDuration.java
index 85a3c7e6..b295b4d4 100644
--- a/src/org/apache/xpath/functions/FuncYearsFromDuration.java
+++ b/src/org/apache/xpath/functions/FuncYearsFromDuration.java
@@ -24,8 +24,9 @@ import org.apache.xpath.Expression;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDuration;
-import org.apache.xpath.xs.types.XSInteger;
+
+import xml.xpath31.processor.types.XSDuration;
+import xml.xpath31.processor.types.XSInteger;
/**
* Implementation of the years-from-duration() function.
diff --git a/src/org/apache/xpath/functions/XPathHigherOrderBuiltinFunctionsSupport.java b/src/org/apache/xpath/functions/XPathHigherOrderBuiltinFunctionsSupport.java
index f9ee24df..fa8cf5f6 100644
--- a/src/org/apache/xpath/functions/XPathHigherOrderBuiltinFunctionsSupport.java
+++ b/src/org/apache/xpath/functions/XPathHigherOrderBuiltinFunctionsSupport.java
@@ -28,8 +28,9 @@ import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.operations.Range;
import org.apache.xpath.operations.Variable;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
+
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
/**
* This class provides few utility methods, to help with XPath 3.1
diff --git a/src/org/apache/xpath/functions/math/FuncMathAcos.java b/src/org/apache/xpath/functions/math/FuncMathAcos.java
index f8ee2e2b..ba678652 100644
--- a/src/org/apache/xpath/functions/math/FuncMathAcos.java
+++ b/src/org/apache/xpath/functions/math/FuncMathAcos.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:acos() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathAsin.java b/src/org/apache/xpath/functions/math/FuncMathAsin.java
index 76094eb1..ce16047a 100644
--- a/src/org/apache/xpath/functions/math/FuncMathAsin.java
+++ b/src/org/apache/xpath/functions/math/FuncMathAsin.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:asin() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathAtan.java b/src/org/apache/xpath/functions/math/FuncMathAtan.java
index 47f31315..2bf1e328 100644
--- a/src/org/apache/xpath/functions/math/FuncMathAtan.java
+++ b/src/org/apache/xpath/functions/math/FuncMathAtan.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:atan() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathAtan2.java b/src/org/apache/xpath/functions/math/FuncMathAtan2.java
index 5c487ddf..1ace7eff 100644
--- a/src/org/apache/xpath/functions/math/FuncMathAtan2.java
+++ b/src/org/apache/xpath/functions/math/FuncMathAtan2.java
@@ -25,8 +25,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:atan2() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathCos.java b/src/org/apache/xpath/functions/math/FuncMathCos.java
index 38afb34b..60bef979 100644
--- a/src/org/apache/xpath/functions/math/FuncMathCos.java
+++ b/src/org/apache/xpath/functions/math/FuncMathCos.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:cos() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathExp.java b/src/org/apache/xpath/functions/math/FuncMathExp.java
index 1032ba76..2bcbbe60 100644
--- a/src/org/apache/xpath/functions/math/FuncMathExp.java
+++ b/src/org/apache/xpath/functions/math/FuncMathExp.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:exp() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathExp10.java b/src/org/apache/xpath/functions/math/FuncMathExp10.java
index d0d94af0..a5d80c34 100644
--- a/src/org/apache/xpath/functions/math/FuncMathExp10.java
+++ b/src/org/apache/xpath/functions/math/FuncMathExp10.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:exp10() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathLog.java b/src/org/apache/xpath/functions/math/FuncMathLog.java
index a3eafbc0..7700b841 100644
--- a/src/org/apache/xpath/functions/math/FuncMathLog.java
+++ b/src/org/apache/xpath/functions/math/FuncMathLog.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:log() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathLog10.java b/src/org/apache/xpath/functions/math/FuncMathLog10.java
index e291db7f..405b2441 100644
--- a/src/org/apache/xpath/functions/math/FuncMathLog10.java
+++ b/src/org/apache/xpath/functions/math/FuncMathLog10.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:log10() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathPi.java b/src/org/apache/xpath/functions/math/FuncMathPi.java
index cebe6286..3eaa68f9 100644
--- a/src/org/apache/xpath/functions/math/FuncMathPi.java
+++ b/src/org/apache/xpath/functions/math/FuncMathPi.java
@@ -20,7 +20,8 @@ package org.apache.xpath.functions.math;
import org.apache.xpath.XPathContext;
import org.apache.xpath.functions.Function;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
+
+import xml.xpath31.processor.types.XSDouble;
/**
* Implementation of the math:pi() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathPow.java b/src/org/apache/xpath/functions/math/FuncMathPow.java
index 698430fb..7951fcca 100644
--- a/src/org/apache/xpath/functions/math/FuncMathPow.java
+++ b/src/org/apache/xpath/functions/math/FuncMathPow.java
@@ -25,8 +25,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:pow() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathSin.java b/src/org/apache/xpath/functions/math/FuncMathSin.java
index 5d49b33c..adb974a0 100644
--- a/src/org/apache/xpath/functions/math/FuncMathSin.java
+++ b/src/org/apache/xpath/functions/math/FuncMathSin.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:sin() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathSqrt.java b/src/org/apache/xpath/functions/math/FuncMathSqrt.java
index bb0dafce..3743d643 100644
--- a/src/org/apache/xpath/functions/math/FuncMathSqrt.java
+++ b/src/org/apache/xpath/functions/math/FuncMathSqrt.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:sqrt() function.
diff --git a/src/org/apache/xpath/functions/math/FuncMathTan.java b/src/org/apache/xpath/functions/math/FuncMathTan.java
index f81f518d..fb5f68ee 100644
--- a/src/org/apache/xpath/functions/math/FuncMathTan.java
+++ b/src/org/apache/xpath/functions/math/FuncMathTan.java
@@ -27,8 +27,9 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
/**
* Implementation of the math:tan() function.
diff --git a/src/org/apache/xpath/objects/ResultSequence.java b/src/org/apache/xpath/objects/ResultSequence.java
index 09b2dfbf..24f9d895 100644
--- a/src/org/apache/xpath/objects/ResultSequence.java
+++ b/src/org/apache/xpath/objects/ResultSequence.java
@@ -20,7 +20,7 @@ package org.apache.xpath.objects;
import java.util.ArrayList;
import java.util.List;
-import org.apache.xpath.xs.types.XSAnyType;
+import xml.xpath31.processor.types.XSAnyType;
/**
* This class represents, the XPath 3.1 data model sequence.
diff --git a/src/org/apache/xpath/objects/XNodeSet.java b/src/org/apache/xpath/objects/XNodeSet.java
index 31801770..419e5b3c 100644
--- a/src/org/apache/xpath/objects/XNodeSet.java
+++ b/src/org/apache/xpath/objects/XNodeSet.java
@@ -29,10 +29,11 @@ import org.apache.xml.dtm.DTMManager;
import org.apache.xml.utils.XMLString;
import org.apache.xpath.NodeSetDTM;
import org.apache.xpath.axes.NodeSequence;
-import org.apache.xpath.xs.types.XSUntyped;
import org.w3c.dom.NodeList;
import org.w3c.dom.traversal.NodeIterator;
+import xml.xpath31.processor.types.XSUntyped;
+
/**
* This class represents an XPath nodeset object, and is capable of
* converting the nodeset to other types, such as a string.
diff --git a/src/org/apache/xpath/objects/XNumber.java b/src/org/apache/xpath/objects/XNumber.java
index 74e351a0..bc926ccc 100644
--- a/src/org/apache/xpath/objects/XNumber.java
+++ b/src/org/apache/xpath/objects/XNumber.java
@@ -23,7 +23,8 @@ package org.apache.xpath.objects;
import org.apache.xpath.ExpressionOwner;
import org.apache.xpath.XPathContext;
import org.apache.xpath.XPathVisitor;
-import org.apache.xpath.xs.types.XSDecimal;
+
+import xml.xpath31.processor.types.XSDecimal;
/**
* This class represents an XPath number, and is capable of
diff --git a/src/org/apache/xpath/objects/XObject.java b/src/org/apache/xpath/objects/XObject.java
index 5170fa90..6754f814 100644
--- a/src/org/apache/xpath/objects/XObject.java
+++ b/src/org/apache/xpath/objects/XObject.java
@@ -35,21 +35,22 @@ import org.apache.xpath.XPathContext;
import org.apache.xpath.XPathException;
import org.apache.xpath.XPathVisitor;
import org.apache.xpath.res.XPATHErrorResources;
-import org.apache.xpath.xs.types.XSBoolean;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDateTime;
-import org.apache.xpath.xs.types.XSDecimal;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSFloat;
-import org.apache.xpath.xs.types.XSInt;
-import org.apache.xpath.xs.types.XSInteger;
-import org.apache.xpath.xs.types.XSLong;
-import org.apache.xpath.xs.types.XSString;
-import org.apache.xpath.xs.types.XSTime;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.NodeList;
import org.w3c.dom.traversal.NodeIterator;
+import xml.xpath31.processor.types.XSBoolean;
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDateTime;
+import xml.xpath31.processor.types.XSDecimal;
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSFloat;
+import xml.xpath31.processor.types.XSInt;
+import xml.xpath31.processor.types.XSInteger;
+import xml.xpath31.processor.types.XSLong;
+import xml.xpath31.processor.types.XSString;
+import xml.xpath31.processor.types.XSTime;
+
/**
* This class represents an XPath object, and is capable of
* converting the object to various types, such as a string.
diff --git a/src/org/apache/xpath/operations/Div.java b/src/org/apache/xpath/operations/Div.java
index 592f5028..d5905740 100644
--- a/src/org/apache/xpath/operations/Div.java
+++ b/src/org/apache/xpath/operations/Div.java
@@ -27,9 +27,10 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
+import xml.xpath31.processor.types.XSYearMonthDuration;
/**
* The 'div' operation expression executer.
diff --git a/src/org/apache/xpath/operations/InstanceOf.java b/src/org/apache/xpath/operations/InstanceOf.java
index 5fa716f3..684cc79e 100644
--- a/src/org/apache/xpath/operations/InstanceOf.java
+++ b/src/org/apache/xpath/operations/InstanceOf.java
@@ -35,22 +35,23 @@ import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
-import org.apache.xpath.xs.types.XSBoolean;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDateTime;
-import org.apache.xpath.xs.types.XSDayTimeDuration;
-import org.apache.xpath.xs.types.XSDecimal;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSDuration;
-import org.apache.xpath.xs.types.XSFloat;
-import org.apache.xpath.xs.types.XSInt;
-import org.apache.xpath.xs.types.XSInteger;
-import org.apache.xpath.xs.types.XSLong;
-import org.apache.xpath.xs.types.XSString;
-import org.apache.xpath.xs.types.XSTime;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
+
+import xml.xpath31.processor.types.XSBoolean;
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDateTime;
+import xml.xpath31.processor.types.XSDayTimeDuration;
+import xml.xpath31.processor.types.XSDecimal;
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSDuration;
+import xml.xpath31.processor.types.XSFloat;
+import xml.xpath31.processor.types.XSInt;
+import xml.xpath31.processor.types.XSInteger;
+import xml.xpath31.processor.types.XSLong;
+import xml.xpath31.processor.types.XSString;
+import xml.xpath31.processor.types.XSTime;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
+import xml.xpath31.processor.types.XSYearMonthDuration;
/**
* The XPath 3.1 "instance of" operation.
diff --git a/src/org/apache/xpath/operations/Minus.java b/src/org/apache/xpath/operations/Minus.java
index 5c334aa8..e1955b8e 100644
--- a/src/org/apache/xpath/operations/Minus.java
+++ b/src/org/apache/xpath/operations/Minus.java
@@ -26,11 +26,12 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDateTime;
-import org.apache.xpath.xs.types.XSNumericType;
-import org.apache.xpath.xs.types.XSTime;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
+
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDateTime;
+import xml.xpath31.processor.types.XSNumericType;
+import xml.xpath31.processor.types.XSTime;
+import xml.xpath31.processor.types.XSYearMonthDuration;
/**
* The binary '-' operation expression executer.
diff --git a/src/org/apache/xpath/operations/Mod.java b/src/org/apache/xpath/operations/Mod.java
index f979b849..b133e81c 100644
--- a/src/org/apache/xpath/operations/Mod.java
+++ b/src/org/apache/xpath/operations/Mod.java
@@ -23,7 +23,8 @@ package org.apache.xpath.operations;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSInteger;
+
+import xml.xpath31.processor.types.XSInteger;
/**
* The 'mod' operation expression executer.
diff --git a/src/org/apache/xpath/operations/Mult.java b/src/org/apache/xpath/operations/Mult.java
index dcae69ad..dee1297c 100644
--- a/src/org/apache/xpath/operations/Mult.java
+++ b/src/org/apache/xpath/operations/Mult.java
@@ -27,11 +27,12 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
-import org.apache.xpath.xs.types.XSNumericType;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
+
+import xml.xpath31.processor.types.XSDouble;
+import xml.xpath31.processor.types.XSNumericType;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
+import xml.xpath31.processor.types.XSYearMonthDuration;
/**
* The '*' operation expression executer.
diff --git a/src/org/apache/xpath/operations/Neg.java b/src/org/apache/xpath/operations/Neg.java
index bf96ef9d..b85ce232 100644
--- a/src/org/apache/xpath/operations/Neg.java
+++ b/src/org/apache/xpath/operations/Neg.java
@@ -23,7 +23,8 @@ package org.apache.xpath.operations;
import org.apache.xpath.XPathContext;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDouble;
+
+import xml.xpath31.processor.types.XSDouble;
/**
* The unary '-' operation expression executer.
diff --git a/src/org/apache/xpath/operations/Plus.java b/src/org/apache/xpath/operations/Plus.java
index 637f9387..bf089d28 100644
--- a/src/org/apache/xpath/operations/Plus.java
+++ b/src/org/apache/xpath/operations/Plus.java
@@ -26,13 +26,14 @@ import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSDate;
-import org.apache.xpath.xs.types.XSDateTime;
-import org.apache.xpath.xs.types.XSNumericType;
-import org.apache.xpath.xs.types.XSTime;
-import org.apache.xpath.xs.types.XSUntyped;
-import org.apache.xpath.xs.types.XSUntypedAtomic;
-import org.apache.xpath.xs.types.XSYearMonthDuration;
+
+import xml.xpath31.processor.types.XSDate;
+import xml.xpath31.processor.types.XSDateTime;
+import xml.xpath31.processor.types.XSNumericType;
+import xml.xpath31.processor.types.XSTime;
+import xml.xpath31.processor.types.XSUntyped;
+import xml.xpath31.processor.types.XSUntypedAtomic;
+import xml.xpath31.processor.types.XSYearMonthDuration;
/**
* The '+' operation expression executer.
diff --git a/src/org/apache/xpath/operations/Range.java b/src/org/apache/xpath/operations/Range.java
index e7973124..8a39a610 100644
--- a/src/org/apache/xpath/operations/Range.java
+++ b/src/org/apache/xpath/operations/Range.java
@@ -29,10 +29,11 @@ import org.apache.xpath.XPathContext;
import org.apache.xpath.functions.FuncExtFunction;
import org.apache.xpath.objects.ResultSequence;
import org.apache.xpath.objects.XObject;
-import org.apache.xpath.xs.types.XSInteger;
-import org.apache.xpath.xs.types.XSNumericType;
import org.xml.sax.SAXException;
+import xml.xpath31.processor.types.XSInteger;
+import xml.xpath31.processor.types.XSNumericType;
+
/**
* The XPath 3.1 range "to" operation.
*
diff --git a/src/org/apache/xpath/operations/SimpleMapOperator.java b/src/org/apache/xpath/operations/SimpleMapOperator.java
index 72955285..102436cf 100644
--- a/src/org/apache/xpath/operations/SimpleMapOperator.java
+++ b/src/org/apache/xpath/operations/SimpleMapOperator.java
@@ -32,9 +32,10 @@ import org.apache.xpath.objects.XNodeSet;
import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
-import org.apache.xpath.xs.types.XSAnyType;
import org.xml.sax.SAXException;
+import xml.xpath31.processor.types.XSAnyType;
+
/**
* The XPath 3.1 simple map '!' operation.
*
diff --git a/src/org/apache/xpath/xs/types/XPath3DecimalFormat.java b/src/org/apache/xpath/xs/types/XPath3DecimalFormat.java
deleted file mode 100644
index 548e3709..00000000
--- a/src/org/apache/xpath/xs/types/XPath3DecimalFormat.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import java.math.BigDecimal;
-import java.text.DecimalFormat;
-import java.text.DecimalFormatSymbols;
-import java.text.FieldPosition;
-import java.util.Locale;
-
-/**
- * This class provides an XPath 3.0 specific implementation of decimal
- * number string format, to handle few of the XPath specific decimal number
- * string formatting requirements.
- *
- * This class extends the Java class java.text.DecimalFormat and inherits
- * most of its significant implementation behavior.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XPath3DecimalFormat extends DecimalFormat {
-
- private static final long serialVersionUID = 5055460273589749811L;
-
- private static final String NEG_INFINITY = "-INF";
-
- private static final String POS_INFINITY = "INF";
-
- /*
- * Class constructor.
- */
- public XPath3DecimalFormat(String patternStr) {
- super(patternStr, new DecimalFormatSymbols(Locale.getDefault()));
- }
-
- /**
- * Format an object representing a number, to a string value.
- *
- * @param numberVal a number object, that needs to be
- * formatted to string
- */
- public String performStrFormatting(Object numberVal) {
- String curPattern = toPattern();
- String newPattern = curPattern.replaceAll("E0", "");
-
- if (numberVal instanceof Float) {
- return formatFloatValue(numberVal, curPattern, newPattern);
- }
-
- if (numberVal instanceof Double) {
- return formatDoubleValue(numberVal, curPattern, newPattern);
- }
-
- return super.format(numberVal, new StringBuffer(), new FieldPosition(0)).
- toString();
- }
-
- /*
- * Format a float numeric value, to a string.
- */
- private String formatFloatValue(Object floatVal, String curPattern,
- String newPattern) {
- Float floatValue = (Float) floatVal;
-
- if (floatValue.floatValue() == Float.NEGATIVE_INFINITY) {
- return NEG_INFINITY;
- }
-
- if (floatValue.floatValue() == Float.POSITIVE_INFINITY) {
- return POS_INFINITY;
- }
-
- if (floatValue.floatValue() > -1E6f && floatValue.floatValue() < 1E6f) {
- applyPattern(newPattern);
- }
- else if (floatValue.floatValue() <= -1E6f) {
- applyPattern(curPattern.replaceAll("0\\.#", "0.0" ));
- }
-
- return format(floatVal, new StringBuffer(), new FieldPosition(0)).toString();
- }
-
- /*
- * Format a double numeric value, to a string.
- */
- private String formatDoubleValue(Object doubleVal, String curPattern,
- String newPattern) {
- Double doubleValue = (Double) doubleVal;
-
- if (doubleValue.doubleValue() == Double.NEGATIVE_INFINITY) {
- return NEG_INFINITY;
- }
-
- if (doubleValue.doubleValue() == Double.POSITIVE_INFINITY) {
- return POS_INFINITY;
- }
-
- BigDecimal doubValue = new BigDecimal((((Double) doubleVal)).
- doubleValue());
- BigDecimal minValue = new BigDecimal("-1E6");
- BigDecimal maxValue = new BigDecimal("1E6");
-
- if (doubValue.compareTo(minValue) > 0 && doubValue.compareTo(maxValue) < 0) {
- applyPattern(newPattern);
- }
- else {
- applyPattern(curPattern.replaceAll("0\\.#", "0.0"));
- }
-
- return format(doubleVal, new StringBuffer(), new FieldPosition(0)).
- toString();
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSAnyAtomicType.java b/src/org/apache/xpath/xs/types/XSAnyAtomicType.java
deleted file mode 100644
index 7b1f377d..00000000
--- a/src/org/apache/xpath/xs/types/XSAnyAtomicType.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id$
- */
-package org.apache.xpath.xs.types;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * Base class for all the XML Schema atomic data types.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public abstract class XSAnyAtomicType extends XSAnySimpleType {
-
- private static final long serialVersionUID = 4800376096762047151L;
-
- /*
- * This function supports, creating XML Schema built-in types, XPath 3.1
- * XDM objects with data types xs:boolean, xs:decimal etc.
- *
- */
- public abstract ResultSequence constructor(ResultSequence arg) throws TransformerException;
-
- /**
- * Get the datatype's name
- *
- * @return String representation of the datatype's name
- */
- public abstract String typeName();
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSAnySimpleType.java b/src/org/apache/xpath/xs/types/XSAnySimpleType.java
deleted file mode 100644
index 05e7b7e6..00000000
--- a/src/org/apache/xpath/xs/types/XSAnySimpleType.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id$
- */
-package org.apache.xpath.xs.types;
-
-/**
- * Base class for all the XML Schema simple types.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public abstract class XSAnySimpleType extends XSAnyType {
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSAnyType.java b/src/org/apache/xpath/xs/types/XSAnyType.java
deleted file mode 100644
index 4d7a99bf..00000000
--- a/src/org/apache/xpath/xs/types/XSAnyType.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import org.apache.xml.utils.FastStringBuffer;
-import org.apache.xpath.objects.XObject;
-
-/**
- * Base class for all the XML Schema types.
- *
- * (please refer, https://www.w3.org/TR/xmlschema11-2/#built-in-datatypes
- * that illustrates the XML Schema 1.1 built-in datatypes hierarchy)
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public abstract class XSAnyType extends XObject {
-
- private static final long serialVersionUID = -3385975335330221518L;
-
- /**
- * Get the datatype's name. For e.g "xs:boolean", "xs:decimal".
- *
- * @return datatype's name
- */
- public abstract String stringType();
-
- /**
- * Get the string representation of the value stored.
- *
- * @return get the string representation of the, value
- * stored adhering to this type.
- */
- public abstract String stringValue();
-
- public void appendToFsb(FastStringBuffer fsb) {
- fsb.append(stringValue());
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSBoolean.java b/src/org/apache/xpath/xs/types/XSBoolean.java
deleted file mode 100644
index 49780218..00000000
--- a/src/org/apache/xpath/xs/types/XSBoolean.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:boolean datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSBoolean extends XSCtrType {
-
- private static final long serialVersionUID = -8635660165145453378L;
-
- private static final String XS_BOOLEAN = "xs:boolean";
-
- private boolean _value;
-
- /*
- * Class constructor.
- */
- public XSBoolean(boolean bool) {
- _value = bool;
- }
-
- /*
- * Class constructor.
- */
- public XSBoolean() {
- this(false);
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
- String strVal = xsAnyType.stringValue();
-
- Boolean bool = null;
- if (isBooleanFalse(strVal)) {
- bool = Boolean.FALSE;
- }
- else {
- bool = Boolean.TRUE;
- }
-
- resultSeq.add(new XSBoolean(bool.booleanValue()));
-
- return resultSeq;
- }
-
- @Override
- public String typeName() {
- return "boolean";
- }
-
- @Override
- public String stringType() {
- return XS_BOOLEAN;
- }
-
- @Override
- public String stringValue() {
- return "" + _value;
- }
-
- /**
- * Get the actual boolean value stored, within this object.
- *
- * @return the actual boolean value stored
- */
- public boolean value() {
- return _value;
- }
-
- public boolean equals(XSBoolean xsBoolean) {
- return _value == xsBoolean.value();
- }
-
- public boolean lt(XSBoolean xsBoolean) {
- boolean resultVal = false;
-
- if (!value() && xsBoolean.value()) {
- resultVal = true;
- }
-
- return resultVal;
- }
-
- public boolean gt(XSBoolean xsBoolean) {
- boolean resultVal = false;
-
- if (value() && !xsBoolean.value()) {
- resultVal = true;
- }
-
- return resultVal;
- }
-
- public boolean bool() {
- return value();
- }
-
- public int getType() {
- return CLASS_BOOLEAN;
- }
-
- /*
- * Check whether, a string value represents a boolean
- * 'false' value.
- */
- private boolean isBooleanFalse(String strVal) {
- return strVal.equals("0") || strVal.equals("false") ||
- strVal.equals("+0") || strVal.equals("-0") ||
- strVal.equals("0.0E0") || strVal.equals("NaN");
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSCalendarType.java b/src/org/apache/xpath/xs/types/XSCalendarType.java
deleted file mode 100644
index 85bb69f2..00000000
--- a/src/org/apache/xpath/xs/types/XSCalendarType.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-/**
- * Base class for all calendar based classes.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public abstract class XSCalendarType extends XSCtrType {
-
- private static final long serialVersionUID = -6546129697566314664L;
-
- /**
- * Determine whether, two timezone values (represented as XSDuration objects)
- * are equal.
- */
- protected boolean isTimezoneEqual(XSDuration tz1, XSDuration tz2,
- boolean isPopulatedFromFnDateFunc1,
- boolean isPopulatedFromFnDateFunc2) {
-
- boolean isTimezoneEqual = false;
-
- if (tz1 == null && tz2 == null) {
- isTimezoneEqual = true;
- }
- else if (tz1 != null && tz2 != null) {
- isTimezoneEqual = ((tz1.hours() == tz2.hours()) &&
- (tz1.minutes() == tz2.minutes()) &&
- (tz1.negative() == tz2.negative()));
- }
- else if (isPopulatedFromFnDateFunc1 || isPopulatedFromFnDateFunc2) {
- isTimezoneEqual = true;
- }
-
- return isTimezoneEqual;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSCtrType.java b/src/org/apache/xpath/xs/types/XSCtrType.java
deleted file mode 100644
index dbef2bc5..00000000
--- a/src/org/apache/xpath/xs/types/XSCtrType.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id$
- */
-package org.apache.xpath.xs.types;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * A representation of the XSCtrType datatype.
- *
- * All the XML Schema built-in types that have constructor functions
- * as defined by XPath 3.1 F&O spec, XalanJ data type classes for those
- * XML Schema built-in types have this class as a parent or an ancestor
- * class.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public abstract class XSCtrType extends XSAnyAtomicType {
-
- private static final long serialVersionUID = -1177633885817069140L;
-
- /**
- * This function is used for, XML Schema built-in types
- * constructor functions.
- *
- * For e.g, xs:string($arg as xs:anyAtomicType?) as xs:string? ,
- * xs:boolean($arg as xs:anyAtomicType?) as xs:boolean? etc
- *
- * @param arg either an empty sequence, or an XML Schema atomic type
- *
- * @return the resulting ResultSequence
- *
- * @throws TransformerException
- */
- public abstract ResultSequence constructor(ResultSequence arg) throws TransformerException;
-
- /**
- * Get the datatype's name.
- *
- * @return String representation of the datatype's name
- */
- public abstract String typeName();
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSDate.java b/src/org/apache/xpath/xs/types/XSDate.java
deleted file mode 100644
index d0d3cc7e..00000000
--- a/src/org/apache/xpath/xs/types/XSDate.java
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.objects.ResultSequence;
-import org.apache.xpath.objects.XObject;
-
-/**
- * An XML Schema data type representation, of the xs:date datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSDate extends XSCalendarType {
-
- private static final long serialVersionUID = -9204442487368342326L;
-
- private static final String XS_DATE = "xs:date";
-
- private Calendar _calendar;
-
- private boolean _timezoned;
-
- private XSDuration _tz;
-
- /**
- * The value of this class field, stores the fact that whether this XSDate
- * object is constructed via XPath function call fn:current-date().
- */
- private boolean isPopulatedFromFnCurrentDate = false;
-
- /**
- * Class constructor.
- *
- * Creates a new XSDate object instance, corresponding to the provided
- * date and timezone.
- *
- * @param cal the java.util.Calendar representation of the date to be stored
- *
- * @param tz the timezone of the date to be stored
- */
- public XSDate(Calendar cal, XSDuration tz) {
- _calendar = cal;
- _tz = tz;
-
- if (tz == null) {
- _timezoned = false;
- }
- else {
- _timezoned = true;
- }
- }
-
- /**
- * Class constructor.
- */
- public XSDate() {}
-
- @Override
- public ResultSequence constructor(ResultSequence arg) throws TransformerException {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- XSDate xsDate = castToDate(xsAnyType);
-
- resultSeq.add(xsDate);
-
- return resultSeq;
- }
-
- /**
- * Parse a string representation of a date and construct an new XSDate object.
- *
- * XML Schema 1.1 datatypes spec, provides following to be the valid string
- * representation (which is an ISO 8601 date format) of xs:date typed value,
- *
- * dateLexicalRep ::= yearFrag '-' monthFrag '-' dayFrag timezoneFrag?
- *
- * @param strVal the string representation of the date
- * @return the XSDate representation of the provided string
- */
- public static XSDate parseDate(String strVal) throws TransformerException {
-
- XSDate result = null;
-
- try {
- String dateStr = "";
- String timeStr = "T00:00:00.0";
-
- int idx = strVal.indexOf('+', 1);
- if (idx == -1) {
- idx = strVal.indexOf('-', 1);
- if (idx == -1) {
- throw new TransformerException("XTTE0570 : The supplied string value '" +
- strVal + "' cannot be parsed to a xs:date value.");
- }
- idx = strVal.indexOf('-', idx + 1);
- if (idx == -1) {
- throw new TransformerException("XTTE0570 : The supplied string value '" +
- strVal + "' cannot be parsed to a xs:date value.");
- }
- idx = strVal.indexOf('-', idx + 1);
- }
- if (idx == -1) {
- idx = strVal.indexOf('Z', 1);
- }
- if (idx != -1) {
- dateStr = strVal.substring(0, idx);
- dateStr += timeStr;
- dateStr += strVal.substring(idx, strVal.length());
- } else {
- dateStr = strVal + timeStr;
- }
-
- XSDateTime dateTime = XSDateTime.parseDateTime(dateStr);
-
- if (dateTime != null) {
- result = new XSDate(dateTime.getCalendar(), dateTime.getTimezone());;
- }
- else {
- throw new TransformerException("XTTE0570 : The supplied string value '" +
- strVal + "' cannot be parsed to a xs:date value.");
- }
- }
- catch (TransformerException ex) {
- throw ex;
- }
- catch (Exception ex) {
- throw new TransformerException("XTTE0570 : The supplied string value '" +
- strVal + "' cannot be parsed to a xs:date value.");
- }
-
- return result;
-
- }
-
- public XSDuration getTimezone() {
- return _tz;
- }
-
- @Override
- public String typeName() {
- return "date";
- }
-
- @Override
- public String stringType() {
- return XS_DATE;
- }
-
- /**
- * Get the Calendar representation of the date stored.
- *
- * @return the java.util.Calendar representation of the date stored
- */
- public Calendar getCalendar() {
- return _calendar;
- }
-
- /**
- * Get the month from the date stored.
- *
- * @return the month value of the date stored
- */
- public int month() {
- return _calendar.get(Calendar.MONTH) + 1;
- }
-
- /**
- * Check whether this XSDate object has an, timezone associated with it.
- *
- * @return true if there is a timezone associated with this XSDate object.
- * false otherwise.
- */
- public boolean isDateTimezoned() {
- return _timezoned;
- }
-
- @Override
- public String stringValue() {
- String xsDateStrValue = "";
-
- Calendar calendarObj = getCalendar();
-
- if (calendarObj.get(Calendar.ERA) == GregorianCalendar.BC) {
- xsDateStrValue += "-";
- }
-
- xsDateStrValue += XSDateTime.padInt(calendarObj.get(Calendar.YEAR), 4);
-
- xsDateStrValue += "-";
- xsDateStrValue += XSDateTime.padInt(month(), 2);
-
- xsDateStrValue += "-";
- xsDateStrValue += XSDateTime.padInt(calendarObj.get(Calendar.
- DAY_OF_MONTH), 2);
-
- if (isDateTimezoned()) {
- int hrs = _tz.hours();
- int min = _tz.minutes();
- double secs = _tz.seconds();
- if (hrs == 0 && min == 0 && secs == 0) {
- xsDateStrValue += "Z";
- } else {
- String timezoneStr = "";
- if (_tz.negative()) {
- timezoneStr += "-";
- } else {
- timezoneStr += "+";
- }
- timezoneStr += XSDateTime.padInt(hrs, 2);
- timezoneStr += ":";
- timezoneStr += XSDateTime.padInt(min, 2);
-
- xsDateStrValue += timezoneStr;
- }
- }
-
- return xsDateStrValue;
- }
-
- /**
- * Determine whether, two XSDate objects are equal.
- */
- public boolean equals(XSDate xsDate) {
- boolean isDateEqual = false;
-
- Calendar cal1 = getCalendar();
- Calendar cal2 = xsDate.getCalendar();
-
- int year1 = cal1.get(Calendar.YEAR);
- int month1 = cal1.get(Calendar.MONTH);
- int date1 = cal1.get(Calendar.DATE);
-
- int year2 = cal2.get(Calendar.YEAR);
- int month2 = cal2.get(Calendar.MONTH);
- int date2 = cal2.get(Calendar.DATE);
-
- XSDuration tz1 = getTimezone();
- XSDuration tz2 = xsDate.getTimezone();
-
- isDateEqual = ((year1 == year2) && (month1 == month2) && (date1 == date2)) &&
- isTimezoneEqual(tz1, tz2, isPopulatedFromFnCurrentDate,
- xsDate.isPopulatedFromFnCurrentDate());
-
- return isDateEqual;
- }
-
- @Override
- public boolean equals(Object obj) {
- boolean isDateEqual = false;
-
- if (obj instanceof XSDate) {
- isDateEqual = this.equals((XSDate)obj);
- }
-
- return isDateEqual;
- }
-
- @Override
- public int hashCode() {
- String strVal = stringValue();
-
- return strVal.hashCode();
- }
-
- /**
- * Determine whether, this XSDate object is less that, the
- * XSDate object provided as an argument to this method.
- */
- public boolean lt(XSDate xsDate) {
- boolean isDateBefore = false;
-
- Calendar cal1 = getCalendar();
- Calendar cal2 = xsDate.getCalendar();
-
- Date date1 = new Date(cal1.get(Calendar.YEAR), cal1.get(Calendar.MONTH),
- cal1.get(Calendar.DATE));
- Date date2 = new Date(cal2.get(Calendar.YEAR), cal2.get(Calendar.MONTH),
- cal2.get(Calendar.DATE));
-
- isDateBefore = date1.before(date2);
-
- return isDateBefore;
- }
-
- /**
- * Determine whether, this XSDate object is greater than, the
- * XSDate object provided as an argument to this method.
- */
- public boolean gt(XSDate xsDate) {
- boolean isDateAfter = false;
-
- Calendar cal1 = getCalendar();
- Calendar cal2 = xsDate.getCalendar();
-
- Date date1 = new Date(cal1.get(Calendar.YEAR), cal1.get(Calendar.MONTH),
- cal1.get(Calendar.DATE));
- Date date2 = new Date(cal2.get(Calendar.YEAR), cal2.get(Calendar.MONTH),
- cal2.get(Calendar.DATE));
-
- isDateAfter = date1.after(date2);
-
- return isDateAfter;
- }
-
- /**
- * Implementation of addition operation between this XSDate value, and a supplied value
- * (as per XPath 3.1 spec, xs:yearMonthDuration and xs:dayTimeDuration are the only permissible
- * data type values, that may be added to an xs:date value).
- */
- public XObject add(XObject xObject) throws TransformerException {
- XObject result = null;
-
- if (!((xObject instanceof XSYearMonthDuration) || (xObject instanceof XSDayTimeDuration))) {
- throw new TransformerException("XPTY0004 : The values of types xs:yearMonthDuration or "
- + "xs:dayTimeDuration are only ones that may be added to an xs:date value.");
- }
-
- if (xObject instanceof XSYearMonthDuration) {
- XSYearMonthDuration argVal = (XSYearMonthDuration)xObject;
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.add(Calendar.MONTH, argVal.monthValue());
- result = new XSDate(cal1, getTimezone());
- }
- else if (xObject instanceof XSDayTimeDuration) {
- XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
- double argValSecs = argVal.value();
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000))));
- result = new XSDate(cal1, getTimezone());
- }
-
- return result;
- }
-
- /**
- * Implementation of subtraction operation between this XSDate value, and a supplied value
- * (as per XPath 3.1 spec, xs:date, xs:yearMonthDuration and xs:dayTimeDuration are the only
- * permissible data type values, that may be subtracted from an xs:date value).
- */
- public XObject subtract(XObject xObject) throws TransformerException {
- XObject result = null;
-
- if (!((xObject instanceof XSDate) || (xObject instanceof XSYearMonthDuration)
- || (xObject instanceof XSDayTimeDuration))) {
- throw new TransformerException("XPTY0004 : The values of types xs:date, xs:yearMonthDuration or "
- + "xs:dayTimeDuration are only ones that may be subtracted from an xs:date value.");
- }
-
- if (xObject instanceof XSDate) {
- Calendar cal1 = getCalendar();
- Calendar cal2 = ((XSDate)xObject).getCalendar();
- long diffDurationMilliSecs = cal1.getTimeInMillis() - cal2.getTimeInMillis();
- result = new XSDuration(diffDurationMilliSecs / 1000);
- }
- else if (xObject instanceof XSYearMonthDuration) {
- XSYearMonthDuration argVal = (XSYearMonthDuration)xObject;
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.add(Calendar.MONTH, argVal.monthValue() * -1);
- result = new XSDate(cal1, getTimezone());
- }
- else if (xObject instanceof XSDayTimeDuration) {
- XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
- double argValSecs = argVal.value();
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000)) * -1));
- result = new XSDate(cal1, getTimezone());
- }
-
- return result;
- }
-
- public boolean isPopulatedFromFnCurrentDate() {
- return isPopulatedFromFnCurrentDate;
- }
-
- public void setPopulatedFromFnCurrentDate(boolean isPopulatedFromFnCurrentDate) {
- this.isPopulatedFromFnCurrentDate = isPopulatedFromFnCurrentDate;
- }
-
- public int getType() {
- return CLASS_XS_DATE;
- }
-
- /**
- * Do a data type cast, of an XSAnyType argument passed to this method, to
- * an XSDate object.
- */
- private XSDate castToDate(XSAnyType xsAnyType) throws TransformerException {
- if (xsAnyType instanceof XSDate) {
- XSDate date = (XSDate) xsAnyType;
- return new XSDate(date.getCalendar(), date.getTimezone());
- }
-
- if (xsAnyType instanceof XSDateTime) {
- XSDateTime dateTime = (XSDateTime) xsAnyType;
- return new XSDate(dateTime.getCalendar(), dateTime.getTimezone());
- }
-
- return parseDate(xsAnyType.stringValue());
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSDateTime.java b/src/org/apache/xpath/xs/types/XSDateTime.java
deleted file mode 100644
index f902deb3..00000000
--- a/src/org/apache/xpath/xs/types/XSDateTime.java
+++ /dev/null
@@ -1,928 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id$
- */
-package org.apache.xpath.xs.types;
-
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.objects.ResultSequence;
-import org.apache.xpath.objects.XObject;
-
-/**
- * An XML Schema data type representation, of the xs:dateTime
- * datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSDateTime extends XSCalendarType {
-
- private static final long serialVersionUID = -2163029573822424868L;
-
- private static final String XS_DATE_TIME = "xs:dateTime";
-
- private Calendar _calendar;
-
- private boolean _timezoned;
-
- private XSDuration _tz;
-
- /**
- * The value of this class field, stores the fact that whether this
- * XSDateTime object is constructed via XPath function call
- * fn:current-dateTime().
- */
- private boolean isPopulatedFromFnCurrentDateTime = false;
-
- /**
- * Class constructor.
- *
- * Creates a new XSDateTime object instance, corresponding to the provided
- * date, time and timezone.
- *
- * @param cal the java.util.Calendar representation of the date and
- * time to be stored
- *
- * @param tz the timezone of the date to be stored
- */
- public XSDateTime(Calendar cal, XSDuration tz) {
- _calendar = cal;
- _tz = tz;
-
- if (tz == null) {
- _timezoned = false;
- }
- else {
- _timezoned = true;
- }
- }
-
- /*
- * Class constructor.
- */
- public XSDateTime(Calendar cal) {
- _calendar = cal;
-
- if (_tz == null) {
- _timezoned = false;
- }
- else {
- _timezoned = true;
- }
- }
-
- /*
- * Class constructor.
- */
- public XSDateTime() {
- this(new GregorianCalendar(), null);
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) throws TransformerException {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- XSDateTime xsDateTime = castToDateTime(xsAnyType);
-
- resultSeq.add(xsDateTime);
-
- return resultSeq;
- }
-
- public Calendar getCalendar() {
- return _calendar;
- }
-
- public XSDuration getTimezone() {
- return _tz;
- }
-
- @Override
- public String typeName() {
- return "dateTime";
- }
-
- /**
- * Method to check, whether the provided character is numeric.
- *
- * @param x the character for which, this check is done
- *
- * @return true if the character is numeric. false otherwise.
- */
- public static boolean isDigit(char x) {
- if ('0' <= x && x <= '9') {
- return true;
- }
-
- return false;
- }
-
- /**
- * Parse a string representation of a date and time, and retrieve the year,
- * month and day components from this string.
- *
- * @param strVal the string representation of the date (with an optional
- * timezone value)
- *
- * @return an integer array of size 3. first element of this array is the year,
- * second element is the month, and third element is the day.
- */
- public static int[] parseDate(String strVal) {
-
- int[] returnVal = new int[3];
-
- int state = 0;
-
- for (int i = 0; i < returnVal.length; i++) {
- returnVal[i] = 0;
- }
-
- String token = "";
- for (int i = 0; i < strVal.length(); i++) {
- char x = strVal.charAt(i);
-
- switch (state) {
- case 0:
- if (isDigit(x)) {
- token += x;
- } else if (x == '-') {
- token += x;
- } else {
- return null;
- }
- state = 1;
- break;
- case 1:
- if (x == '-') {
- String uy = token;
- if (uy.startsWith("-")) {
- uy = uy.substring(1, uy.length());
- }
- int uyl = uy.length();
-
- if (uyl < 4) {
- return null;
- }
-
- if (uyl == 4) {
- if (uy.compareTo("0000") == 0) {
- return null;
- }
- }
- else if (uy.charAt(0) == '0') {
- return null;
- }
-
- returnVal[0] = Integer.parseInt(token);
- token = "";
- state = 2;
- }
- else if (isDigit(x)) {
- token += x;
- }
- else {
- return null;
- }
- break;
- case 2:
- if (x == '-') {
- if (token.length() != 2) {
- return null;
- }
-
- returnVal[1] = Integer.parseInt(token);
- token = "";
- state = 3;
- } else if (isDigit(x)) {
- token += x;
- }
- else {
- return null;
- }
- break;
- case 3:
- if (isDigit(x)) {
- token += x;
- }
- else {
- return null;
- }
- break;
- default:
- return returnVal;
- }
- }
-
- if (state != 3) {
- return null;
- }
-
- if (token.length() != 2) {
- return null;
- }
-
- returnVal[2] = Integer.parseInt(token);
-
- return returnVal;
- }
-
- /**
- * Parse a string representation of a date and time, and retrieve the hour,
- * minute and second components from this string.
- *
- * @param strVal the string representation of the date (with an optional
- * timezone value)
- *
- * @return an integer array of size 3. first element is the hour, second
- * element is the minute, and third element is the seconds.
- */
- public static double[] parseTime(String strVal) {
-
- double[] returnVal = new double[3];
-
- int state = 0;
-
- String token = "";
-
- for (int i = 0; i < strVal.length(); i++) {
- char x = strVal.charAt(i);
-
- switch (state) {
- case 0:
- case 1:
- if (x == ':') {
- if (token.length() != 2) {
- return null;
- }
- returnVal[state] = Integer.parseInt(token);
- state++;
- token = "";
- } else if (isDigit(x)) {
- token += x;
- }
- else {
- return null;
- }
- break;
- case 2:
- if (isDigit(x)) {
- token += x;
- if (token.length() > 2) {
- return null;
- }
- } else if (x == '.') {
- token += x;
- state = 3;
- } else {
- return null;
- }
- break;
- case 3:
- if (isDigit(x)) {
- token += x;
- }
- else {
- return null;
- }
- break;
- default:
- return null;
- }
- }
-
- if (!(state == 3 || state == 2)) {
- return null;
- }
-
- if (token.length() == 3) {
- return null;
- }
-
- returnVal[2] = Double.parseDouble(token);
-
- if (returnVal[0] == 24.0) {
- returnVal[0] = 00.0;
- }
-
- return returnVal;
- }
-
- /**
- * Parse a string representation of a date and time, and retrieve the
- * timezone component from this string.
- *
- * @param strVal the string representation of the date (with an optional
- * timezone value)
- *
- * @return an integer array of size 3. first element represents whether the
- * timezone is ahead or behind GMT, second element is the hour
- * displacement, and third element is the minute displacement.
- */
- public static int[] parseTimezone(String strVal) {
-
- int[] returnVal = new int[3];
-
- for (int i = 0; i < returnVal.length; i++) {
- returnVal[i] = 0;
- }
-
- returnVal[0] = 1;
-
- if (strVal.equals("Z")) {
- return returnVal;
- }
-
- if (strVal.startsWith("+")) {
- returnVal[0] = 1;
- }
- else if (strVal.startsWith("-")) {
- returnVal[0] = -1;
- }
- else {
- return null;
- }
-
- strVal = strVal.substring(1, strVal.length());
-
- if (strVal.length() != (2 + 1 + 2)) {
- return null;
- }
-
- try {
- returnVal[1] = Integer.parseInt(strVal.substring(0, 2));
- returnVal[2] = Integer.parseInt(strVal.substring(3, 5));
-
- if (returnVal[1] > 14) {
- return null;
- }
-
- if (returnVal[2] > 59) {
- return null;
- }
-
- return returnVal;
- } catch (NumberFormatException ex) {
- return null;
- }
- }
-
- /**
- * Parse a string representation of a date and time, and construct a new
- * XSDateTime object using that information.
- *
- * @param strVal the string representation of the date (with an optional
- * timezone value)
- *
- * @return the XSDateTime representation of the date and time (with an
- * optional timezone value)
- */
- public static XSDateTime parseDateTime(String strVal) throws TransformerException {
-
- XSDateTime xsDateTime = null;
-
- try {
- int idx = strVal.indexOf('T');
- if (idx == -1) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- String date = strVal.substring(0, idx);
- String time = strVal.substring(idx + 1, strVal.length());
- String timezone = null;
-
- idx = time.indexOf('+');
- if (idx == -1) {
- idx = time.indexOf('-');
- }
- if (idx == -1) {
- idx = time.indexOf('Z');
- }
- if (idx != -1) {
- timezone = time.substring(idx, time.length());
- time = time.substring(0, idx);
- }
-
- int d[] = parseDate(date);
- if (d == null) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- TimeZone defaultTimezone = TimeZone.getDefault();
- GregorianCalendar gregorianCalendarObj = new GregorianCalendar(
- defaultTimezone);
-
- int year = d[0];
- if (year < 0) {
- year *= -1;
- gregorianCalendarObj.set(Calendar.ERA, GregorianCalendar.BC);
- } else {
- gregorianCalendarObj.set(Calendar.ERA, GregorianCalendar.AD);
- }
-
- gregorianCalendarObj.set(Calendar.DAY_OF_MONTH, 2);
- gregorianCalendarObj.set(Calendar.MONTH, 2);
-
- if (!setItem(gregorianCalendarObj, Calendar.YEAR, year)) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- if (!setItem(gregorianCalendarObj, Calendar.MONTH, d[1] - 1)) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- if (!setItem(gregorianCalendarObj, Calendar.DAY_OF_MONTH, d[2])) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- double t[] = parseTime(time);
- if (t == null) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- if (!setItem(gregorianCalendarObj, Calendar.HOUR_OF_DAY, (int) t[0])) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- if (!setItem(gregorianCalendarObj, Calendar.MINUTE, (int) t[1])) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- if (!setItem(gregorianCalendarObj, Calendar.SECOND, (int) t[2])) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- double ms = t[2] - ((int) t[2]);
- ms *= 1000;
- if (!setItem(gregorianCalendarObj, Calendar.MILLISECOND, (int) ms)) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- int tz[] = null;
- XSDuration timezoneVal = null;
- if (timezone != null) {
- tz = parseTimezone(timezone);
-
- if (tz == null) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- timezoneVal = new XSDayTimeDuration(0, tz[1], tz[2], 0.0, tz[0] < 0);
- }
-
- xsDateTime = new XSDateTime(gregorianCalendarObj, timezoneVal);
- }
- catch (TransformerException ex) {
- throw ex;
- }
- catch (Exception ex) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dateTime value.");
- }
-
- return xsDateTime;
- }
-
- @Override
- public String stringType() {
- return XS_DATE_TIME;
- }
-
- public static String padInt(int num, int len) {
- String returnVal = "";
-
- String numStr = "" + num;
-
- int pad = len - numStr.length();
-
- if (num < 0) {
- returnVal += "-";
- numStr = numStr.substring(1, numStr.length());
- pad++;
- }
-
- StringBuffer strBuf = new StringBuffer(returnVal);
-
- for (int i = 0; i < pad; i++) {
- strBuf.append("0");
- }
-
- strBuf.append(numStr);
-
- returnVal = strBuf.toString();
-
- return returnVal;
- }
-
- public int year() {
- int year = _calendar.get(Calendar.YEAR);
- if (_calendar.get(Calendar.ERA) == GregorianCalendar.BC) {
- year = year * -1;
- }
-
- return year;
- }
-
- public int month() {
- return _calendar.get(Calendar.MONTH) + 1;
- }
-
- public int day() {
- return _calendar.get(Calendar.DAY_OF_MONTH);
- }
-
- public int hour() {
- return _calendar.get(Calendar.HOUR_OF_DAY);
- }
-
- public int minute() {
- return _calendar.get(Calendar.MINUTE);
- }
-
- public double second() {
- double secondVal = _calendar.get(Calendar.SECOND);
- double millisecVal = _calendar.get(Calendar.MILLISECOND);
-
- millisecVal /= 1000;
- secondVal += millisecVal;
-
- return secondVal;
- }
-
- /**
- * Check whether this XSDateTime object has an, timezone associated with it.
- *
- * @return true if there is a timezone associated with this XSDateTime object.
- * false otherwise.
- */
- public boolean isDateTimeTimezoned() {
- return _timezoned;
- }
-
- @Override
- public String stringValue() {
- String returnVal = "";
-
- Calendar calendarVal = getCalendar();
-
- if (calendarVal.get(Calendar.ERA) == GregorianCalendar.BC) {
- returnVal += "-";
- }
-
- returnVal += padInt(calendarVal.get(Calendar.YEAR), 4);
-
- returnVal += "-";
- returnVal += padInt(month(), 2);
-
- returnVal += "-";
- returnVal += padInt(calendarVal.get(Calendar.DAY_OF_MONTH), 2);
-
- returnVal += "T";
-
- returnVal += padInt(calendarVal.get(Calendar.HOUR_OF_DAY), 2);
-
- returnVal += ":";
- returnVal += padInt(calendarVal.get(Calendar.MINUTE), 2);
-
- returnVal += ":";
- int intSec = (int)second();
- double doubleSec = second();
-
- if ((doubleSec - intSec) == 0.0) {
- returnVal += padInt(intSec, 2);
- }
- else {
- if (doubleSec < 10.0) {
- returnVal += "0" + doubleSec;
- }
- else {
- returnVal += doubleSec;
- }
- }
-
- if (isDateTimeTimezoned()) {
- int hrs = _tz.hours();
- int min = _tz.minutes();
- double secs = _tz.seconds();
- if ((hrs == 0) && (min == 0) && (secs == 0)) {
- returnVal += "Z";
- } else {
- String timezoneStr = "";
- if (_tz.negative()) {
- timezoneStr += "-";
- } else {
- timezoneStr += "+";
- }
- timezoneStr += padInt(hrs, 2);
- timezoneStr += ":";
- timezoneStr += padInt(min, 2);
-
- returnVal += timezoneStr;
- }
- }
-
- return returnVal;
- }
-
- /**
- * Determine whether, two XSDateTime objects are equal.
- */
- public boolean equals(XSDateTime xsDateTime) {
- boolean isDateTimeEqual = false;
-
- Calendar cal1 = getCalendar();
- Calendar cal2 = xsDateTime.getCalendar();
-
- int year1 = cal1.get(Calendar.YEAR);
- int month1 = cal1.get(Calendar.MONTH);
- int date1 = cal1.get(Calendar.DATE);
- int hour1 = hour();
- int mins1 = minute();
- double secs1 = second();
-
- int year2 = cal2.get(Calendar.YEAR);
- int month2 = cal2.get(Calendar.MONTH);
- int date2 = cal2.get(Calendar.DATE);
- int hour2 = xsDateTime.hour();
- int mins2 = xsDateTime.minute();
- double secs2 = xsDateTime.second();
-
- XSDuration tz1 = getTimezone();
- XSDuration tz2 = xsDateTime.getTimezone();
-
- isDateTimeEqual = ((year1 == year2) && (month1 == month2) && (date1 == date2) &&
- (hour1 == hour2) && (mins1 == mins2) && (secs1 == secs2)) &&
- isTimezoneEqual(tz1, tz2, isPopulatedFromFnCurrentDateTime,
- xsDateTime.isPopulatedFromFnCurrentDateTime());
-
- return isDateTimeEqual;
- }
-
- @Override
- public boolean equals(Object obj) {
- boolean isDateTimeEqual = false;
-
- if (obj instanceof XSDateTime) {
- isDateTimeEqual = this.equals((XSDateTime)obj);
- }
-
- return isDateTimeEqual;
- }
-
- @Override
- public int hashCode() {
- String strVal = stringValue();
-
- return strVal.hashCode();
- }
-
- /**
- * Determine whether, this XSDateTime object is less than, the
- * XSDateTime object provided as an argument to this method.
- */
- public boolean lt(XSDateTime xsDateTime) {
- boolean isDateTimeBefore = false;
-
- Calendar cal1 = getCalendar();
- Calendar cal2 = xsDateTime.getCalendar();
-
- Date date1 = new Date(cal1.get(Calendar.YEAR), cal1.get(Calendar.MONTH),
- cal1.get(Calendar.DATE));
- Date date2 = new Date(cal2.get(Calendar.YEAR), cal2.get(Calendar.MONTH),
- cal2.get(Calendar.DATE));
-
- if (date1.before(date2)) {
- isDateTimeBefore = true;
- }
- else if (date1.equals(date2)) {
- int hour1 = hour();
- int mins1 = minute();
- double secs1 = second();
-
- int hour2 = xsDateTime.hour();
- int mins2 = xsDateTime.minute();
- double secs2 = xsDateTime.second();
-
- if (hour1 < hour2) {
- isDateTimeBefore = true;
- }
- else if (hour1 == hour2) {
- if (mins1 < mins2) {
- isDateTimeBefore = true;
- }
- else if (mins1 == mins2) {
- if (secs1 < secs2) {
- isDateTimeBefore = true;
- }
- }
- }
- }
-
- return isDateTimeBefore;
- }
-
- /**
- * Determine whether, this XSDateTime object is greater than, the
- * XSDateTime object provided as an argument to this method.
- */
- public boolean gt(XSDateTime xsDateTime) {
- boolean isDateTimeAfter = false;
-
- Calendar cal1 = getCalendar();
- Calendar cal2 = xsDateTime.getCalendar();
-
- Date date1 = new Date(cal1.get(Calendar.YEAR), cal1.get(Calendar.MONTH),
- cal1.get(Calendar.DATE));
- Date date2 = new Date(cal2.get(Calendar.YEAR), cal2.get(Calendar.MONTH),
- cal2.get(Calendar.DATE));
-
- if (date1.after(date2)) {
- isDateTimeAfter = true;
- }
- else if (date1.equals(date2)) {
- int hour1 = hour();
- int mins1 = minute();
- double secs1 = second();
-
- int hour2 = xsDateTime.hour();
- int mins2 = xsDateTime.minute();
- double secs2 = xsDateTime.second();
-
- if (hour1 > hour2) {
- isDateTimeAfter = true;
- }
- else if (hour1 == hour2) {
- if (mins1 > mins2) {
- isDateTimeAfter = true;
- }
- else if (mins1 == mins2) {
- if (secs1 > secs2) {
- isDateTimeAfter = true;
- }
- }
- }
- }
-
- return isDateTimeAfter;
- }
-
- /**
- * Implementation of addition operation between this XSDateTime value, and a supplied value
- * (as per XPath 3.1 spec, xs:yearMonthDuration and xs:dayTimeDuration are the only permissible
- * data type values, that may be added to an xs:dateTime value).
- */
- public XObject add(XObject xObject) throws TransformerException {
- XObject result = null;
-
- if (!((xObject instanceof XSYearMonthDuration) || (xObject instanceof XSDayTimeDuration))) {
- throw new TransformerException("XPTY0004 : The values of types xs:yearMonthDuration or "
- + "xs:dayTimeDuration are only ones that may be added to an xs:dateTime value.");
- }
-
- if (xObject instanceof XSYearMonthDuration) {
- XSYearMonthDuration argVal = (XSYearMonthDuration)xObject;
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.add(Calendar.MONTH, argVal.monthValue());
- result = new XSDateTime(cal1, getTimezone());
- }
- else if (xObject instanceof XSDayTimeDuration) {
- XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
- double argValSecs = argVal.value();
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000))));
- result = new XSDateTime(cal1, getTimezone());
- }
-
- return result;
- }
-
- /**
- * Implementation of subtraction operation between this XSDateTime value, and a supplied value
- * (as per XPath 3.1 spec, xs:dateTime, xs:yearMonthDuration and xs:dayTimeDuration are the only
- * permissible data type values, that may be subtracted from an xs:dateTime value).
- */
- public XObject subtract(XObject xObject) throws TransformerException {
- XObject result = null;
-
- if (!((xObject instanceof XSDateTime) || (xObject instanceof XSYearMonthDuration)
- || (xObject instanceof XSDayTimeDuration))) {
- throw new TransformerException("XPTY0004 : The values of types xs:dateTime, xs:yearMonthDuration or "
- + "xs:dayTimeDuration are only ones that may be subtracted from an xs:dateTime value.");
- }
-
- if (xObject instanceof XSDateTime) {
- Calendar cal1 = getCalendar();
- Calendar cal2 = ((XSDateTime)xObject).getCalendar();
- long diffDurationMilliSecs = cal1.getTimeInMillis() - cal2.getTimeInMillis();
- result = new XSDayTimeDuration(diffDurationMilliSecs / 1000);
- }
- else if (xObject instanceof XSYearMonthDuration) {
- XSYearMonthDuration argVal = (XSYearMonthDuration)xObject;
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.add(Calendar.MONTH, argVal.monthValue() * -1);
- result = new XSDateTime(cal1, getTimezone());
- }
- else if (xObject instanceof XSDayTimeDuration) {
- XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
- double argValSecs = argVal.value();
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000)) * -1));
- result = new XSDateTime(cal1, getTimezone());
- }
-
- return result;
- }
-
- public boolean isPopulatedFromFnCurrentDateTime() {
- return isPopulatedFromFnCurrentDateTime;
- }
-
- public void setPopulatedFromFnCurrentDateTime(boolean isPopulatedFromFnCurrentDateTime) {
- this.isPopulatedFromFnCurrentDateTime = isPopulatedFromFnCurrentDateTime;
- }
-
- public int getType() {
- return CLASS_XS_DATETIME;
- }
-
- /**
- * Do a data type cast, of an XSAnyType argument passed to this method, to
- * an XSDateTime object.
- */
- private XSDateTime castToDateTime(XSAnyType xsAnyType) throws TransformerException {
- if (xsAnyType instanceof XSDate) {
- XSDate xsDate = (XSDate) xsAnyType;
- return new XSDateTime(xsDate.getCalendar(), xsDate.getTimezone());
- }
-
- if (xsAnyType instanceof XSDateTime) {
- XSDateTime xsDateTime = (XSDateTime) xsAnyType;
- return new XSDateTime(xsDateTime.getCalendar(), xsDateTime.getTimezone());
- }
-
- return parseDateTime(xsAnyType.stringValue());
- }
-
- /**
- * Set a particular field within an java.util.Calendar object.
- *
- * @param cal the Calendar object to set the field in
- * @param fieldId the field to set
- * @param fieldval the value to set the field to
- *
- * @return true if successfully set. false otherwise
- */
- private static boolean setItem(Calendar cal, int fieldId, int fieldval) {
-
- if (fieldval < cal.getActualMinimum(fieldId)) {
- return false;
- }
-
- if (fieldval > cal.getActualMaximum(fieldId)) {
- return false;
- }
-
- cal.set(fieldId, fieldval);
-
- return true;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSDayTimeDuration.java b/src/org/apache/xpath/xs/types/XSDayTimeDuration.java
deleted file mode 100644
index 44fbd2cd..00000000
--- a/src/org/apache/xpath/xs/types/XSDayTimeDuration.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id$
- */
-package org.apache.xpath.xs.types;
-
-import java.math.BigDecimal;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:dayTimeDuration
- * datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSDayTimeDuration extends XSDuration {
-
- private static final long serialVersionUID = 4194060959383397526L;
-
- private static final String XS_DAY_TIME_DURATION = "xs:dayTimeDuration";
-
- /**
- * Initializes an XSDayTimeDuration object, with the supplied parameters. If more than 24
- * hours is supplied, the number of days is adjusted accordingly. The same occurs for
- * minutes and seconds.
- *
- * @param days number of days in this duration of time
- * @param hours number of hours in this duration of time
- * @param minutes number of minutes in this duration of time
- * @param seconds number of seconds in this duration of time
- * @param negative true if this duration of time represents a backwards passage
- * through time. false otherwise.
- */
- public XSDayTimeDuration(int days, int hours, int minutes, double seconds,
- boolean negative) {
- super(0, 0, days, hours, minutes, seconds, negative);
- }
-
- /**
- * Initializes an XSDayTimeDuration object, to the given number of seconds.
- *
- * @param secs number of seconds in the duration of time
- */
- public XSDayTimeDuration(double secs) {
- super(0, 0, 0, 0, 0, Math.abs(secs), secs < 0);
- }
-
- /**
- * Initializes an XSDayTimeDuration object, to a duration of no time
- * (i.e, 0 days, 0 hours, 0 minutes, 0 seconds).
- */
- public XSDayTimeDuration() {
- super(0, 0, 0, 0, 0, 0.0, false);
- }
-
- /**
- * A method to construct an xdm sequence comprising a
- * xs:dayTimeDuration value, given input data as argument
- * to this method.
- *
- * @throws TransformerException
- */
- public ResultSequence constructor(ResultSequence arg) throws TransformerException {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- XSDuration xsDuration = castToDayTimeDuration(xsAnyType);
-
- resultSeq.add(xsDuration);
-
- return resultSeq;
- }
-
-
- /**
- * Creates a new XSDuration object, by parsing the supplied String
- * representation of XSDuration.
- *
- * @param strVal String representation of XSDuration value
- *
- * @return new XSDuration object, representing the
- * supplied string.
- */
- public static XSDuration parseDayTimeDuration(String strVal) throws TransformerException {
-
- boolean isDurationNegative = false;
-
- int days = 0;
- int hours = 0;
- int minutes = 0;
- double seconds = 0;
-
- String pstr = null;
- String tstr = null;
-
- if (strVal.startsWith("-P")) {
- isDurationNegative = true;
- pstr = strVal.substring(2, strVal.length());
- } else if (strVal.startsWith("P")) {
- isDurationNegative = false;
- pstr = strVal.substring(1, strVal.length());
- } else {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dayTimeDuration value.");
- }
-
- try {
- int index = pstr.indexOf('D');
- boolean actionStatus = false;
-
- if (index == -1) {
- if (pstr.startsWith("T")) {
- tstr = pstr.substring(1, pstr.length());
- } else {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dayTimeDuration value.");
- }
- } else {
- String digit = pstr.substring(0, index);
- days = Integer.parseInt(digit);
- tstr = pstr.substring(index + 1, pstr.length());
-
- if (tstr.startsWith("T")) {
- tstr = tstr.substring(1, tstr.length());
- } else {
- if (tstr.length() > 0) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dayTimeDuration value.");
- }
- tstr = "";
- actionStatus = true;
- }
- }
-
- index = tstr.indexOf('H');
- if (index != -1) {
- String digit = tstr.substring(0, index);
- hours = Integer.parseInt(digit);
- tstr = tstr.substring(index + 1, tstr.length());
- actionStatus = true;
- }
-
- index = tstr.indexOf('M');
- if (index != -1) {
- String digit = tstr.substring(0, index);
- minutes = Integer.parseInt(digit);
- tstr = tstr.substring(index + 1, tstr.length());
- actionStatus = true;
- }
-
- index = tstr.indexOf('S');
- if (index != -1) {
- String digit = tstr.substring(0, index);
- seconds = Double.parseDouble(digit);
- tstr = tstr.substring(index + 1, tstr.length());
- actionStatus = true;
- }
- if (actionStatus) {
- if (tstr.length() != 0) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dayTimeDuration value.");
- }
- } else {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dayTimeDuration value.");
- }
- }
- catch (TransformerException ex) {
- throw ex;
- }
- catch (Exception ex) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:dayTimeDuration value.");
- }
-
- return new XSDayTimeDuration(days, hours, minutes, seconds, isDurationNegative);
- }
-
- /**
- * Get the datatype's name.
- *
- * @return 'dayTimeDuration', which is this datatype's name
- */
- public String typeName() {
- return "dayTimeDuration";
- }
-
- /**
- * Get the datatype's name.
- *
- * @return 'xs:dayTimeDuration', which is this datatype's name
- */
- public String stringType() {
- return XS_DAY_TIME_DURATION;
- }
-
- /**
- * Method to add an XSDayTimeDuration value, to this
- * XSDayTimeDuration value.
- */
- public XSDayTimeDuration add(XSDayTimeDuration xsDayTimeDuration) {
- double sum = value() + xsDayTimeDuration.value();
-
- return new XSDayTimeDuration(sum);
- }
-
- /**
- * Method to subtract an XSDayTimeDuration value, from this
- * XSDayTimeDuration value.
- */
- public XSDayTimeDuration subtract(XSDayTimeDuration xsDayTimeDuration) {
- double diff = value() - xsDayTimeDuration.value();
-
- return new XSDayTimeDuration(diff);
- }
-
- /**
- * Method to multiply an XSDayTimeDuration value represented by this
- * object, with a numeric value represented by an argument passed to
- * this method.
- *
- * @throws TransformerException
- */
- public XSDayTimeDuration mult(XSAnyType xsAnyType) throws TransformerException {
-
- XSDayTimeDuration result = null;
-
- if (xsAnyType instanceof XSNumericType) {
- String argStrVal = ((XSNumericType)xsAnyType).stringValue();
- XSDouble argDoubleVal = new XSDouble(argStrVal);
- if (argDoubleVal.nan()) {
- throw new TransformerException("FOCA0005 : Cannot multiply an XSDayTimeDuration value with NaN.");
- }
- else {
- result = new XSDayTimeDuration(value() * argDoubleVal.doubleValue());
- }
- }
- else {
- throw new TransformerException("FOCA0005 : Cannot multiply an XSDayTimeDuration value with a "
- + "non-numeric value");
- }
-
- return result;
- }
-
- /**
- * Method to divide this XSDayTimeDuration value, by a value (that needs to be
- * either a numeric value or a XSDayTimeDuration value) that is passed as an
- * argument to this method.
- *
- * @throws TransformerException
- */
- public XSDayTimeDuration div(XSAnyType xsAnyType) throws TransformerException {
-
- XSDayTimeDuration result = null;
-
- if (xsAnyType instanceof XSNumericType) {
- String argStrVal = ((XSNumericType)xsAnyType).stringValue();
- XSDouble argDoubleVal = new XSDouble(argStrVal);
- if (argDoubleVal.nan()) {
- throw new TransformerException("FOCA0005 : Cannot divide an XSDayTimeDuration value with NaN.");
- }
- else if (argDoubleVal.zero()) {
- throw new TransformerException("FODT0001 : Cannot divide an XSDayTimeDuration value with zero.");
- }
- else if (argDoubleVal.infinite()) {
- double doubleResultVal = value() / argDoubleVal.doubleValue();
- result = new XSDayTimeDuration(doubleResultVal);
- }
- else {
- BigDecimal bigDecimal1 = new BigDecimal(value());
- BigDecimal bigDecimal2 = new BigDecimal(argDoubleVal.doubleValue());
- BigDecimal bigDecimalResult = bigDecimal1.divide(new BigDecimal(bigDecimal2.doubleValue()),
- 18, BigDecimal.ROUND_HALF_EVEN);
- result = new XSDayTimeDuration(bigDecimalResult.doubleValue());
- }
- }
- else if (xsAnyType instanceof XSDayTimeDuration) {
- double dbl2 = ((XSDayTimeDuration)xsAnyType).seconds();
-
- if (dbl2 != 0) {
- BigDecimal bigDecimal1 = new BigDecimal(value());
- BigDecimal bigDecimal2 = new BigDecimal(dbl2);
- BigDecimal bigDecimalResult = bigDecimal1.divide(new BigDecimal(bigDecimal2.doubleValue()),
- 18, BigDecimal.ROUND_HALF_EVEN);
- result = new XSDayTimeDuration(bigDecimalResult.doubleValue());
- }
- else {
- throw new TransformerException("FODT0001 : Cannot divide an XSDayTimeDuration value, with a XSDayTimeDuration "
- + "value that represents zero seconds.");
- }
- }
- else {
- throw new TransformerException("FORG0006 : Cannot divide an XSDayTimeDuration value, with a value that is of "
- + "a type other than numeric or XSDayTimeDuration.");
- }
-
- return result;
- }
-
- public int getType() {
- return CLASS_XS_DAYTIME_DURATION;
- }
-
- /**
- * Do a data type cast, of a XSAnyType value to an XSDuration
- * value.
- * @throws TransformerException
- */
- private XSDuration castToDayTimeDuration(XSAnyType xsAnyType) throws TransformerException {
- if (xsAnyType instanceof XSDuration) {
- XSDuration xsDuration = (XSDuration) xsAnyType;
-
- return new XSDayTimeDuration(xsDuration.days(), xsDuration.hours(),
- xsDuration.minutes(), xsDuration.seconds(),
- xsDuration.negative());
- }
-
- return parseDayTimeDuration(xsAnyType.stringValue());
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSDecimal.java b/src/org/apache/xpath/xs/types/XSDecimal.java
deleted file mode 100644
index 0bde3457..00000000
--- a/src/org/apache/xpath/xs/types/XSDecimal.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import java.math.BigDecimal;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:decimal datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSDecimal extends XSNumericType {
-
- private static final long serialVersionUID = 3338738472846690263L;
-
- private static final String XS_DECIMAL = "xs:decimal";
-
- private BigDecimal _value;
-
- private XPath3DecimalFormat xpath3DecimalFormat = new XPath3DecimalFormat(
- "0.####################");
-
- /**
- * Class constructor.
- */
- public XSDecimal() {
- this(BigDecimal.valueOf(0));
- }
-
- /**
- * Class constructor.
- */
- public XSDecimal(BigDecimal bigDecimal) {
- _value = bigDecimal;
- }
-
- /**
- * Class constructor.
- */
- public XSDecimal(String str) {
- _value = new BigDecimal(str);
- }
-
- @Override
- public String stringType() {
- return XS_DECIMAL;
- }
-
- public String typeName() {
- return "decimal";
- }
-
- @Override
- public String stringValue() {
- if (zero()) {
- return "0";
- }
-
- _value = new BigDecimal((_value.toString()).replaceFirst("0*", ""));
-
- return xpath3DecimalFormat.performStrFormatting(_value);
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- try {
- XSDecimal xsDecimal = castToDecimal(xsAnyType);
- resultSeq.add(xsDecimal);
- } catch (NumberFormatException ex) {
- // to do
- return null;
- }
-
- return resultSeq;
- }
-
- /**
- * Check if this XSDecimal object represents the value 0.
- *
- * @return true if this XSDecimal object represents the value 0.
- * false otherwise.
- */
- public boolean zero() {
- return (_value.compareTo(new BigDecimal(0.0)) == 0);
- }
-
- /**
- * Get the actual value of the number stored within
- * this XSDecimal object.
- *
- * @return the actual value of the number stored
- */
- public double doubleValue() {
- return _value.doubleValue();
- }
-
- public BigDecimal getValue() {
- return _value;
- }
-
- /**
- * Set the numeric double value, within this XSDecimal object.
- *
- * @param val number to be stored
- */
- public void setDouble(double val) {
- _value = new BigDecimal(val);
- }
-
- public boolean equals(XSDecimal xsDecimal) {
- return _value.equals(xsDecimal.getValue());
- }
-
- public boolean lt(XSDecimal xsDecimal) {
- return (_value.compareTo(xsDecimal.getValue()) == -1);
- }
-
- public boolean gt(XSDecimal xsDecimal) {
- return (_value.compareTo(xsDecimal.getValue()) == 1);
- }
-
- public int getType() {
- return CLASS_XS_DECIMAL;
- }
-
- /*
- * Cast an object of type XSAnyType, to an object of type
- * XSDecimal.
- */
- private XSDecimal castToDecimal(XSAnyType xsAnyType) {
- if (xsAnyType instanceof XSBoolean) {
- if ((xsAnyType.stringValue()).equals("true")) {
- return new XSDecimal(new BigDecimal("1"));
- }
- else {
- return new XSDecimal(new BigDecimal("0"));
- }
- }
-
- return new XSDecimal(xsAnyType.stringValue());
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSDouble.java b/src/org/apache/xpath/xs/types/XSDouble.java
deleted file mode 100644
index 455cb0f8..00000000
--- a/src/org/apache/xpath/xs/types/XSDouble.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:double datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSDouble extends XSNumericType {
-
- private static final long serialVersionUID = -2666052244390163961L;
-
- private static final String XS_DOUBLE = "xs:double";
-
- private Double _value;
-
- private XPath3DecimalFormat xpath3DecimalFormat = new XPath3DecimalFormat(
- "0.################E0");
-
- /*
- * Class constructor.
- */
- public XSDouble(double val) {
- _value = new Double(val);
- }
-
- /*
- * Class constructor.
- */
- public XSDouble() {
- this(0);
- }
-
- /*
- * Class constructor.
- */
- public XSDouble(String strVal) throws javax.xml.transform.TransformerException {
- try {
- if (strVal.equals("-INF")) {
- _value = new Double(Double.NEGATIVE_INFINITY);
- } else if (strVal.equals("INF")) {
- _value = new Double(Double.POSITIVE_INFINITY);
- } else {
- _value = new Double(strVal);
- }
- } catch (NumberFormatException ex) {
- throw new javax.xml.transform.TransformerException("FORG0006 : The string value '" +
- strVal + "' cannot be cast to xs:double.");
- }
- }
-
- /**
- * Get a XSDouble object, corresponding to the string valued
- * argument provided.
- *
- * @param strVal string value, to be parsed to an XSDouble object
- *
- * @return an XSDouble object, corresponding to the string
- * argument provided.
- */
- public static XSDouble parseDouble(String strVal) throws javax.xml.transform.TransformerException {
- try {
- Double d1 = null;
-
- if (strVal.equals("INF")) {
- d1 = new Double(Double.POSITIVE_INFINITY);
- } else if (strVal.equals("-INF")) {
- d1 = new Double(Double.NEGATIVE_INFINITY);
- } else {
- d1 = new Double(strVal);
- }
-
- return new XSDouble(d1.doubleValue());
- } catch (NumberFormatException ex) {
- throw new javax.xml.transform.TransformerException("FORG0006 : The string value '" +
- strVal + "' cannot be cast to xs:double.");
- }
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) throws
- javax.xml.transform.TransformerException {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- XSDouble xsAnyTypeConvertedToDouble = null;
-
- if (xsAnyType instanceof XSBoolean) {
- if (xsAnyType.stringValue().equals("true")) {
- xsAnyTypeConvertedToDouble = new XSDouble(1.0E0);
- } else {
- xsAnyTypeConvertedToDouble = new XSDouble(0.0E0);
- }
- }
- else {
- xsAnyTypeConvertedToDouble = parseDouble(xsAnyType.stringValue());
- }
-
- resultSeq.add(xsAnyTypeConvertedToDouble);
-
- return resultSeq;
- }
-
- @Override
- public String typeName() {
- return "double";
- }
-
- @Override
- public String stringType() {
- return XS_DOUBLE;
- }
-
- @Override
- public String stringValue() {
- if (zero()) {
- return "0";
- }
-
- if (negativeZero()) {
- return "-0";
- }
-
- if (nan()) {
- return "NaN";
- }
-
- return xpath3DecimalFormat.performStrFormatting(_value);
- }
-
- /*
- * Check whether this XSDouble object represents -0.
- *
- * @return true if this XSDouble object represents -0.
- * false otherwise.
- */
- public boolean negativeZero() {
- return (Double.compare(_value.doubleValue(), -0.0E0) == 0);
- }
-
- /**
- * Get the actual double primitive value, corresponding to
- * this XSDouble object.
- */
- public double doubleValue() {
- return _value.doubleValue();
- }
-
- /**
- * Check whether this XSDouble object represents NaN.
- */
- public boolean nan() {
- return Double.isNaN(_value.doubleValue());
- }
-
- /**
- * Check whether this XSDouble object represents an
- * infinite number.
- */
- public boolean infinite() {
- return Double.isInfinite(_value.doubleValue());
- }
-
- /**
- * Check whether this XSDouble object represents 0.
- */
- public boolean zero() {
- return (Double.compare(_value.doubleValue(), 0.0E0) == 0);
- }
-
- public boolean equals(XSDouble xsDouble) {
- return _value.equals(xsDouble.doubleValue());
- }
-
- public boolean lt(XSDouble xsDouble) {
- return doubleValue() < xsDouble.doubleValue();
- }
-
- public boolean gt(XSDouble xsDouble) {
- return doubleValue() > xsDouble.doubleValue();
- }
-
- public int getType() {
- return CLASS_XS_DOUBLE;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSDuration.java b/src/org/apache/xpath/xs/types/XSDuration.java
deleted file mode 100644
index 7761d1ca..00000000
--- a/src/org/apache/xpath/xs/types/XSDuration.java
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id$
- */
-package org.apache.xpath.xs.types;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * A representation of the XML Schema xs:duration data type.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSDuration extends XSCtrType {
-
- private static final long serialVersionUID = -8460416911698841833L;
-
- private static final String XS_DURATION = "xs:duration";
-
- protected int _year;
- protected int _month;
- protected int _days;
- protected int _hours;
- protected int _minutes;
- protected double _seconds;
- protected boolean _negative;
-
- /**
- * Initializes to a XSDuration object with the supplied parameters. If more
- * than 24 hours is supplied, the number of days is adjusted accordingly.
- * The same occurs for minutes and seconds.
- *
- * @param years
- * number of years in this duration of time.
- * @param months
- * number of months in this duration of time.
- * @param days
- * number of days in this duration of time
- * @param hours
- * number of hours in this duration of time
- * @param minutes
- * number of minutes in this duration of time
- * @param seconds
- * number of seconds in this duration of time
- * @param negative
- * true if this duration of time represents a backwards passage
- * through time. false otherwise.
- */
- public XSDuration(int years, int months, int days, int hours, int minutes,
- double seconds, boolean negative) {
- _year = years;
- _month = months;
- _days = days;
- _hours = hours;
- _minutes = minutes;
- _seconds = seconds;
- _negative = negative;
-
- if (_month >= 12) {
- _year += _month / 12;
- _month = _month % 12;
- }
-
- if (_seconds >= 60) {
- int isec = (int) _seconds;
- double rem = _seconds - (isec);
-
- _minutes += isec / 60;
- _seconds = isec % 60;
- _seconds += rem;
- }
-
- if (_minutes >= 60) {
- _hours += _minutes / 60;
- _minutes = _minutes % 60;
- }
-
- if (_hours >= 24) {
- _days += _hours / 24;
- _hours = _hours % 24;
- }
-
- }
-
- /**
- * Initializes to the given number of seconds.
- *
- * @param secs number of seconds in the duration of time
- */
- public XSDuration(double secs) {
- this(0, 0, 0, 0, 0, Math.abs(secs), secs < 0);
- }
-
- /**
- * Initializes to a duration of no time (0days, 0hours, 0minutes, 0seconds).
- */
- public XSDuration() {
- this(0, 0, 0, 0, 0, 0.0, false);
- }
-
- public String typeName() {
- return "duration";
- }
-
- public String stringType() {
- return XS_DURATION;
- }
-
- /**
- * Get a string representation of the duration stored.
- *
- * @return string representation of the duration stored
- */
- public String stringValue() {
- String returnVal = "";
-
- boolean didSomething = false;
-
- String tret = "";
-
- if (negative() && !(days() == 0 && hours() == 0 && seconds() == 0))
- returnVal += "-";
-
- returnVal += "P";
-
- int years = year();
- if (years != 0)
- returnVal += years + "Y";
-
- int months = month();
- if (months != 0) {
- returnVal += months + "M";
- }
-
- if (days() != 0) {
- returnVal += days() + "D";
- didSomething = true;
- }
-
- int hours = hours();
- int minutes = minutes();
- double seconds = seconds();
-
- if (hours != 0) {
- tret += hours + "H";
- didSomething = true;
- }
- if (minutes != 0) {
- tret += minutes + "M";
- didSomething = true;
- }
- if (seconds != 0) {
- String doubStr = (new Double(seconds).toString());
- if (doubStr.endsWith(".0")) {
- tret += doubStr.substring(0, doubStr.indexOf(".0")) + "S";
- } else {
- tret += seconds + "S";
- }
- didSomething = true;
- } else if (!didSomething) {
- tret += "0S";
- }
-
- if ((year() == 0 && month() == 0) || (hours > 0 || minutes > 0 || seconds > 0)) {
- if (tret.length() > 0) {
- returnVal += "T" + tret;
- }
- }
-
- return returnVal;
- }
-
- /**
- * Get the number of days within the duration of time stored.
- *
- * @return number of days within the duration of time stored
- */
- public int days() {
- return _days;
- }
-
- /**
- * Get the number of minutes within the duration of time
- * stored.
- *
- * @return number of minutes within the duration of time stored
- */
- public int minutes() {
- return _minutes;
- }
-
- /**
- * Get the number of hours within the duration of time stored.
- *
- * @return number of hours within the duration of time stored
- */
- public int hours() {
- return _hours;
- }
-
- /**
- * Get the number of seconds within the duration of time
- * stored.
- *
- * @return number of seconds within the duration of time stored
- */
- public double seconds() {
- return _seconds;
- }
-
- /**
- * Check whether this duration represents a backward passage through
- * time.
- *
- * @return true if this duration represents a backward passage through time.
- * false otherwise.
- */
- public boolean negative() {
- return _negative;
- }
-
- /**
- * Get the duration of time stored as the number of seconds within it.
- *
- * @return number of seconds making up this duration of time
- */
- public double value() {
- double ret = days() * 24 * 60 * 60;
-
- ret += hours() * 60 * 60;
- ret += minutes() * 60;
- ret += seconds();
-
- if (negative()) {
- ret *= -1;
- }
-
- return ret;
- }
-
- public double timeValue() {
- double ret = 0;
- ret += hours() * 60 * 60;
- ret += minutes() * 60;
- ret += seconds();
-
- if (negative()) {
- ret *= -1;
- }
-
- return ret;
- }
-
- /**
- * A method to construct an xdm sequence comprising a
- * xs:duration value, given input data as argument to
- * this method.
- *
- * @throws TransformerException
- */
- public ResultSequence constructor(ResultSequence arg) throws TransformerException {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- XSDuration xsDuration = castToDuration(xsAnyType);
-
- resultSeq.add(xsDuration);
-
- return resultSeq;
- }
-
- /**
- * Construct a new XSDuration object, by parsing the supplied string.
- *
- * @param strVal string to be parsed
- *
- * @return XSDuration object representing the duration of time supplied
- */
- public static XSDuration parseDuration(String strVal) throws TransformerException {
-
- boolean isDurationNegative = false;
-
- int years = 0;
- int months = 0;
- int days = 0;
- int hours = 0;
- int minutes = 0;
- double seconds = 0;
-
- String pstr = "";
- String tstr = "";
-
- if (strVal.startsWith("-P")) {
- isDurationNegative = true;
- pstr = strVal.substring(2, strVal.length());
- } else if (strVal.startsWith("P")) {
- isDurationNegative = false;
- pstr = strVal.substring(1, strVal.length());
- } else {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:duration value.");
- }
-
- try {
- int index = pstr.indexOf('Y');
- boolean isAction = false;
-
- if (index != -1) {
- String digit = pstr.substring(0, index);
- years = Integer.parseInt(digit);
- pstr = pstr.substring(index + 1, pstr.length());
- isAction = true;
- }
-
- index = pstr.indexOf('M');
- if (index != -1) {
- String digit = pstr.substring(0, index);
- months = Integer.parseInt(digit);
- pstr = pstr.substring(index + 1, pstr.length());
- isAction = true;
- }
-
- // days
- index = pstr.indexOf('D');
-
- if (index == -1) {
- if (pstr.startsWith("T")) {
- tstr = pstr.substring(1, pstr.length());
- }
- } else {
- String digit = pstr.substring(0, index);
- days = Integer.parseInt(digit);
- tstr = pstr.substring(index + 1, pstr.length());
-
- if (tstr.startsWith("T")) {
- tstr = tstr.substring(1, tstr.length());
- } else {
- tstr = "";
- isAction = true;
- }
- }
-
- // hours
- index = tstr.indexOf('H');
- if (index != -1) {
- String digit = tstr.substring(0, index);
- hours = Integer.parseInt(digit);
- tstr = tstr.substring(index + 1, tstr.length());
- isAction = true;
- }
- // minutes
- index = tstr.indexOf('M');
- if (index != -1) {
- String digit = tstr.substring(0, index);
- minutes = Integer.parseInt(digit);
- tstr = tstr.substring(index + 1, tstr.length());
- isAction = true;
- }
- // seconds
- index = tstr.indexOf('S');
- if (index != -1) {
- String digit = tstr.substring(0, index);
- seconds = Double.parseDouble(digit);
- tstr = tstr.substring(index + 1, tstr.length());
- isAction = true;
- }
- if (!isAction) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:duration value.");
- }
-
- }
- catch (TransformerException ex) {
- throw ex;
- }
- catch (Exception ex) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:duration value.");
- }
-
- return new XSDuration(years, months, days, hours, minutes, seconds, isDurationNegative);
- }
-
- /**
- * Get the number of years within the duration of time stored.
- *
- * @return number of years within the duration of time stored
- */
- public int year() {
- return _year;
- }
-
- /**
- * Get the number of months within the duration of time stored.
- *
- * @return number of months within the duration of time stored
- */
- public int month() {
- return _month;
- }
-
- /**
- * This method does an equality comparison between, this and
- * another XSDuration value.
- */
- public boolean equals(XSDuration xsDuration) {
- double val1 = value();
- double val2 = xsDuration.value();
-
- return val1 == val2;
- }
-
- /**
- * This method checks whether, this XSDuration value is less
- * than another one.
- */
- public boolean lt(XSDuration xsDuration) {
- double val1 = value();
- double val2 = xsDuration.value();
-
- return val1 < val2;
- }
-
- /**
- * This method checks whether, this XSDuration value is
- * greater than another one.
- */
- public boolean gt(XSDuration xsDuration) {
- double val1 = value();
- double val2 = xsDuration.value();
-
- return val1 > val2;
- }
-
- public int getType() {
- return CLASS_XS_DURATION;
- }
-
- /**
- * Do a data type cast, of a XSAnyType value to an XSDuration
- * value.
- *
- * @throws TransformerException
- */
- private XSDuration castToDuration(XSAnyType xsAnyType) throws TransformerException {
-
- if (xsAnyType instanceof XSDuration) {
- XSDuration duration = (XSDuration) xsAnyType;
-
- return new XSDuration(duration.year(), duration.month(), duration.days(), duration.hours(),
- duration.minutes(), duration.seconds(), duration.negative());
- }
-
- return parseDuration(xsAnyType.stringValue());
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSFloat.java b/src/org/apache/xpath/xs/types/XSFloat.java
deleted file mode 100644
index d584ad89..00000000
--- a/src/org/apache/xpath/xs/types/XSFloat.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:float datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSFloat extends XSNumericType {
-
- private static final long serialVersionUID = 7301295458418107791L;
-
- private static final String XS_FLOAT = "xs:float";
-
- private Float _value;
-
- private XPath3DecimalFormat xpath3DecimalFormat = new XPath3DecimalFormat(
- "0.#######E0");
-
- /*
- * Class constructor.
- */
- public XSFloat(float x) {
- _value = new Float(x);
- }
-
- /*
- * Class constructor.
- */
- public XSFloat() {
- this(0);
- }
-
- /*
- * Class constructor.
- */
- public XSFloat(String val) {
- try {
- if (val.equals("-INF")) {
- _value = new Float(Float.NEGATIVE_INFINITY);
- } else if (val.equals("INF")) {
- _value = new Float(Float.POSITIVE_INFINITY);
- } else {
- _value = new Float(val);
- }
- } catch (NumberFormatException ex) {
- // to do
- }
- }
-
- public String stringType() {
- return XS_FLOAT;
- }
-
- public String typeName() {
- return "float";
- }
-
- @Override
- public String stringValue() {
- if (zero()) {
- return "0";
- }
-
- if (negativeZero()) {
- return "-0";
- }
-
- if (nan()) {
- return "NaN";
- }
-
- return xpath3DecimalFormat.performStrFormatting(_value);
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- try {
- Float floatVal = null;
-
- if ((xsAnyType.stringValue()).equals("INF")) {
- floatVal = new Float(Float.POSITIVE_INFINITY);
- }
- else if ((xsAnyType.stringValue()).equals("-INF")) {
- floatVal = new Float(Float.NEGATIVE_INFINITY);
- }
- else if (xsAnyType instanceof XSBoolean) {
- if ((xsAnyType.stringValue()).equals("true")) {
- floatVal = new Float("1.0E0");
- } else {
- floatVal = new Float("0.0E0");
- }
- }
- else {
- floatVal = new Float(xsAnyType.stringValue());
- }
-
- resultSeq.add(new XSFloat(floatVal.floatValue()));
- } catch (NumberFormatException e) {
- // to do
- return null;
- }
-
- return resultSeq;
- }
-
- /**
- * Check whether, value of this numeric float object
- * represents NaN.
- *
- * @return true if this numeric float object represents NaN.
- * false otherwise.
- */
- public boolean nan() {
- return Float.isNaN(_value.floatValue());
- }
-
- /**
- * Check whether this float object, represents negative or positive
- * infinity.
- *
- * @return true is this float object represents infinity.
- * false otherwise.
- */
- public boolean infinite() {
- return Float.isInfinite(_value.floatValue());
- }
-
- /**
- * Check whether this numeric float object represents 0.
- *
- * @return true if this numeric float object represents 0.
- * false otherwise.
- */
- public boolean zero() {
- return (Float.compare(_value.floatValue(), 0) == 0);
- }
-
- /*
- * Check whether this numeric float object, represents -0.
- *
- * @return true if this numeric float object represents -0.
- * false otherwise.
- */
- public boolean negativeZero() {
- return (Float.compare(_value.floatValue(), -0.0f) == 0);
- }
-
- /**
- * Get the actual numeric float value stored, within this
- * object.
- *
- * @return the actual numeric float value stored
- */
- public float floatValue() {
- return _value.floatValue();
- }
-
- public boolean equals(XSFloat xsFloat) {
- return _value.equals(xsFloat.floatValue());
- }
-
- public boolean lt(XSFloat xsFloat) {
- return floatValue() < xsFloat.floatValue();
- }
-
- public boolean gt(XSFloat xsFloat) {
- return floatValue() > xsFloat.floatValue();
- }
-
- public int getType() {
- return CLASS_XS_FLOAT;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSInt.java b/src/org/apache/xpath/xs/types/XSInt.java
deleted file mode 100644
index 7d250dd1..00000000
--- a/src/org/apache/xpath/xs/types/XSInt.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import java.math.BigInteger;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:int datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSInt extends XSLong {
-
- private static final long serialVersionUID = -6853519104620633955L;
-
- private static final String XS_INT = "xs:int";
-
- private static BigInteger MIN_INCLUSIVE = BigInteger.valueOf(-2147483648L);
-
- private static BigInteger MAX_INCLUSIVE = BigInteger.valueOf(2147483647L);
-
- /*
- * Class constructor.
- */
- public XSInt() {
- this(BigInteger.valueOf(0));
- }
-
- /*
- * Class constructor.
- */
- public XSInt(BigInteger val) {
- super(val);
- }
-
- /*
- * Class constructor.
- */
- public XSInt(String val) {
- super(val);
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) throws RuntimeException {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- try {
- BigInteger bigInt = new BigInteger(xsAnyType.stringValue());
-
- if (bigInt.compareTo(MIN_INCLUSIVE) == -1 ||
- bigInt.compareTo(MAX_INCLUSIVE) == 1) {
- throw new RuntimeException("An instance of type xs:int cannot be created. The numeric argument "
- + "'" + xsAnyType.stringValue() + "' provided is out of range for type xs:int.");
- }
-
- resultSeq.add(new XSInt(bigInt));
- } catch (NumberFormatException ex) {
- throw new RuntimeException(ex.getMessage());
- }
-
- return resultSeq;
- }
-
- public String stringType() {
- return XS_INT;
- }
-
- public String typeName() {
- return "int";
- }
-
- public boolean equals(XSInt xsInt) {
- return _value.equals(xsInt.intValue());
- }
-
- public boolean lt(XSInt xsInt) {
- return _value.compareTo(xsInt.intValue()) < 0;
- }
-
- public boolean gt(XSInt xsInt) {
- return _value.compareTo(xsInt.intValue()) > 0;
- }
-
- public int getType() {
- return CLASS_XS_INT;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSInteger.java b/src/org/apache/xpath/xs/types/XSInteger.java
deleted file mode 100644
index a810bea5..00000000
--- a/src/org/apache/xpath/xs/types/XSInteger.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:integer datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSInteger extends XSDecimal {
-
- private static final long serialVersionUID = -4634168510820898744L;
-
- private static final String XS_INTEGER = "xs:integer";
-
- // the underlying java.math.BigInteger value, representing
- // this XML Schema datatype value.
- protected BigInteger _value;
-
- /*
- * Class constructor.
- */
- public XSInteger() {
- this(BigInteger.valueOf(0));
- }
-
- /*
- * Class constructor.
- */
- public XSInteger(BigInteger val) {
- super(new BigDecimal(val));
- _value = val;
- }
-
- /*
- * Class constructor.
- */
- public XSInteger(String val) {
- super(new BigDecimal(val));
- _value = new BigInteger(val);
- }
-
- public String stringType() {
- return XS_INTEGER;
- }
-
- public String typeName() {
- return "integer";
- }
-
- /**
- * Get a string representation of an integer value stored,
- * within this object.
- *
- * @return string representation of the integer value stored
- */
- public String stringValue() {
- return _value.toString();
- }
-
- /**
- * Check if this XSInteger object represents the value 0.
- *
- * @return true if this XSInteger object represents the value 0.
- * false otherwise.
- */
- public boolean zero() {
- return (_value.compareTo(BigInteger.ZERO) == 0);
- }
-
- public ResultSequence constructor(ResultSequence arg) {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- try {
- BigInteger bigInteger = castToInteger(xsAnyType);
- resultSeq.add(new XSInteger(bigInteger));
- } catch (NumberFormatException e) {
- // to do
- return null;
- }
-
- return resultSeq;
- }
-
- /**
- * Get the actual value of an integer number stored within
- * this object.
- *
- * @return the actual value of the number stored
- */
- public BigInteger intValue() {
- return _value;
- }
-
- /**
- * Set the numeric integer value, within this object.
- *
- * @param val number to be stored
- */
- public void setInt(BigInteger val) {
- _value = val;
- }
-
- public boolean equals(XSInteger xsInteger) {
- return _value.equals(xsInteger.intValue());
- }
-
- public boolean lt(XSInteger xsInteger) {
- return (intValue()).compareTo(xsInteger.intValue()) < 0;
- }
-
- public boolean gt(XSInteger xsInteger) {
- return (intValue()).compareTo(xsInteger.intValue()) > 0;
- }
-
- public XSInteger multiply(XSInteger xsInteger) {
- return new XSInteger((intValue()).multiply(xsInteger.intValue()));
- }
-
- public int getType() {
- return CLASS_XS_INTEGER;
- }
-
- /*
- * Cast an object of type XSAnyType, to an object of type
- * java.math.BigInteger.
- */
- private BigInteger castToInteger(XSAnyType xsAnyType) {
-
- if (xsAnyType instanceof XSBoolean) {
- if ((xsAnyType.stringValue()).equals("true")) {
- return BigInteger.ONE;
- }
- else {
- return BigInteger.ZERO;
- }
- }
-
- if ((xsAnyType instanceof XSDecimal) || (xsAnyType instanceof XSFloat) ||
- (xsAnyType instanceof XSDouble)) {
- BigDecimal bigDecimal = new BigDecimal(xsAnyType.stringValue());
-
- return bigDecimal.toBigInteger();
- }
-
- return new BigInteger(xsAnyType.stringValue());
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSLong.java b/src/org/apache/xpath/xs/types/XSLong.java
deleted file mode 100644
index c5f93538..00000000
--- a/src/org/apache/xpath/xs/types/XSLong.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import java.math.BigInteger;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:long datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSLong extends XSInteger {
-
- private static final long serialVersionUID = -1030394161532436404L;
-
- private static final String XS_LONG = "xs:long";
-
- private static BigInteger MIN_INCLUSIVE = BigInteger.valueOf(-9223372036854775808L);
-
- private static BigInteger MAX_INCLUSIVE = BigInteger.valueOf(9223372036854775807L);
-
- /*
- * Class constructor.
- */
- public XSLong() {
- this(BigInteger.valueOf(0));
- }
-
- /*
- * Class constructor.
- */
- public XSLong(BigInteger val) {
- super(val);
- }
-
- /*
- * Class constructor.
- */
- public XSLong(String val) {
- super(val);
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) throws RuntimeException {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- try {
- BigInteger bigInt = new BigInteger(xsAnyType.stringValue());
-
- if (bigInt.compareTo(MIN_INCLUSIVE) == -1 ||
- bigInt.compareTo(MAX_INCLUSIVE) == 1) {
- throw new RuntimeException("An instance of type xs:long cannot be created. The numeric argument "
- + "'" + xsAnyType.stringValue() + "' provided is out of range for type xs:long.");
- }
-
- resultSeq.add(new XSLong(bigInt));
- } catch (NumberFormatException ex) {
- throw new RuntimeException(ex.getMessage());
- }
-
- return resultSeq;
- }
-
- public String stringType() {
- return XS_LONG;
- }
-
- public String typeName() {
- return "long";
- }
-
- public boolean equals(XSLong xsLong) {
- return _value.equals(xsLong.intValue());
- }
-
- public boolean lt(XSLong xsLong) {
- return _value.compareTo(xsLong.intValue()) < 0;
- }
-
- public boolean gt(XSLong xsLong) {
- return _value.compareTo(xsLong.intValue()) > 0;
- }
-
- public int getType() {
- return CLASS_XS_LONG;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSNumericType.java b/src/org/apache/xpath/xs/types/XSNumericType.java
deleted file mode 100644
index f4d6863d..00000000
--- a/src/org/apache/xpath/xs/types/XSNumericType.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * This class serves as base type, of all the XML Schema built-in
- * numeric types.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSNumericType extends XSCtrType {
-
- private static final long serialVersionUID = 6842313858622701811L;
-
- @Override
- public ResultSequence constructor(ResultSequence arg) throws TransformerException {
- return null;
- }
-
- @Override
- public String typeName() {
- return null;
- }
-
- @Override
- public String stringType() {
- return null;
- }
-
- @Override
- public String stringValue() {
- return null;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSString.java b/src/org/apache/xpath/xs/types/XSString.java
deleted file mode 100644
index 3b82cdbb..00000000
--- a/src/org/apache/xpath/xs/types/XSString.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.XPathCollationSupport;
-import org.apache.xpath.XPathContext;
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:string datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSString extends XSCtrType {
-
- private static final long serialVersionUID = -7351932310979358488L;
-
- private static final String XS_STRING = "xs:string";
-
- private String _value;
-
- private XPathContext fXctxt = new XPathContext();
-
- private XPathCollationSupport fXpathCollationSupport = fXctxt.getXPathCollationSupport();
-
- /*
- * Class constructor.
- */
- public XSString(String str) {
- _value = str;
- }
-
- /*
- * Class constructor.
- */
- public XSString() {
- this(null);
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- resultSeq.add(new XSString(xsAnyType.stringValue()));
-
- return resultSeq;
- }
-
- @Override
- public String typeName() {
- return "string";
- }
-
- @Override
- public String stringType() {
- return XS_STRING;
- }
-
- @Override
- public String stringValue() {
- return _value;
- }
-
- /**
- * Get the actual string value stored, within this object.
- *
- * @return the actual string value stored
- */
- public String value() {
- return stringValue();
- }
-
- /**
- * This function implements the semantics of XPath 3.1 'eq' operator,
- * on xs:string values.
- */
- public boolean equals(XSString xsStr) throws TransformerException {
- int comparisonResult = fXpathCollationSupport.compareStringsUsingCollation(_value, xsStr.stringValue(),
- fXctxt.getDefaultCollation());
- return (comparisonResult == 0);
- }
-
- /**
- * This function implements the semantics of XPath 3.1 'lt' operator,
- * on xs:string values.
- */
- public boolean lt(XSString xsStr) throws TransformerException {
- int comparisonResult = fXpathCollationSupport.compareStringsUsingCollation(_value, xsStr.stringValue(),
- fXctxt.getDefaultCollation());
- return (comparisonResult < 0);
- }
-
- /**
- * This function implements the semantics of XPath 3.1 'gt' operator,
- * on xs:string values.
- */
- public boolean gt(XSString xsStr) throws TransformerException {
- int comparisonResult = fXpathCollationSupport.compareStringsUsingCollation(_value, xsStr.stringValue(),
- fXctxt.getDefaultCollation());
- return (comparisonResult > 0);
- }
-
- public int getType() {
- return CLASS_STRING;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSTime.java b/src/org/apache/xpath/xs/types/XSTime.java
deleted file mode 100644
index 06484c6c..00000000
--- a/src/org/apache/xpath/xs/types/XSTime.java
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.objects.ResultSequence;
-import org.apache.xpath.objects.XObject;
-
-/**
- * An XML Schema data type representation, of the xs:time datatype.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSTime extends XSCalendarType {
-
- private static final long serialVersionUID = -2086065287703853879L;
-
- private static final String XS_TIME = "xs:time";
-
- private Calendar _calendar;
-
- private boolean _timezoned;
-
- private XSDuration _tz;
-
- /**
- * The value of this class field, stores the fact that whether this
- * XSTime object is constructed via XPath function call fn:current-time().
- */
- private boolean isPopulatedFromFnCurrentTime = false;
-
- /**
- * Class constructor.
- *
- * Construct an XSTime object, with the provided time and timezone
- * values.
- *
- * @param cal the java.util.Calendar representation of the time to be stored
- * @param tz the timezone (this could be possibly null) associated with this
- * XSTime object.
- */
- public XSTime(Calendar cal, XSDuration tz) {
- _calendar = cal;
- _tz = tz;
-
- if (tz == null) {
- _timezoned = false;
- }
- else {
- _timezoned = true;
- }
- }
-
- /**
- * Class constructor.
- *
- * Construct an XSTime object, and initialize it to the current time.
- */
- public XSTime() {
- this (new GregorianCalendar(TimeZone.getDefault()), null);
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) throws TransformerException {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
- XSTime xsTime = castToTime(xsAnyType);
-
- resultSeq.add(xsTime);
-
- return resultSeq;
- }
-
- /**
- * Parse a string representation of a time value, and construct an new
- * XSTime object.
- */
- public static XSTime parseTime(String strVal) throws TransformerException {
-
- String refDate = "1955-07-12T";
-
- XSDateTime xsDateTime = XSDateTime.parseDateTime(refDate + strVal);
- if (xsDateTime == null) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:time value.");
- }
-
- return new XSTime(xsDateTime.getCalendar(), xsDateTime.getTimezone());
- }
-
- /**
- * Get the datatype's name.
- *
- * @return "time" which is this datatype's name
- */
- @Override
- public String typeName() {
- return "time";
- }
-
- /**
- * Get the datatype's full name.
- *
- * @return "xs:time" which is this datatype's full name
- */
- @Override
- public String stringType() {
- return XS_TIME;
- }
-
- /**
- * Get a java.util.Calendar representation of an time value stored,
- * within this XSTime object.
- *
- * @return Calendar representation of the time stored
- */
- public Calendar getCalendar() {
- return _calendar;
- }
-
- public XSDuration getTimezone() {
- return _tz;
- }
-
- /**
- * Get the hour value stored as an integer within this
- * XSTime object.
- *
- * @return the hour value stored
- */
- public int hour() {
- return _calendar.get(Calendar.HOUR_OF_DAY);
- }
-
- /**
- * Get the minute value stored as an integer within this
- * XSTime object.
- *
- * @return the minute value stored
- */
- public int minute() {
- return _calendar.get(Calendar.MINUTE);
- }
-
- /**
- * Get the second value stored as an integer within this
- * XSTime object.
- *
- * @return the seconds value stored
- */
- public double second() {
- double secondVal = _calendar.get(Calendar.SECOND);
- double millisecVal = _calendar.get(Calendar.MILLISECOND);
-
- millisecVal /= 1000;
- secondVal += millisecVal;
-
- return secondVal;
- }
-
- /**
- * Check whether this XSTime object has an, timezone associated with it.
- *
- * @return true if there is a timezone associated with this XSTime object.
- * false otherwise.
- */
- public boolean isTimetimezoned() {
- return _timezoned;
- }
-
- @Override
- public String stringValue() {
- String returnVal = "";
-
- Calendar calendarVal = getCalendar();
- returnVal += XSDateTime.padInt(calendarVal.get(Calendar.HOUR_OF_DAY), 2);
-
- returnVal += ":";
- returnVal += XSDateTime.padInt(calendarVal.get(Calendar.MINUTE), 2);
-
-
- returnVal += ":";
- int intSec = (int) second();
- double doubleSec = second();
-
- if ((doubleSec - intSec) == 0.0) {
- returnVal += XSDateTime.padInt(intSec, 2);
- }
- else {
- if (doubleSec < 10.0) {
- returnVal += "0" + doubleSec;
- }
- else {
- returnVal += doubleSec;
- }
- }
-
- if (isTimetimezoned()) {
- int hrs = _tz.hours();
- int min = _tz.minutes();
- double secs = _tz.seconds();
- if (hrs == 0 && min == 0 && secs == 0) {
- returnVal += "Z";
- }
- else {
- String timezoneStr = "";
- if (_tz.negative()) {
- timezoneStr += "-";
- }
- else {
- timezoneStr += "+";
- }
- timezoneStr += XSDateTime.padInt(hrs, 2);
- timezoneStr += ":";
- timezoneStr += XSDateTime.padInt(min, 2);
-
- returnVal += timezoneStr;
- }
- }
-
- return returnVal;
- }
-
- /**
- * Determine whether, two XSTime objects are equal.
- */
- public boolean equals(XSTime xsTime) {
- boolean isXsTimeEqual = false;
-
- int hour1 = hour();
- int mins1 = minute();
- double secs1 = second();
-
- int hour2 = xsTime.hour();
- int mins2 = xsTime.minute();
- double secs2 = xsTime.second();
- XSDuration tz1 = getTimezone();
- XSDuration tz2 = xsTime.getTimezone();
-
- isXsTimeEqual = ((hour1 == hour2) && (mins1 == mins2) && (secs1 == secs2)) &&
- isTimezoneEqual(tz1, tz2, isPopulatedFromFnCurrentTime,
- xsTime.isPopulatedFromFnCurrentTime());
-
- return isXsTimeEqual;
- }
-
- @Override
- public boolean equals(Object obj) {
- boolean isTimeEqual = false;
-
- if (obj instanceof XSTime) {
- isTimeEqual = this.equals((XSTime)obj);
- }
-
- return isTimeEqual;
- }
-
- @Override
- public int hashCode() {
- String strVal = stringValue();
-
- return strVal.hashCode();
- }
-
- /**
- * Determine whether, this XSTime object is less than, the XSTime
- * object provided as an argument to this method.
- */
- public boolean lt(XSTime xsTime) {
- boolean isTimeBefore = false;
-
- int hour1 = hour();
- int mins1 = minute();
- double secs1 = second();
-
- int hour2 = xsTime.hour();
- int mins2 = xsTime.minute();
- double secs2 = xsTime.second();
-
- if (hour1 < hour2) {
- isTimeBefore = true;
- }
- else if (hour1 == hour2) {
- if (mins1 < mins2) {
- isTimeBefore = true;
- }
- else if (mins1 == mins2) {
- if (secs1 < secs2) {
- isTimeBefore = true;
- }
- }
- }
-
- return isTimeBefore;
- }
-
- /**
- * Determine whether, this XSTime object is greater than, the
- * XSTime object provided as an argument to this method.
- */
- public boolean gt(XSTime xsTime) {
- boolean isTimeAfter = false;
-
- int hour1 = hour();
- int mins1 = minute();
- double secs1 = second();
-
- int hour2 = xsTime.hour();
- int mins2 = xsTime.minute();
- double secs2 = xsTime.second();
-
- if (hour1 > hour2) {
- isTimeAfter = true;
- }
- else if (hour1 == hour2) {
- if (mins1 > mins2) {
- isTimeAfter = true;
- }
- else if (mins1 == mins2) {
- if (secs1 > secs2) {
- isTimeAfter = true;
- }
- }
- }
-
- return isTimeAfter;
- }
-
- /**
- * Implementation of addition operation between this XSTime value, and a
- * supplied value (as per XPath 3.1 spec, xs:dayTimeDuration is the only
- * permissible data type value, that may be added to an xs:Time value).
- */
- public XObject add(XObject xObject) throws TransformerException {
- XObject result = null;
-
- if (!(xObject instanceof XSDayTimeDuration)) {
- throw new TransformerException("XPTY0004 : The value of type xs:dayTimeDuration is the only "
- + "one that may be added to an xs:Time value.");
- }
-
- XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
- double argValSecs = argVal.value();
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000))));
- result = new XSTime(cal1, getTimezone());
-
- return result;
- }
-
- /**
- * Implementation of subtraction operation between this XSTime value, and a
- * supplied value (as per XPath 3.1 spec, xs:time and xs:dayTimeDuration are
- * the only permissible data type values, that may be subtracted from an
- * xs:time value).
- */
- public XObject subtract(XObject xObject) throws TransformerException {
- XObject result = null;
-
- if (!((xObject instanceof XSTime) || (xObject instanceof XSDayTimeDuration))) {
- throw new TransformerException("XPTY0004 : The values of types xs:time and xs:dayTimeDuration "
- + "are only ones that may be subtracted "
- + "from an xs:time value.");
- }
-
- if (xObject instanceof XSTime) {
- Calendar cal1 = getCalendar();
- Calendar cal2 = ((XSTime)xObject).getCalendar();
- long diffDurationMilliSecs = cal1.getTimeInMillis() - cal2.getTimeInMillis();
- result = new XSDayTimeDuration(diffDurationMilliSecs / 1000);
- }
- else if (xObject instanceof XSDayTimeDuration) {
- XSDayTimeDuration argVal = (XSDayTimeDuration)xObject;
- double argValSecs = argVal.value();
- Calendar cal1 = (Calendar)((getCalendar()).clone());
- cal1.setTimeInMillis(cal1.getTimeInMillis() + ((((long)argValSecs * 1000)) * -1));
- result = new XSTime(cal1, getTimezone());
- }
-
- return result;
- }
-
- public int getType() {
- return CLASS_XS_TIME;
- }
-
- public boolean isPopulatedFromFnCurrentTime() {
- return isPopulatedFromFnCurrentTime;
- }
-
- public void setPopulatedFromFnCurrentTime(boolean isPopulatedFromFnCurrentTime) {
- this.isPopulatedFromFnCurrentTime = isPopulatedFromFnCurrentTime;
- }
-
- /**
- * Do a data type cast, of an XSAnyType argument passed to this method, to
- * an XSTime object.
- */
- private XSTime castToTime(XSAnyType xsAnyType) throws TransformerException {
- XSTime xsTime = null;
-
- if (xsAnyType instanceof XSTime) {
- xsTime = (XSTime)xsAnyType;
- }
- else if (xsAnyType instanceof XSDateTime) {
- XSDateTime xsDateTime = (XSDateTime)xsAnyType;
- xsTime = new XSTime(xsDateTime.getCalendar(), xsDateTime.getTimezone());
- }
- else {
- xsTime = parseTime(xsAnyType.stringValue());
- }
-
- return xsTime;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSUntyped.java b/src/org/apache/xpath/xs/types/XSUntyped.java
deleted file mode 100644
index 4b895979..00000000
--- a/src/org/apache/xpath/xs/types/XSUntyped.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import org.apache.xpath.objects.XObject;
-
-/**
- * This class represents an XML Schema data type xs:untyped.
- *
- * As per XPath 3.1 spec, xs:untyped is used as the type annotation of an
- * XML element node that has not been validated, or has been validated in
- * skip mode.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSUntyped extends XSAnyType {
-
- private static final long serialVersionUID = 6146147730252441632L;
-
- private static final String XS_UNTYPED = "xs:untyped";
-
- private String _value;
-
- public XSUntyped() {
- this(null);
- }
-
- public XSUntyped(String str) {
- _value = str;
- }
-
- public String typeName() {
- return "untyped";
- }
-
- @Override
- public String stringType() {
- return XS_UNTYPED;
- }
-
- @Override
- public String stringValue() {
- return _value;
- }
-
- public boolean equals(XObject xObject) {
- boolean isEquals = false;
-
- if (xObject instanceof XSUntyped) {
- isEquals = _value.equals(((XSUntyped)xObject).stringValue());
- }
- else if (xObject instanceof XSUntypedAtomic) {
- isEquals = _value.equals(((XSUntypedAtomic)xObject).stringValue());
- }
- else {
- isEquals = _value.equals(xObject.str());
- }
-
- return isEquals;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSUntypedAtomic.java b/src/org/apache/xpath/xs/types/XSUntypedAtomic.java
deleted file mode 100644
index d61bee2f..00000000
--- a/src/org/apache/xpath/xs/types/XSUntypedAtomic.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.xpath.xs.types;
-
-import org.apache.xpath.objects.ResultSequence;
-import org.apache.xpath.objects.XObject;
-
-/**
- * This class represents an XML Schema data type xs:untypedAtomic.
- *
- * As per XPath 3.1 spec, xs:untypedAtomic is an XML Schema data type
- * that is used to denote untyped atomic data, such as text that has not
- * been assigned a more specific type.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSUntypedAtomic extends XSCtrType {
-
- private static final long serialVersionUID = 3034074443706977457L;
-
- private static final String XS_UNTYPED_ATOMIC = "xs:untypedAtomic";
-
- private String _value;
-
- public XSUntypedAtomic() {
- this(null);
- }
-
- public XSUntypedAtomic(String str) {
- _value = str;
- }
-
- @Override
- public ResultSequence constructor(ResultSequence arg) {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyAtomicType xsAnyAtomicType = (XSAnyAtomicType)arg.item(0);
-
- resultSeq.add(new XSUntypedAtomic(xsAnyAtomicType.stringValue()));
-
- return resultSeq;
- }
-
- @Override
- public String typeName() {
- return "untypedAtomic";
- }
-
- @Override
- public String stringType() {
- return XS_UNTYPED_ATOMIC;
- }
-
- @Override
- public String stringValue() {
- return _value;
- }
-
- public boolean equals(XObject xObject) {
- boolean isEquals = false;
-
- if (xObject instanceof XSUntypedAtomic) {
- isEquals = _value.equals(((XSUntypedAtomic)xObject).stringValue());
- }
- else if (xObject instanceof XSUntyped) {
- isEquals = _value.equals(((XSUntyped)xObject).stringValue());
- }
- else {
- isEquals = _value.equals(xObject.str());
- }
-
- return isEquals;
- }
-
-}
diff --git a/src/org/apache/xpath/xs/types/XSYearMonthDuration.java b/src/org/apache/xpath/xs/types/XSYearMonthDuration.java
deleted file mode 100644
index b8936e62..00000000
--- a/src/org/apache/xpath/xs/types/XSYearMonthDuration.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * $Id$
- */
-package org.apache.xpath.xs.types;
-
-import java.math.BigDecimal;
-
-import javax.xml.transform.TransformerException;
-
-import org.apache.xpath.objects.ResultSequence;
-
-/**
- * An XML Schema data type representation, of the xs:yearMonthDuration
- * data type.
- *
- * @author Mukul Gandhi <mu...@apache.org>
- *
- * @xsl.usage advanced
- */
-public class XSYearMonthDuration extends XSDuration {
-
- private static final long serialVersionUID = 4448560721093003316L;
-
- private static final String XS_YEAR_MONTH_DURATION = "xs:yearMonthDuration";
-
- /**
- * Initializes this object, using the supplied parameters.
- *
- * @param year number of years in this duration of time
- * @param month number of months in this duration of time
- * @param negative 'true' if this duration of time represents a backwards
- * passage through time. 'false' otherwise.
- */
- public XSYearMonthDuration(int year, int month, boolean negative) {
- super(year, month, 0, 0, 0, 0, negative);
- }
-
- /**
- * Initializes this object, to the supplied number of months.
- *
- * @param months number of months in the duration of time
- */
- public XSYearMonthDuration(int months) {
- this(0, Math.abs(months), months < 0);
- }
-
- /**
- * Initializes this object, to a duration with value zero
- * (i.e, zero years, and zero months).
- */
- public XSYearMonthDuration() {
- this(0, 0, false);
- }
-
- /**
- * Creates a new XSYearMonthDuration object, by parsing the supplied
- * string representing the duration value.
- *
- * @param strVal String representation of the duration value
- * @return new XSYearMonthDuration object, representing the
- * duration of time supplied.
- */
- public static XSDuration parseYearMonthDuration(String strVal) throws TransformerException {
-
- boolean isDurationNegative = false;
-
- int year = 0;
- int month = 0;
-
- int moveAheadIndication = 0;
-
- String digits = "";
-
- try {
- for (int idx = 0; idx < strVal.length(); idx++) {
- char charVal = strVal.charAt(idx);
-
- switch (moveAheadIndication) {
- case 0:
- if (charVal == '-') {
- isDurationNegative = true;
- moveAheadIndication = 4;
- } else if (charVal == 'P') {
- moveAheadIndication = 5;
- }
- else {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- }
- break;
- case 4:
- if (charVal == 'P') {
- moveAheadIndication = 5;
- }
- else {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- }
- break;
- case 5:
- if ('0' <= charVal && charVal <= '9') {
- digits += charVal;
- }
- else if (charVal == 'Y') {
- if (digits.length() == 0) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- }
- year = Integer.parseInt(digits);
- digits = "";
- moveAheadIndication = 6;
- } else if (charVal == 'M') {
- if (digits.length() == 0) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- }
- month = Integer.parseInt(digits);
- moveAheadIndication = 7;
- } else {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- }
- break;
- case 6:
- if ('0' <= charVal && charVal <= '9') {
- digits += charVal;
- }
- else if (charVal == 'M') {
- if (digits.length() == 0) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- }
- month = Integer.parseInt(digits);
- moveAheadIndication = 7;
- } else {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- }
- break;
- case 7:
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- default:
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- }
- }
- }
- catch (TransformerException ex) {
- throw ex;
- }
- catch (Exception ex) {
- throw new TransformerException("XTTE0570 : The supplied string value '" + strVal + "' "
- + "cannot be parsed to a xs:yearMonthDuration value.");
- }
-
- return new XSYearMonthDuration(year, month, isDurationNegative);
- }
-
- /**
- * A method to construct an xdm sequence comprising a
- * xs:yearMonthDuration value, given input data as argument
- * to this method.
- *
- * @throws TransformerException
- */
- public ResultSequence constructor(ResultSequence arg) throws TransformerException {
- ResultSequence resultSeq = new ResultSequence();
-
- if (arg.size() == 0) {
- return resultSeq;
- }
-
- XSAnyType xsAnyType = (XSAnyType)arg.item(0);
-
- XSDuration xsDuration = castToYearMonthDuration(xsAnyType);
-
- resultSeq.add(xsDuration);
-
- return resultSeq;
- }
-
- /**
- * Get the data type's name.
- *
- * @return the string value 'yearMonthDuration', which is this
- * data type's name.
- */
- public String typeName() {
- return "yearMonthDuration";
- }
-
- /**
- * Check whether, this duration value represents a backward passage
- * through time.
- *
- * @return 'true' if this duration value represents a backward passage
- * through time. 'false' otherwise.
- */
- public boolean negative() {
- return _negative;
- }
-
- /**
- * Get a string representation, of the duration value represented
- * by this object.
- *
- * @return String representation, of the duration value represented
- * by this object.
- */
- public String stringValue() {
- String strVal = "";
-
- if (negative()) {
- strVal += "-";
- }
-
- strVal += "P";
-
- int years = year();
- if (years != 0) {
- strVal += years + "Y";
- }
-
- int months = month();
- if (months == 0) {
- if (years == 0) {
- strVal += months + "M";
- }
- } else {
- strVal += months + "M";
- }
-
- return strVal;
- }
-
- /**
- * Get the data type's name.
- *
- * @return the string value 'xs:yearMonthDuration'
- */
- public String stringType() {
- return XS_YEAR_MONTH_DURATION;
- }
-
- /**
- * Get the duration of time as the number of months, equivalent
- * to this duration object.
- *
- * @return number of months, equivalent to the duration of time
- * represented by this object.
- */
- public int monthValue() {
- int retVal = (year() * 12) + month();
-
- if (negative()) {
- retVal *= -1;
- }
-
- return retVal;
- }
-
- /**
- * This method does an equality comparison between, this and
- * another XSYearMonthDuration value.
- */
- public boolean equals(XSYearMonthDuration xsYearMonthDuration) {
- double val1 = monthValue();
- double val2 = xsYearMonthDuration.monthValue();
-
- return val1 == val2;
- }
-
- /**
- * This method checks whether, this XSYearMonthDuration value is
- * less than another one.
- */
- public boolean lt(XSYearMonthDuration xsYearMonthDuration) {
- double val1 = monthValue();
- double val2 = xsYearMonthDuration.monthValue();
-
- return val1 < val2;
- }
-
- /**
- * This method checks whether, this XSYearMonthDuration value is
- * greater than another one.
- */
- public boolean gt(XSYearMonthDuration xsYearMonthDuration) {
- double val1 = monthValue();
- double val2 = xsYearMonthDuration.monthValue();
-
- return val1 > val2;
- }
-
- /**
- * Add two XSYearMonthDuration values, and return the result
- * as an XSYearMonthDuration value.
- */
- public XSYearMonthDuration add(XSYearMonthDuration arg) {
- XSYearMonthDuration result = new XSYearMonthDuration(monthValue() +
- arg.monthValue());
- return result;
- }
-
- /**
- * Subtract an XSYearMonthDuration value from another XSYearMonthDuration value,
- * and return the result as an XSYearMonthDuration value.
- */
- public XSYearMonthDuration subtract(XSYearMonthDuration arg) {
- XSYearMonthDuration result = new XSYearMonthDuration(monthValue() -
- arg.monthValue());
- return result;
- }
-
- /**
- * Method to multiply an XSYearMonthDuration value represented by this
- * object, with a numeric value represented by an argument passed to
- * this method.
- *
- * @throws TransformerException
- */
- public XSYearMonthDuration mult(XSAnyType xsAnyType) throws TransformerException {
-
- XSYearMonthDuration result = null;
-
- if (xsAnyType instanceof XSNumericType) {
- String argStrVal = ((XSNumericType)xsAnyType).stringValue();
- XSDouble argDoubleVal = new XSDouble(argStrVal);
- if (argDoubleVal.nan()) {
- throw new TransformerException("FOCA0005 : Cannot multiply an XSYearMonthDuration value with NaN.");
- }
- else {
- int res = (int) Math.round(monthValue() * argDoubleVal.doubleValue());
-
- result = new XSYearMonthDuration(res);
- }
- }
- else {
- throw new TransformerException("FOCA0005 : Cannot multiply an XSYearMonthDuration value with a "
- + "non-numeric value");
- }
-
- return result;
- }
-
- /**
- * Method to divide this XSYearMonthDuration value, by a value (that needs to be
- * either a numeric value or a XSYearMonthDuration value) that is passed as an
- * argument to this method.
- *
- * @throws TransformerException
- */
- public XSAnyType div(XSAnyType xsAnyType) throws TransformerException {
-
- XSAnyType result = null;
-
- if (xsAnyType instanceof XSNumericType) {
- String argStrVal = ((XSNumericType)xsAnyType).stringValue();
- XSDouble argDoubleVal = new XSDouble(argStrVal);
- if (argDoubleVal.nan()) {
- throw new TransformerException("FOCA0005 : Cannot divide an XSYearMonthDuration value with NaN.");
- }
- else if (argDoubleVal.zero()) {
- throw new TransformerException("FODT0001 : Cannot divide an XSYearMonthDuration value with zero.");
- }
- else {
- int intResultVal = (int) Math.round(monthValue() / argDoubleVal.doubleValue());
- result = new XSYearMonthDuration(intResultVal);
- }
- }
- else if (xsAnyType instanceof XSYearMonthDuration) {
- XSYearMonthDuration argXSYearMonthDuration = (XSYearMonthDuration) xsAnyType;
- double dblResultVal = (double) monthValue() / argXSYearMonthDuration.monthValue();
-
- result = new XSDecimal(new BigDecimal(dblResultVal));
- }
- else {
- throw new TransformerException("FORG0006 : Cannot divide an XSYearMonthDuration value, with a value that is of "
- + "a type other than numeric or XSYearMonthDuration.");
- }
-
- return result;
- }
-
- public int getType() {
- return CLASS_XS_YEARMONTH_DURATION;
- }
-
- /**
- * Do a data type cast, of a XSAnyType value to an XSDuration
- * value.
- *
- * @throws TransformerException
- */
- private XSDuration castToYearMonthDuration(XSAnyType xsAnyType) throws TransformerException {
- if (xsAnyType instanceof XSDuration) {
- XSDuration xsDuration = (XSDuration) xsAnyType;
-
- return new XSYearMonthDuration(xsDuration.year(), xsDuration.month(),
- xsDuration.negative());
- }
-
- return parseYearMonthDuration(xsAnyType.stringValue());
- }
-
-}
diff --git a/tests/fn_sort/gold/test10.out b/tests/fn_sort/gold/test10.out
index ef9b52fb..7208e97e 100644
--- a/tests/fn_sort/gold/test10.out
+++ b/tests/fn_sort/gold/test10.out
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><result>
- <one>peach p�ch� p�che sin</one>
- <two>peach p�ch� p�che sin</two>
- <three>peach p�che p�ch� sin</three>
+ <one>peach péché pêche sin</one>
+ <two>peach péché pêche sin</two>
+ <three>peach pêche péché sin</three>
</result>
diff --git a/tests/grouping/gold/test14.out b/tests/grouping/gold/test14.out
index 75c25cb3..598bcdf2 100644
--- a/tests/grouping/gold/test14.out
+++ b/tests/grouping/gold/test14.out
@@ -5,5 +5,5 @@
<city name="Paris"/>
<city name="Lyon"/>
</country><country name="Deutschland">
- <city name="M�nchen"/>
+ <city name="München"/>
</country>
diff --git a/tests/grouping/sort/gold/test1.out b/tests/grouping/sort/gold/test1.out
index 890b6a9f..7cdc9adc 100644
--- a/tests/grouping/sort/gold/test1.out
+++ b/tests/grouping/sort/gold/test1.out
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><countries>
<country name="Deutschland">
- <city name="M�nchen"/>
+ <city name="München"/>
</country>
<country name="France">
<city name="Paris"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xalan.apache.org
For additional commands, e-mail: commits-help@xalan.apache.org