[DEV] port work but not rally compatible with java phylosophie ==> need update..
This commit is contained in:
parent
fa55638083
commit
b1ea27a01a
7
.checkstyle
Normal file
7
.checkstyle
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<fileset-config file-format-version="1.2.0" simple-config="true" sync-formatter="false">
|
||||
<fileset name="all" enabled="true" check-config-name="ewol" local="false">
|
||||
<file-match-pattern match-pattern="." include-pattern="true"/>
|
||||
</fileset>
|
||||
</fileset-config>
|
35
.classpath
Normal file
35
.classpath
Normal file
@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry including="**/*.java" kind="src" output="out/eclipse/classes-test" path="test/src">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/scenarium-logger">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/atriasoft-etk">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="out/eclipse/classes"/>
|
||||
</classpath>
|
17
.gitignore
vendored
Normal file
17
.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
/bin/
|
||||
/Operator/
|
||||
/DrawerProperties/
|
||||
*.pdfd
|
||||
*.dbc
|
||||
SchedulerConfig.txt
|
||||
scenicView.properties
|
||||
ScenariumConfig.txt
|
||||
*.class
|
||||
*~
|
||||
*.bck
|
||||
build.number
|
||||
/extern/
|
||||
/out/
|
||||
/.settings/
|
||||
/junit/
|
||||
/target/
|
24
.project
Normal file
24
.project
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>atriasoft-exml</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>atriasoft-exml</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>net.sf.eclipsecs.core.CheckstyleNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
66
CheckStyle.xml
Executable file
66
CheckStyle.xml
Executable file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Check Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
|
||||
<!--
|
||||
This configuration file was written by the eclipse-cs plugin configuration editor
|
||||
-->
|
||||
<!--
|
||||
Checkstyle-Configuration: Marc Checks
|
||||
Description:
|
||||
Checkstyle configuration that checks the sun coding conventions.
|
||||
-->
|
||||
<module name="Checker">
|
||||
<property name="severity" value="error"/>
|
||||
<property name="fileExtensions" value="java, properties, xml"/>
|
||||
<module name="TreeWalker">
|
||||
<module name="ConstantName"/>
|
||||
<module name="LocalFinalVariableName"/>
|
||||
<module name="LocalVariableName"/>
|
||||
<module name="MemberName"/>
|
||||
<module name="MethodName"/>
|
||||
<module name="PackageName"/>
|
||||
<module name="ParameterName"/>
|
||||
<module name="StaticVariableName"/>
|
||||
<module name="TypeName"/>
|
||||
<module name="AvoidStarImport"/>
|
||||
<module name="IllegalImport"/>
|
||||
<module name="RedundantImport"/>
|
||||
<module name="UnusedImports">
|
||||
<property name="processJavadoc" value="false"/>
|
||||
</module>
|
||||
<module name="ModifierOrder"/>
|
||||
<module name="EmptyStatement"/>
|
||||
<module name="EqualsHashCode"/>
|
||||
<module name="IllegalInstantiation"/>
|
||||
<module name="MissingSwitchDefault"/>
|
||||
<module name="SimplifyBooleanExpression"/>
|
||||
<module name="SimplifyBooleanReturn"/>
|
||||
<module name="HideUtilityClassConstructor"/>
|
||||
<module name="InterfaceIsType"/>
|
||||
<module name="ArrayTypeStyle"/>
|
||||
<module name="TodoComment"/>
|
||||
<module name="UpperEll"/>
|
||||
<module name="AnnotationUseStyle"/>
|
||||
<module name="MissingDeprecated"/>
|
||||
<module name="MissingOverride"/>
|
||||
<module name="PackageAnnotation"/>
|
||||
<module name="SuppressWarnings"/>
|
||||
<module name="AnnotationLocation"/>
|
||||
<module name="ClassTypeParameterName"/>
|
||||
<module name="MethodTypeParameterName"/>
|
||||
<module name="InterfaceTypeParameterName"/>
|
||||
<module name="CatchParameterName"/>
|
||||
<module name="LambdaParameterName"/>
|
||||
<module name="Regexp"/>
|
||||
<module name="RegexpSinglelineJava"/>
|
||||
</module>
|
||||
<module name="BeforeExecutionExclusionFileFilter">
|
||||
<property name="fileNamePattern" value="module\-info\.java$"/>
|
||||
</module>
|
||||
<module name="Translation"/>
|
||||
<module name="Header"/>
|
||||
<module name="RegexpHeader"/>
|
||||
<module name="RegexpMultiline"/>
|
||||
<module name="RegexpOnFilename"/>
|
||||
<module name="RegexpSingleline"/>
|
||||
</module>
|
106
CleanUp.xml
Normal file
106
CleanUp.xml
Normal file
@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="2">
|
||||
<profile kind="CleanUpProfile" name="EWOL" version="2">
|
||||
<setting id="cleanup.use_autoboxing" value="false"/>
|
||||
<setting id="cleanup.always_use_this_for_non_static_method_access" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces_ignore_empty" value="false"/>
|
||||
<setting id="cleanup.format_source_code_changes_only" value="false"/>
|
||||
<setting id="cleanup.remove_redundant_semicolons" value="false"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.useless_continue" value="false"/>
|
||||
<setting id="cleanup.remove_redundant_type_arguments" value="true"/>
|
||||
<setting id="cleanup.remove_unused_imports" value="true"/>
|
||||
<setting id="cleanup.break_loop" value="false"/>
|
||||
<setting id="cleanup.pull_up_assignment" value="false"/>
|
||||
<setting id="cleanup.stringbuilder" value="false"/>
|
||||
<setting id="cleanup.no_super" value="false"/>
|
||||
<setting id="cleanup.arrays_fill" value="false"/>
|
||||
<setting id="cleanup.use_lambda" value="true"/>
|
||||
<setting id="cleanup.simplify_lambda_expression_and_method_ref" value="false"/>
|
||||
<setting id="cleanup.always_use_blocks" value="true"/>
|
||||
<setting id="cleanup.sort_members_all" value="false"/>
|
||||
<setting id="cleanup.instanceof" value="false"/>
|
||||
<setting id="cleanup.add_missing_annotations" value="true"/>
|
||||
<setting id="cleanup.precompile_regex" value="false"/>
|
||||
<setting id="cleanup.always_use_this_for_non_static_field_access" value="true"/>
|
||||
<setting id="cleanup.boolean_literal" value="false"/>
|
||||
<setting id="cleanup.always_use_parentheses_in_expressions" value="false"/>
|
||||
<setting id="cleanup.sort_members" value="false"/>
|
||||
<setting id="cleanup.remove_unused_local_variables" value="false"/>
|
||||
<setting id="cleanup.add_missing_deprecated_annotations" value="true"/>
|
||||
<setting id="cleanup.no_string_creation" value="false"/>
|
||||
<setting id="cleanup.use_unboxing" value="false"/>
|
||||
<setting id="cleanup.use_blocks_only_for_return_and_throw" value="false"/>
|
||||
<setting id="cleanup.if_condition" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces" value="true"/>
|
||||
<setting id="cleanup.map_cloning" value="false"/>
|
||||
<setting id="cleanup.add_serial_version_id" value="true"/>
|
||||
<setting id="cleanup.try_with_resource" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_method_access" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_method_access_only_if_necessary" value="true"/>
|
||||
<setting id="cleanup.make_local_variable_final" value="false"/>
|
||||
<setting id="cleanup.add_missing_methods" value="false"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.add_missing_override_annotations" value="true"/>
|
||||
<setting id="cleanup.use_blocks" value="true"/>
|
||||
<setting id="cleanup.collection_cloning" value="false"/>
|
||||
<setting id="cleanup.convert_to_enhanced_for_loop_if_loop_var_used" value="false"/>
|
||||
<setting id="cleanup.make_variable_declarations_final" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_types" value="true"/>
|
||||
<setting id="cleanup.qualify_static_method_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.organize_imports" value="true"/>
|
||||
<setting id="cleanup.lazy_logical_operator" value="false"/>
|
||||
<setting id="cleanup.bitwise_conditional_expression" value="false"/>
|
||||
<setting id="cleanup.add_all" value="false"/>
|
||||
<setting id="cleanup.use_directly_map_method" value="false"/>
|
||||
<setting id="cleanup.qualify_static_field_accesses_with_declaring_class" value="false"/>
|
||||
<setting id="cleanup.add_generated_serial_version_id" value="false"/>
|
||||
<setting id="cleanup.primitive_serialization" value="false"/>
|
||||
<setting id="cleanup.comparison_statement" value="false"/>
|
||||
<setting id="cleanup.insert_inferred_type_arguments" value="false"/>
|
||||
<setting id="cleanup.make_private_fields_final" value="true"/>
|
||||
<setting id="cleanup.useless_return" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access_only_if_necessary" value="false"/>
|
||||
<setting id="cleanup.remove_trailing_whitespaces_all" value="true"/>
|
||||
<setting id="cleanup.remove_unnecessary_array_creation" value="false"/>
|
||||
<setting id="cleanup.remove_private_constructors" value="true"/>
|
||||
<setting id="cleanup.make_parameters_final" value="false"/>
|
||||
<setting id="cleanup.ternary_operator" value="false"/>
|
||||
<setting id="cleanup.merge_conditional_blocks" value="false"/>
|
||||
<setting id="cleanup.convert_to_enhanced_for_loop" value="false"/>
|
||||
<setting id="cleanup.remove_unused_private_fields" value="true"/>
|
||||
<setting id="cleanup.never_use_blocks" value="false"/>
|
||||
<setting id="cleanup.remove_redundant_modifiers" value="false"/>
|
||||
<setting id="cleanup.redundant_falling_through_block_end" value="false"/>
|
||||
<setting id="cleanup.switch" value="false"/>
|
||||
<setting id="cleanup.number_suffix" value="false"/>
|
||||
<setting id="cleanup.remove_unnecessary_nls_tags" value="true"/>
|
||||
<setting id="cleanup.convert_to_switch_expressions" value="false"/>
|
||||
<setting id="cleanup.use_this_for_non_static_field_access" value="true"/>
|
||||
<setting id="cleanup.add_missing_nls_tags" value="false"/>
|
||||
<setting id="cleanup.qualify_static_member_accesses_through_instances_with_declaring_class" value="true"/>
|
||||
<setting id="cleanup.remove_unnecessary_casts" value="true"/>
|
||||
<setting id="cleanup.objects_equals" value="false"/>
|
||||
<setting id="cleanup.convert_functional_interfaces" value="true"/>
|
||||
<setting id="cleanup.format_source_code" value="true"/>
|
||||
<setting id="cleanup.else_if" value="true"/>
|
||||
<setting id="cleanup.add_default_serial_version_id" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_methods" value="true"/>
|
||||
<setting id="cleanup.make_type_abstract_if_missing_method" value="false"/>
|
||||
<setting id="cleanup.join" value="false"/>
|
||||
<setting id="cleanup.embedded_if" value="false"/>
|
||||
<setting id="cleanup.use_anonymous_class_creation" value="false"/>
|
||||
<setting id="cleanup.add_missing_override_annotations_interface_methods" value="true"/>
|
||||
<setting id="cleanup.remove_unused_private_members" value="false"/>
|
||||
<setting id="cleanup.strictly_equal_or_different" value="false"/>
|
||||
<setting id="cleanup.never_use_parentheses_in_expressions" value="true"/>
|
||||
<setting id="cleanup.push_down_negation" value="false"/>
|
||||
<setting id="cleanup.evaluate_nullable" value="false"/>
|
||||
<setting id="cleanup.use_parentheses_in_expressions" value="true"/>
|
||||
<setting id="cleanup.hash" value="false"/>
|
||||
<setting id="cleanup.double_negation" value="false"/>
|
||||
<setting id="cleanup.overridden_assignment" value="false"/>
|
||||
<setting id="cleanup.correct_indentation" value="true"/>
|
||||
<setting id="cleanup.use_var" value="false"/>
|
||||
</profile>
|
||||
</profiles>
|
390
Formatter.xml
Normal file
390
Formatter.xml
Normal file
@ -0,0 +1,390 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<profiles version="20">
|
||||
<profile kind="CodeFormatterProfile" name="EWOL" version="20">
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="48"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_enum_constant" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_annotations" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="49"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="200"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="33"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="33"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_if_empty"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="200"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
|
||||
</profile>
|
||||
</profiles>
|
373
LICENSE
Normal file
373
LICENSE
Normal file
@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
10
src/module-info.java
Normal file
10
src/module-info.java
Normal file
@ -0,0 +1,10 @@
|
||||
/** Basic module interface.
|
||||
*
|
||||
* @author Edouard DUPIN */
|
||||
|
||||
open module org.atriasoft.exml {
|
||||
exports org.atriasoft.exml;
|
||||
|
||||
requires transitive org.atriasoft.etk;
|
||||
requires transitive io.scenarium.logger;
|
||||
}
|
166
src/org/atriasoft/exml/Attribute.java
Normal file
166
src/org/atriasoft/exml/Attribute.java
Normal file
@ -0,0 +1,166 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
/**
|
||||
* @brief Single attribute element
|
||||
*/
|
||||
public class Attribute extends Node {
|
||||
|
||||
protected String m_name; //!< Name of the attribute
|
||||
|
||||
public Attribute() {
|
||||
super("");
|
||||
this.m_name = "";
|
||||
}
|
||||
|
||||
public Attribute(final Attribute _obj) {
|
||||
super(_obj.m_value);
|
||||
this.m_pos = _obj.getPos().clone();
|
||||
this.m_name = _obj.m_name;
|
||||
}
|
||||
|
||||
public Attribute(final String _name) {
|
||||
super("");
|
||||
this.m_name = _name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] _name Name of the attribute.
|
||||
* @param[in] _value Value of the attribute.
|
||||
*/
|
||||
public Attribute(final String _name, final String _value) {
|
||||
super(_value);
|
||||
this.m_name = _name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.m_name = "";
|
||||
};
|
||||
|
||||
@Override
|
||||
public Attribute clone() {
|
||||
return new Attribute(this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief get the current name of the Attribute
|
||||
* @return String of the attribute
|
||||
*/
|
||||
public String getName() {
|
||||
return this.m_name;
|
||||
};
|
||||
|
||||
@Override
|
||||
public NodeType getType() {
|
||||
return NodeType.attribute;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||
_data.append(" ");
|
||||
_data.append(this.m_name);
|
||||
_data.append("=\"");
|
||||
_data.append(this.m_value);
|
||||
_data.append("\"");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||
Log.verbose("start parse : 'attribute'");
|
||||
this.m_pos.set(_filePos);
|
||||
// search end of the comment :
|
||||
int lastElementName = _pos.value;
|
||||
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
||||
_filePos.check(_data.charAt(iii));
|
||||
drawElementParsed(_data.charAt(iii), _filePos);
|
||||
if (checkAvaillable(_data.charAt(iii), false) == true) {
|
||||
lastElementName = iii;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.m_name = _data.substring(_pos.value, lastElementName + 1);
|
||||
if (_caseSensitive == true) {
|
||||
this.m_name = this.m_name.toLowerCase();
|
||||
}
|
||||
// count white space :
|
||||
final FilePos tmpPos = new FilePos();
|
||||
int white = countWhiteChar(_data, lastElementName + 1, tmpPos);
|
||||
_filePos.add(tmpPos);
|
||||
if (lastElementName + white + 1 >= _data.length()) {
|
||||
_doc.createError(_data, lastElementName + white + 1, _filePos, " parse an xml end with an attribute parsing...");
|
||||
return false;
|
||||
}
|
||||
if (_data.charAt(lastElementName + white + 1) != '=') {
|
||||
_doc.createError(_data, lastElementName + white + 1, _filePos, " error attribute parsing == > missing '=' ...");
|
||||
return false;
|
||||
}
|
||||
white += countWhiteChar(_data, lastElementName + white + 2, tmpPos);
|
||||
_filePos.add(tmpPos);
|
||||
|
||||
if (lastElementName + white + 2 >= _data.length()) {
|
||||
_doc.createError(_data, lastElementName + white + 2, _filePos, " parse an xml end with an attribute parsing...");
|
||||
return false;
|
||||
}
|
||||
boolean simpleQuoteCase = false;
|
||||
if (_data.charAt(lastElementName + white + 2) == '\'') { // '
|
||||
simpleQuoteCase = true;
|
||||
}
|
||||
if (_data.charAt(lastElementName + white + 2) != '"' && _data.charAt(lastElementName + white + 2) != '\'') { // '
|
||||
// parse with no element " == > direct value separate with space ...
|
||||
_filePos.increment();
|
||||
int lastAttributePos = lastElementName + white + 2;
|
||||
for (int iii = lastElementName + white + 2; iii < _data.length(); iii++) {
|
||||
drawElementParsed(_data.charAt(iii), _filePos);
|
||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||
_doc.createError(_data, iii, _filePos, "unexpected '\\n' in an attribute parsing");
|
||||
return false;
|
||||
}
|
||||
if (_data.charAt(iii) != ' ' && _data.charAt(iii) != '/' && _data.charAt(iii) != '?' && _data.charAt(iii) != '>') {
|
||||
lastAttributePos = iii + 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.m_value = _data.substring(lastElementName + white + 2, lastAttributePos);
|
||||
|
||||
//EXML_PARSE_ATTRIBUTE(m_pos << " attribute : " << m_name << "=\"" << m_value << "\"");
|
||||
|
||||
_pos.value = lastAttributePos - 1;
|
||||
return true;
|
||||
}
|
||||
int lastAttributePos = lastElementName + white + 3;
|
||||
for (int iii = lastElementName + white + 3; iii < _data.length(); iii++) {
|
||||
drawElementParsed(_data.charAt(iii), _filePos);
|
||||
_filePos.check(_data.charAt(iii));
|
||||
if ((_data.charAt(iii) != '"' && simpleQuoteCase == false) || (_data.charAt(iii) != '\'' && simpleQuoteCase == true)) { // '
|
||||
lastAttributePos = iii + 1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.m_value = _data.substring(lastElementName + white + 3, lastAttributePos);
|
||||
|
||||
//EXML_PARSE_ATTRIBUTE(m_pos << " attribute : " << m_name << "=\"" << m_value << "\"");
|
||||
|
||||
_pos.value = lastAttributePos;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set the name of the attribute
|
||||
* @param[in] _name New name of the attribute
|
||||
*/
|
||||
public void setName(final String _name) {
|
||||
this.m_name = _name;
|
||||
}
|
||||
};
|
184
src/org/atriasoft/exml/AttributeList.java
Normal file
184
src/org/atriasoft/exml/AttributeList.java
Normal file
@ -0,0 +1,184 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package org.atriasoft.exml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.atriasoft.etk.util.Pair;
|
||||
import org.atriasoft.exml.exception.ExmlAttributeDoesNotExist;
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
/**
|
||||
* @brief List of all attribute element in a node
|
||||
*/
|
||||
public abstract class AttributeList extends Node {
|
||||
protected List<Attribute> m_listAttribute = new ArrayList<>(); //!< list of all attribute;
|
||||
|
||||
public AttributeList() {
|
||||
super();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] _value Node value;
|
||||
*/
|
||||
public AttributeList(final String _value) {
|
||||
super(_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief add attribute on the List
|
||||
* @param[in] _attr Pointer on the attribute
|
||||
*/
|
||||
public void appendAttribute(final Attribute _attr) {
|
||||
if (_attr == null) {
|
||||
Log.error("Try to set an empty node");
|
||||
return;
|
||||
}
|
||||
for (int iii = 0; iii < this.m_listAttribute.size(); iii++) {
|
||||
if (this.m_listAttribute.get(iii) == _attr) {
|
||||
Log.error("Try to add a node that is already added before !!!");
|
||||
return;
|
||||
}
|
||||
if (this.m_listAttribute.get(iii).getName().contentEquals(_attr.getName()) == true) {
|
||||
Log.error("Try to add a node that is already added before (same name)");
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.m_listAttribute.add(_attr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
this.m_listAttribute.clear();
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief check if an attribute exist or not with his name.
|
||||
* @param[in] _name Attribute Name.
|
||||
* @return true if the attribute exist or False
|
||||
*/
|
||||
public boolean existAttribute(final String _name) {
|
||||
if (_name.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int iii = 0; iii < this.m_listAttribute.size(); ++iii) {
|
||||
if (this.m_listAttribute.get(iii) != null && this.m_listAttribute.get(iii).getName().contentEquals(_name) == true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get attribute whith his ID
|
||||
* @param[in] _id Identifier of the attribute 0<= _id < sizeAttribute()
|
||||
* @return Pointer on the attribute or NULL
|
||||
* @throws ExmlAttributeDoesNotExist The attribute does not exist.
|
||||
*/
|
||||
public Attribute getAttr(final int _id) throws ExmlAttributeDoesNotExist {
|
||||
if (_id < 0 || _id >= this.m_listAttribute.size()) {
|
||||
throw new ExmlAttributeDoesNotExist("Attribute does not exist: " + _id + "/" + this.m_listAttribute.size());
|
||||
}
|
||||
return this.m_listAttribute.get(_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the attribute value with searching in the List with his name
|
||||
* @param[in] _name Attribute Name.
|
||||
* @return Value of the attribute or no data in the string
|
||||
* @throws ExmlAttributeDoesNotExist The attribute does not exist.
|
||||
*/
|
||||
public String getAttribute(final String _name) throws ExmlAttributeDoesNotExist {
|
||||
if (_name.length() == 0) {
|
||||
throw new ExmlAttributeDoesNotExist("Attribute can not have empty name");
|
||||
}
|
||||
for (int iii = 0; iii < this.m_listAttribute.size(); iii++) {
|
||||
if (this.m_listAttribute.get(iii) != null && this.m_listAttribute.get(iii).getName().contentEquals(_name) == true) {
|
||||
return this.m_listAttribute.get(iii).getValue();
|
||||
}
|
||||
}
|
||||
throw new ExmlAttributeDoesNotExist("Attribute does not exist: " + _name + " in " + this.m_listAttribute.size() + " attributes");
|
||||
}
|
||||
|
||||
public List<Attribute> getAttributes() {
|
||||
return this.m_listAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get attribute whith his ID
|
||||
* @param[in] _id Identifier of the attribute 0<= _id < sizeAttribute()
|
||||
* @return Name and value of the attribute
|
||||
* @throws ExmlAttributeDoesNotExist The attribute does not exist.
|
||||
*/
|
||||
public Pair<String, String> getAttrPair(final int _id) throws ExmlAttributeDoesNotExist {
|
||||
final Attribute att = getAttr(_id);
|
||||
return new Pair<String, String>(att.getName(), att.getValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||
for (int iii = 0; iii < this.m_listAttribute.size(); iii++) {
|
||||
if (this.m_listAttribute.get(iii) != null) {
|
||||
this.m_listAttribute.get(iii).iGenerate(_data, _indent);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove an attribute form the list
|
||||
* @param[in] _name Name of the attribute
|
||||
* @return true The attribute has been removed
|
||||
* @return false An error occured.
|
||||
*/
|
||||
public boolean removeAttribute(final String _name) {
|
||||
if (_name.length() == 0) {
|
||||
return false;
|
||||
}
|
||||
for (final ListIterator<Attribute> iter = this.m_listAttribute.listIterator(); iter.hasNext();) {
|
||||
final Attribute element = iter.next();
|
||||
if (element == null) {
|
||||
iter.remove();
|
||||
continue;
|
||||
}
|
||||
if (element.getName().contentEquals(_name) == true) {
|
||||
iter.remove();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set A new attribute or replace data of the previous one
|
||||
* @param[in] _name Name of the attribute
|
||||
* @param[in] _value Value of the attribute
|
||||
*/
|
||||
public void setAttribute(final String _name, final String _value) {
|
||||
// check if attribute already det :
|
||||
for (int iii = 0; iii < this.m_listAttribute.size(); ++iii) {
|
||||
if (this.m_listAttribute.get(iii) != null && this.m_listAttribute.get(iii).getName().contentEquals(_name) == true) {
|
||||
// update the value :
|
||||
this.m_listAttribute.get(iii).setValue(_value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
final Attribute attr = new Attribute(_name, _value);
|
||||
this.m_listAttribute.add(attr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the number of attribute in the Node
|
||||
* @return Nulber of attribute >=0
|
||||
*/
|
||||
public int sizeAttribute() {
|
||||
return this.m_listAttribute.size();
|
||||
}
|
||||
}
|
85
src/org/atriasoft/exml/Comment.java
Normal file
85
src/org/atriasoft/exml/Comment.java
Normal file
@ -0,0 +1,85 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
/**
|
||||
* @brief Comment node: lt;!-- ... --gt;
|
||||
*/
|
||||
public class Comment extends Node {
|
||||
|
||||
public Comment() {
|
||||
super();
|
||||
}
|
||||
|
||||
public Comment(final Comment obj) {
|
||||
super(obj.m_value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] _value comment value
|
||||
*/
|
||||
public Comment(final String _value) {
|
||||
super(_value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comment clone() {
|
||||
return new Comment(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeType getType() {
|
||||
return NodeType.comment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||
addIndent(_data, _indent);
|
||||
_data.append("<!--");
|
||||
_data.append(this.m_value);
|
||||
_data.append("-->\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||
Log.verbose("start parse : 'comment'");
|
||||
this.m_pos = _filePos;
|
||||
final FilePos tmpPos = new FilePos();
|
||||
final int white = countWhiteChar(_data, _pos.value, tmpPos);
|
||||
_filePos.add(tmpPos);
|
||||
// search end of the comment :
|
||||
for (int iii = _pos.value + white; iii + 2 < _data.length(); iii++) {
|
||||
drawElementParsed(_data.charAt(iii), _filePos);
|
||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||
continue;
|
||||
}
|
||||
if (_data.charAt(iii) == '-' && _data.charAt(iii + 1) == '-' && _data.charAt(iii + 2) == '>') {
|
||||
_filePos.add(2);
|
||||
// search whitespace :
|
||||
int newEnd = iii;
|
||||
for (int jjj = iii - 1; jjj > _pos.value; jjj--) {
|
||||
if (isWhiteChar(_data.charAt(jjj)) == true) {
|
||||
newEnd = jjj;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// find end of value:
|
||||
this.m_value = _data.substring(_pos.value + white, newEnd);
|
||||
Log.verbose(" find comment '" + this.m_value + "'");
|
||||
_pos.value = iii + 2;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_pos.value = _data.length();
|
||||
_doc.createError(_data, _pos.value, _filePos, "comment got end of file without finding end node");
|
||||
return false;
|
||||
}
|
||||
};
|
91
src/org/atriasoft/exml/Declaration.java
Normal file
91
src/org/atriasoft/exml/Declaration.java
Normal file
@ -0,0 +1,91 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
/**
|
||||
* @brief Declaration node: lt;?XXXXXX ... gt;
|
||||
*/
|
||||
public class Declaration extends AttributeList {
|
||||
public Declaration() {
|
||||
super("");
|
||||
};
|
||||
|
||||
public Declaration(final Declaration obj) {
|
||||
super(obj.m_value);
|
||||
for (final Attribute elem : obj.m_listAttribute) {
|
||||
this.m_listAttribute.add(elem.clone());
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] _name name of the declaration (xml, xml:xxxx ...)
|
||||
*/
|
||||
public Declaration(final String _name) {
|
||||
super(_name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Declaration clone() {
|
||||
return new Declaration(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeType getType() {
|
||||
return NodeType.declaration;
|
||||
};
|
||||
|
||||
@Override
|
||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||
addIndent(_data, _indent);
|
||||
_data.append("<?");
|
||||
_data.append(this.m_value);
|
||||
super.iGenerate(_data, _indent);
|
||||
_data.append("?>\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||
Log.verbose("start parse : 'declaration' : '" + this.m_value + "'");
|
||||
this.m_pos = _filePos;
|
||||
// search end of the comment :
|
||||
for (int iii = _pos.value; iii + 1 < _data.length(); iii++) {
|
||||
drawElementParsed(_data.charAt(iii), _filePos);
|
||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||
continue;
|
||||
}
|
||||
if (_data.charAt(iii) == '>' || _data.charAt(iii) == '<') {
|
||||
// an error occured :
|
||||
_doc.createError(_data, _pos.value, _filePos, " find '>' or '<' instead of '?>'");
|
||||
return false;
|
||||
}
|
||||
if (_data.charAt(iii) == '?' && _data.charAt(iii + 1) == '>') {
|
||||
_filePos.increment();
|
||||
// find end of declaration:
|
||||
_pos.value = iii + 1;
|
||||
return true;
|
||||
}
|
||||
if (checkAvaillable(_data.charAt(iii), true) == true) {
|
||||
// we find an attibute == > create an element and parse it:
|
||||
final Attribute attribute = new Attribute();
|
||||
_pos.value = iii;
|
||||
if (attribute.iParse(_data, _pos, _caseSensitive, _filePos, _doc) == false) {
|
||||
return false;
|
||||
}
|
||||
iii = _pos.value;
|
||||
this.m_listAttribute.add(attribute);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
_doc.createError(_data, _pos.value, _filePos, "Text got end of file without finding end node");
|
||||
_pos.value = _data.length();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
36
src/org/atriasoft/exml/DeclarationXML.java
Normal file
36
src/org/atriasoft/exml/DeclarationXML.java
Normal file
@ -0,0 +1,36 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
public class DeclarationXML extends Declaration {
|
||||
public DeclarationXML(final DeclarationXML obj) {
|
||||
super(obj.m_value);
|
||||
for (final Attribute elem : obj.m_listAttribute) {
|
||||
this.m_listAttribute.add(elem.clone());
|
||||
}
|
||||
}
|
||||
|
||||
public DeclarationXML(final String _version, final String _format, final boolean _standalone) {
|
||||
super("xml");
|
||||
if (_version.isEmpty() != true) {
|
||||
setAttribute("version", _version);
|
||||
}
|
||||
if (_format.contentEquals("UTF-8")) {
|
||||
setAttribute("encoding", "UTF-8");
|
||||
} else {
|
||||
Log.error("Actually does not supported other charset than UTF8");
|
||||
setAttribute("encoding", "UTF-8");
|
||||
}
|
||||
if (_standalone == true) {
|
||||
setAttribute("standalone", "true");
|
||||
} else {
|
||||
setAttribute("standalone", "true");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeclarationXML clone() {
|
||||
return new DeclarationXML(this);
|
||||
}
|
||||
|
||||
}
|
252
src/org/atriasoft/exml/Document.java
Normal file
252
src/org/atriasoft/exml/Document.java
Normal file
@ -0,0 +1,252 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
/**
|
||||
* @brief Basic document element of a document
|
||||
*/
|
||||
public class Document extends Element {
|
||||
private static String createPosPointer(final String _line, final int _pos) {
|
||||
String out = "";
|
||||
int iii;
|
||||
for (iii = 0; iii < _pos && iii < _line.length(); iii++) {
|
||||
if (_line.charAt(iii) == '\t') {
|
||||
out += "\t";
|
||||
} else {
|
||||
out += " ";
|
||||
}
|
||||
}
|
||||
for (; iii < _pos; iii++) {
|
||||
out += " ";
|
||||
}
|
||||
out += "^";
|
||||
return out;
|
||||
}
|
||||
|
||||
private boolean m_caseSensitive; //!< check the case sensitive of the nodes and attribute
|
||||
private boolean m_writeErrorWhenDetexted; //!< Request print error in parsing just when detected
|
||||
private String m_comment; //!< Comment on the error;
|
||||
private String m_Line; //!< Parse line error (copy);
|
||||
private FilePos m_filePos; //!< position of the error
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
public Document() {
|
||||
this.m_caseSensitive = false;
|
||||
this.m_writeErrorWhenDetexted = true;
|
||||
this.m_comment = "";
|
||||
this.m_Line = "";
|
||||
this.m_filePos = new FilePos(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Create an error in the parsing (call by the syetm for error management)
|
||||
* @param[in] _data string of chat is wrong
|
||||
* @param[in] _pos Position in the file
|
||||
* @param[in] _filePos human position of the error
|
||||
* @param[in] _comment Error string to display
|
||||
*/
|
||||
public void createError(final String _data, final int _pos, final FilePos _filePos, final String _comment) {
|
||||
this.m_comment = _comment;
|
||||
this.m_Line = extract_line(_data, _pos);
|
||||
this.m_filePos = _filePos;
|
||||
if (this.m_writeErrorWhenDetexted == true) {
|
||||
displayError();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display the Document on console
|
||||
*/
|
||||
public void display() {
|
||||
final StringBuilder tmpp = new StringBuilder();
|
||||
iGenerate(tmpp, 0);
|
||||
Log.info("Generated XML : \n" + tmpp.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Request display in log of the error
|
||||
*/
|
||||
public void displayError() {
|
||||
if (this.m_comment.length() == 0) {
|
||||
Log.error("No error detected ???");
|
||||
return;
|
||||
}
|
||||
Log.error(this.m_filePos + " " + this.m_comment + "\n" + this.m_Line + "\n" + createPosPointer(this.m_Line, this.m_filePos.getCol()));
|
||||
//Log.critical("detect error");
|
||||
}
|
||||
|
||||
String extract_line(final String data, final int _pos) {
|
||||
// search back : '\n'
|
||||
int startPos = data.lastIndexOf('\n', _pos);
|
||||
if (startPos == _pos) {
|
||||
startPos = 0;
|
||||
} else {
|
||||
startPos++;
|
||||
}
|
||||
// search forward : '\n'
|
||||
int stopPos = _pos;
|
||||
if (data.length() == _pos) {
|
||||
stopPos = _pos;
|
||||
} else if (data.charAt(_pos) != '\n') {
|
||||
stopPos = data.indexOf('\n', _pos);
|
||||
if (stopPos == _pos) {
|
||||
stopPos = data.length();
|
||||
}
|
||||
}
|
||||
if (startPos == -1) {
|
||||
startPos = 0;
|
||||
} else if (startPos >= data.length()) {
|
||||
return "";
|
||||
}
|
||||
if (stopPos == -1) {
|
||||
return "";
|
||||
} else if (stopPos >= data.length()) {
|
||||
stopPos = data.length();
|
||||
}
|
||||
return data.substring(startPos, stopPos);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief generate a string that contain the created XML
|
||||
* @param[out] _data Data where the xml is stored
|
||||
* @return false : An error occured
|
||||
* @return true : Parsing is OK
|
||||
*/
|
||||
public boolean generate(final StringBuilder _data) {
|
||||
return iGenerate(_data, 0);
|
||||
}
|
||||
/**
|
||||
* @brief Load the file that might contain the xml
|
||||
* @param[in] _uri URI of the xml
|
||||
* @return false : An error occured
|
||||
* @return true : Parsing is OK
|
||||
*/
|
||||
/*
|
||||
public boolean load( Uri _uri){
|
||||
// Start loading the XML :
|
||||
EXML_VERBOSE("open file (xml) " + _uri);
|
||||
clear();
|
||||
auto fileIo = uri::get(_uri);
|
||||
if (fileIo == null) {
|
||||
Log.error("File Does not exist : " + _uri);
|
||||
return false;
|
||||
}
|
||||
if (fileIo->open(io::OpenMode::Read) == false) {
|
||||
Log.error("Can not open (r) the file : " + _uri);
|
||||
return false;
|
||||
}
|
||||
// load data from the file:
|
||||
String tmpDataUnicode = fileIo->readAllString();
|
||||
// close the file:
|
||||
fileIo->close();
|
||||
// parse the data:
|
||||
boolean ret = parse(tmpDataUnicode);
|
||||
//Display();
|
||||
return ret;
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* @brief Store the Xml in the file
|
||||
* @param[in] _uri URI of the xml
|
||||
* @return false : An error occured
|
||||
* @return true : Parsing is OK
|
||||
*/
|
||||
|
||||
/*
|
||||
public boolean store( Uri _uri){
|
||||
String createData;
|
||||
if (generate(createData) == false) {
|
||||
Log.error("Error while creating the XML: " + _uri);
|
||||
return false;
|
||||
}
|
||||
auto fileIo = uri::get(_uri);
|
||||
if (fileIo == null) {
|
||||
Log.error("Can not create the uri: " + _uri);
|
||||
return false;
|
||||
}
|
||||
if (fileIo->open(io::OpenMode::Write) == false) {
|
||||
Log.error("Can not open (r) the file : " + _uri);
|
||||
return false;
|
||||
}
|
||||
fileIo->writeAll(createData);
|
||||
fileIo->close();
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* @brief get the status of case sensitive mode.
|
||||
* @return true if case sensitive is active
|
||||
*/
|
||||
public boolean getCaseSensitive() {
|
||||
return this.m_caseSensitive;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the display of the error status.
|
||||
* @return true Display error
|
||||
* @return false Does not display error (get it at end)
|
||||
*/
|
||||
public boolean getDisplayError() {
|
||||
return this.m_writeErrorWhenDetexted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeType getType() {
|
||||
return NodeType.document;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||
for (int iii = 0; iii < this.m_listSub.size(); iii++) {
|
||||
if (this.m_listSub.get(iii) != null) {
|
||||
this.m_listSub.get(iii).iGenerate(_data, _indent);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief parse a string that contain an XML
|
||||
* @param[in] _data Data to parse
|
||||
* @return false : An error occured
|
||||
* @return true : Parsing is OK
|
||||
*/
|
||||
public boolean parse(final String _data) {
|
||||
Log.verbose("Start parsing document (type: string) size=" + _data.length());
|
||||
clear();
|
||||
// came from char == > force in utf8 ...
|
||||
this.m_pos = new FilePos(1, 0);
|
||||
final PositionParsing parsePos = new PositionParsing();
|
||||
return subParse(_data, parsePos, this.m_caseSensitive, this.m_pos, this, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable or diasable the case sensitive (must be done before the call of parsing)
|
||||
* @param[in] _val true if enable; false else.
|
||||
*/
|
||||
// TODO: Naming error, it is insensitive ...
|
||||
public void setCaseSensitive(final boolean _val) {
|
||||
this.m_caseSensitive = _val;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the display of the error when detected.
|
||||
* @param[in] _value true: display error, false not display error (get it at end)
|
||||
*/
|
||||
public void setDisplayError(final boolean _value) {
|
||||
this.m_writeErrorWhenDetexted = _value;
|
||||
}
|
||||
}
|
532
src/org/atriasoft/exml/Element.java
Normal file
532
src/org/atriasoft/exml/Element.java
Normal file
@ -0,0 +1,532 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.atriasoft.exml.exception.ExmlNodeDoesNotExist;
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
/**
|
||||
* @brief Basic element Node of an XML document lt;YYYYYgt;
|
||||
*/
|
||||
public class Element extends AttributeList {
|
||||
protected List<Node> m_listSub = new ArrayList<>(); //!< List of subNodes;
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
public Element() {
|
||||
super();
|
||||
};
|
||||
|
||||
public Element(final Element obj) throws CloneNotSupportedException {
|
||||
super(obj.m_value);
|
||||
for (final Attribute elem : obj.m_listAttribute) {
|
||||
this.m_listAttribute.add(elem.clone());
|
||||
}
|
||||
for (final Node elem : obj.m_listSub) {
|
||||
this.m_listSub.add(elem.clone());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] _value Element name;
|
||||
*/
|
||||
public Element(final String _value) {
|
||||
super(_value);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief add a node at the element (not Attribute (move in the attribute automaticly).
|
||||
* @param[in] _node Pointer of the node to add.
|
||||
*/
|
||||
public void append(final Node _node) {
|
||||
if (_node == null) {
|
||||
Log.error("Try to set an empty node");
|
||||
return;
|
||||
}
|
||||
if (_node.getType() == NodeType.attribute) {
|
||||
appendAttribute(_node.toAttribute());
|
||||
return;
|
||||
}
|
||||
for (int iii = 0; iii < this.m_listSub.size(); iii++) {
|
||||
if (this.m_listSub.get(iii) == _node) {
|
||||
Log.error("Try to add a node that is already added before !!!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.m_listSub.add(_node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
super.clear();
|
||||
this.m_listSub.clear();
|
||||
};
|
||||
|
||||
@Override
|
||||
public Element clone() throws CloneNotSupportedException {
|
||||
return new Element(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the Node pointer of the element id.
|
||||
* @param[in] _id Id of the element.
|
||||
* @return true if the Node exist.
|
||||
*/
|
||||
public boolean existNode(final int _id) {
|
||||
if (_id < 0 || _id >= this.m_listSub.size()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get an element with his name (work only with Element)
|
||||
* @param[in] _name Name of the element that is requested
|
||||
* @return true if the Node exist.
|
||||
*/
|
||||
public boolean existNode(final String _name) {
|
||||
if (_name.isEmpty() == true) {
|
||||
return false;
|
||||
}
|
||||
for (int iii = 0; iii < this.m_listSub.size(); iii++) {
|
||||
if (this.m_listSub.get(iii) != null && this.m_listSub.get(iii).getValue().contentEquals(_name) == true) {
|
||||
if (this.m_listSub.get(iii) == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the Node pointer of the element id.
|
||||
* @param[in] _id Id of the element.
|
||||
* @return Pointer on node.
|
||||
* @throws ExmlNodeDoesNotExist The Node does not exist
|
||||
*/
|
||||
public Node getNode(final int _id) throws ExmlNodeDoesNotExist {
|
||||
if (_id < 0 || _id >= this.m_listSub.size()) {
|
||||
throw new ExmlNodeDoesNotExist("Node does not exist: " + _id + "/" + this.m_listAttribute.size());
|
||||
}
|
||||
return this.m_listSub.get(_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get an element with his name (work only with Element)
|
||||
* @param[in] _name Name of the element that is requested
|
||||
* @return Pointer on the node.
|
||||
* @throws ExmlNodeDoesNotExist The Node does not exist
|
||||
*/
|
||||
public Node getNode(final String _name) throws ExmlNodeDoesNotExist {
|
||||
if (_name.isEmpty() == true) {
|
||||
throw new ExmlNodeDoesNotExist("Node can not have empty name in " + this.m_listAttribute.size() + " nodes");
|
||||
}
|
||||
for (int iii = 0; iii < this.m_listSub.size(); iii++) {
|
||||
if (this.m_listSub.get(iii) != null && this.m_listSub.get(iii).getValue().contentEquals(_name) == true) {
|
||||
return this.m_listSub.get(iii);
|
||||
}
|
||||
}
|
||||
throw new ExmlNodeDoesNotExist("Node does not exist: '" + _name + "' in " + this.m_listAttribute.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the list of the sub-nodes.
|
||||
* @return List of current nodes.
|
||||
*/
|
||||
public List<Node> getNodes() {
|
||||
return this.m_listSub;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the internal data of the element (if the element has some sub node they are converted in xml string == > like this it is not needed to use <![CDATA[...]]>
|
||||
* @return the curent data string. if Only one text node, then we get the parssed data (no amp; ...) if more than one node, then we transform ,",',<,> in xml normal text...
|
||||
*/
|
||||
public String getText() {
|
||||
final StringBuilder res = new StringBuilder();
|
||||
if (this.m_listSub.size() == 1) {
|
||||
if (this.m_listSub.get(0).getType() == NodeType.text) {
|
||||
res.append(this.m_listSub.get(0).getValue());
|
||||
} else {
|
||||
this.m_listSub.get(0).iGenerate(res, 0);
|
||||
}
|
||||
} else {
|
||||
for (int iii = 0; iii < this.m_listSub.size(); iii++) {
|
||||
if (this.m_listSub.get(iii) != null) {
|
||||
this.m_listSub.get(iii).iGenerate(res, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public NodeType getType() {
|
||||
return NodeType.element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the type of the element id.
|
||||
* @param[in] _id Id of the element.
|
||||
* @return the Current type of the element or typeUnknow.
|
||||
*/
|
||||
public NodeType getType(final int _id) {
|
||||
if (_id < 0 || _id >= this.m_listSub.size()) {
|
||||
return NodeType.unknow;
|
||||
}
|
||||
return this.m_listSub.get(_id).getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||
addIndent(_data, _indent);
|
||||
_data.append("<");
|
||||
_data.append(this.m_value);
|
||||
super.iGenerate(_data, _indent);
|
||||
|
||||
if (this.m_listSub.size() > 0) {
|
||||
if (this.m_listSub.size() == 1 && this.m_listSub.get(0) != null && this.m_listSub.get(0).getType() == NodeType.text && ((Text) this.m_listSub.get(0)).countLines() == 1) {
|
||||
_data.append(">");
|
||||
this.m_listSub.get(0).iGenerate(_data, 0);
|
||||
Log.verbose(" generate : '" + _data + "'");
|
||||
} else {
|
||||
_data.append(">\n");
|
||||
for (int iii = 0; iii < this.m_listSub.size(); iii++) {
|
||||
if (this.m_listSub.get(iii) != null) {
|
||||
this.m_listSub.get(iii).iGenerate(_data, _indent + 1);
|
||||
}
|
||||
}
|
||||
addIndent(_data, _indent);
|
||||
}
|
||||
_data.append("</");
|
||||
_data.append(this.m_value);
|
||||
_data.append(">\n");
|
||||
} else {
|
||||
_data.append("/>\n");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||
//EXML_PARSE_ELEMENT("start parse : 'element' named='" + m_value + "'");
|
||||
// note : When start parsing the upper element must have set the value of the element and set the position after this one
|
||||
this.m_pos = _filePos.clone();
|
||||
// find a normal node ...
|
||||
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
||||
_filePos.check(_data.charAt(iii));
|
||||
drawElementParsed(_data.charAt(iii), _filePos);
|
||||
if (_data.charAt(iii) == '>') {
|
||||
// we find the end ...
|
||||
_pos.value = iii + 1;
|
||||
return subParse(_data, _pos, _caseSensitive, _filePos, _doc, false);
|
||||
}
|
||||
if (_data.charAt(iii) == '/') {
|
||||
// standalone node or error...
|
||||
if (iii + 1 >= _data.length()) {
|
||||
_doc.createError(_data, _pos.value, _filePos, "Find end of files ... == > bad case");
|
||||
return false;
|
||||
}
|
||||
// TODO : Can have white spaces ....
|
||||
if (_data.charAt(iii + 1) == '>') {
|
||||
_pos.value = iii + 1;
|
||||
return true;
|
||||
}
|
||||
// error
|
||||
_doc.createError(_data, _pos.value, _filePos, "Find / without > char ...");
|
||||
return false;
|
||||
}
|
||||
if (checkAvaillable(_data.charAt(iii), true) == true) {
|
||||
// we find an attibute == > create an element and parse it:
|
||||
final Attribute attribute = new Attribute();
|
||||
_pos.value = iii;
|
||||
if (attribute.iParse(_data, _pos, _caseSensitive, _filePos, _doc) == false) {
|
||||
return false;
|
||||
}
|
||||
iii = _pos.value;
|
||||
this.m_listAttribute.add(attribute);
|
||||
continue;
|
||||
}
|
||||
if (isWhiteChar(_data.charAt(iii)) == false) {
|
||||
_doc.createError(_data, iii, _filePos, "Find an unknow element : '" + _data.charAt(iii) + "'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
_doc.createError(_data, _pos.value, _filePos, "Unexpecting end of parsing exml::internal::Element : '" + this.m_value + "' == > check if the '/>' is set or the end of element");
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Remove all element with this name
|
||||
* @param[in] _nodeName Name of nodes to remove.
|
||||
*/
|
||||
public void remove(final String _nodeName) {
|
||||
if (_nodeName == "") {
|
||||
return;
|
||||
}
|
||||
for (final ListIterator<Node> iter = this.m_listSub.listIterator(); iter.hasNext();) {
|
||||
final Node element = iter.next();
|
||||
if (element == null) {
|
||||
iter.remove();
|
||||
continue;
|
||||
}
|
||||
if (element.getValue().contentEquals(_nodeName) == true) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the number of sub element in the node (can be Comment ; Element ; Text :Declaration).
|
||||
* @return a number >=0.
|
||||
*/
|
||||
public int size() {
|
||||
return this.m_listSub.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parse sub node string
|
||||
* @param[in] _data all file string data
|
||||
* @param[in,out] _pos Position to start parsing in the file and return the end of parsing
|
||||
* @param[in] _caseSensitive Case sensitive parsing (usefull for html)
|
||||
* @param[in] _filePos Current File position of the parsing
|
||||
* @param[in] _doc Document base reference
|
||||
* @param[in] _mainNode if true, this is the first root node
|
||||
* @return true parsing is done OK
|
||||
* @return false An error appear in the parsing
|
||||
*/
|
||||
protected boolean subParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||
return subParse(_data, _pos, _caseSensitive, _filePos, _doc, false);
|
||||
}
|
||||
|
||||
protected boolean subParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc, final boolean _mainNode) {
|
||||
//EXML_PARSE_ELEMENT(" start subParse ... " << _pos << " " << _filePos);
|
||||
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
||||
_filePos.check(_data.charAt(iii));
|
||||
drawElementParsed(_data.charAt(iii), _filePos);
|
||||
final FilePos tmpPos = new FilePos();
|
||||
if (_data.charAt(iii) == '<') {
|
||||
final int white = countWhiteChar(_data, iii + 1, tmpPos);
|
||||
if (iii + white + 1 >= _data.length()) {
|
||||
_filePos.add(tmpPos);
|
||||
_doc.createError(_data, _pos.value, _filePos, "End file with '<' char == > invalide XML");
|
||||
_pos.value = iii + white;
|
||||
return false;
|
||||
}
|
||||
// Detect type of the element:
|
||||
if (_data.charAt(iii + white + 1) == '>') {
|
||||
_filePos.add(tmpPos);
|
||||
_doc.createError(_data, _pos.value, _filePos, "Find '>' with no element in the element...");
|
||||
_pos.value = iii + white + 1;
|
||||
return false;
|
||||
}
|
||||
if (_data.charAt(iii + white + 1) == '?') {
|
||||
tmpPos.increment();
|
||||
// TODO : white space ...
|
||||
if (checkAvaillable(_data.charAt(iii + white + 2), true) == false) {
|
||||
_doc.createError(_data, _pos.value, _filePos, "Find unavaillable name in the Declaration node...");
|
||||
_pos.value = iii + white + 1;
|
||||
return false;
|
||||
}
|
||||
//EXML_DEBUG("Generate node name : '" << _data[iii+1] << "'");
|
||||
int endPosName = iii + white + 1;
|
||||
// generate element name ...
|
||||
for (int jjj = iii + white + 2; jjj < _data.length(); jjj++) {
|
||||
if (checkAvaillable(_data.charAt(jjj), false) == true) {
|
||||
// we find the end ...
|
||||
endPosName = jjj;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
tmpPos.check(_data.charAt(jjj));
|
||||
}
|
||||
String tmpname = _data.substring(iii + white + 2, endPosName + 1);
|
||||
if (_caseSensitive == true) {
|
||||
tmpname = tmpname.toLowerCase();
|
||||
}
|
||||
// Find declaration marker
|
||||
final Declaration declaration = new Declaration(tmpname);
|
||||
_filePos.add(tmpPos);
|
||||
_pos.value = endPosName + 1;
|
||||
if (declaration.iParse(_data, _pos, _caseSensitive, _filePos, _doc) == false) {
|
||||
return false;
|
||||
}
|
||||
iii = _pos.value;
|
||||
this.m_listSub.add(declaration);
|
||||
continue;
|
||||
}
|
||||
if (_data.charAt(iii + white + 1) == '!') {
|
||||
tmpPos.increment();
|
||||
// Find special block element
|
||||
if (iii + white + 2 >= _data.length()) {
|
||||
_doc.createError(_data, _pos.value, _filePos, "End file with '<!' chars == > invalide XML");
|
||||
return false;
|
||||
}
|
||||
if (_data.charAt(iii + white + 2) == '-') {
|
||||
tmpPos.increment();
|
||||
if (iii + white + 3 >= _data.length()) {
|
||||
_doc.createError(_data, _pos.value, _filePos, "End file with '<!-' chars == > invalide XML");
|
||||
return false;
|
||||
}
|
||||
if (_data.charAt(iii + white + 3) != '-') {
|
||||
_doc.createError(_data, _pos.value, _filePos, "Element parse with '<!-" + _data.charAt(iii + 3) + "' chars == > invalide XML");
|
||||
return false;
|
||||
}
|
||||
tmpPos.increment();
|
||||
// find comment:
|
||||
final Comment comment = new Comment();
|
||||
_pos.value = iii + white + 4;
|
||||
_filePos.add(tmpPos);
|
||||
if (comment.iParse(_data, _pos, _caseSensitive, _filePos, _doc) == false) {
|
||||
return false;
|
||||
}
|
||||
iii = _pos.value;
|
||||
this.m_listSub.add(comment);
|
||||
} else if (_data.charAt(iii + white + 2) == '[') {
|
||||
tmpPos.increment();
|
||||
if (iii + white + 8 >= _data.length()) {
|
||||
_doc.createError(_data, _pos.value, _filePos, "End file with '<![' chars == > invalide XML");
|
||||
return false;
|
||||
}
|
||||
if (_data.charAt(iii + white + 3) != 'C' || _data.charAt(iii + white + 4) != 'D' || _data.charAt(iii + white + 5) != 'A' || _data.charAt(iii + white + 6) != 'T'
|
||||
|| _data.charAt(iii + white + 7) != 'A' || _data.charAt(iii + white + 8) != '[') {
|
||||
_doc.createError(_data, _pos.value, _filePos, "Element parse with '<![" + _data.charAt(iii + white + 3) + _data.charAt(iii + white + 4) + _data.charAt(iii + white + 5)
|
||||
+ _data.charAt(iii + white + 6) + _data.charAt(iii + white + 7) + _data.charAt(iii + white + 8) + "' chars == > invalide XML");
|
||||
return false;
|
||||
}
|
||||
tmpPos.add(6);
|
||||
// find text:
|
||||
final TextCDATA text = new TextCDATA();
|
||||
_pos.value = iii + 9 + white;
|
||||
_filePos.add(tmpPos);
|
||||
if (text.iParse(_data, _pos, _caseSensitive, _filePos, _doc) == false) {
|
||||
return false;
|
||||
}
|
||||
iii = _pos.value;
|
||||
this.m_listSub.add(text);
|
||||
} else {
|
||||
_doc.createError(_data, _pos.value, _filePos, "End file with '<!" + _data.charAt(iii + white + 2) + "' chars == > invalide XML");
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (_data.charAt(iii + white + 1) == '/') {
|
||||
tmpPos.increment();
|
||||
//EXML_DEBUG("Generate node name : '" << _data[iii+1] << "'");
|
||||
int endPosName = iii + white + 1;
|
||||
// generate element name ...
|
||||
for (int jjj = iii + white + 2; jjj < _data.length(); jjj++) {
|
||||
if (checkAvaillable(_data.charAt(jjj), false) == true) {
|
||||
// we find the end ...
|
||||
endPosName = jjj;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
tmpPos.check(_data.charAt(jjj));
|
||||
}
|
||||
String tmpname = _data.substring(iii + white + 2, endPosName + 1);
|
||||
if (_caseSensitive == true) {
|
||||
tmpname = tmpname.toLowerCase();
|
||||
}
|
||||
if (tmpname.contentEquals(this.m_value) == true) {
|
||||
// find end of node :
|
||||
// find > element ...
|
||||
for (int jjj = endPosName + 1; jjj < _data.length(); jjj++) {
|
||||
drawElementParsed(_data.charAt(jjj), _filePos);
|
||||
if (tmpPos.check(_data.charAt(jjj)) == true) {
|
||||
continue;
|
||||
}
|
||||
if (_data.charAt(jjj) == '>') {
|
||||
_pos.value = jjj;
|
||||
_filePos.add(tmpPos);
|
||||
return true;
|
||||
} else if (_data.charAt(jjj) != '\r' && _data.charAt(jjj) != ' ' && _data.charAt(jjj) != '\t') {
|
||||
_filePos.add(tmpPos);
|
||||
_doc.createError(_data, jjj, _filePos, "End node error : have data inside end node other than [ \\n\\t\\r] " + this.m_value + "'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_doc.createError(_data, _pos.value, _filePos, "End node error : '" + tmpname + "' != '" + this.m_value + "'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (_data.charAt(iii + white + 1) == '>') {
|
||||
// end of something == > this is really bad
|
||||
_doc.createError(_data, _pos.value, _filePos, "Find '>' chars == > invalide XML");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (checkAvaillable(_data.charAt(iii + white + 1), true) == true) {
|
||||
tmpPos.increment();
|
||||
Log.debug("Generate node name : '" + _data.charAt(iii + 1) + "'");
|
||||
int endPosName = iii + white + 1;
|
||||
// generate element name ...
|
||||
for (int jjj = iii + white + 2; jjj < _data.length(); jjj++) {
|
||||
if (checkAvaillable(_data.charAt(jjj), false) == true) {
|
||||
// we find the end ...
|
||||
endPosName = jjj;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
tmpPos.check(_data.charAt(jjj));
|
||||
}
|
||||
String tmpname = _data.substring(iii + white + 1, endPosName + 1);
|
||||
if (_caseSensitive == true) {
|
||||
tmpname = tmpname.toLowerCase();
|
||||
}
|
||||
Log.debug("find node named : '" + tmpname + "'");
|
||||
// find text:
|
||||
final Element element = new Element(tmpname);
|
||||
_pos.value = endPosName + 1;
|
||||
_filePos.add(tmpPos);
|
||||
if (element.iParse(_data, _pos, _caseSensitive, _filePos, _doc) == false) {
|
||||
return false;
|
||||
}
|
||||
iii = _pos.value;
|
||||
this.m_listSub.add(element);
|
||||
continue;
|
||||
}
|
||||
_filePos.add(tmpPos);
|
||||
// here we have an error :
|
||||
_doc.createError(_data, _pos.value, _filePos, "Find an ununderstanding element : '" + _data.charAt(iii + white + 1) + "'");
|
||||
return false;
|
||||
} else {
|
||||
if (_data.charAt(iii) == '>') {
|
||||
_doc.createError(_data, _pos.value, _filePos, "Find elemement '>' == > no reason to be here ...");
|
||||
return false;
|
||||
}
|
||||
// might to be data text ...
|
||||
if (_data.charAt(iii) == '\n' || _data.charAt(iii) == ' ' || _data.charAt(iii) == '\t' || _data.charAt(iii) == '\r') {
|
||||
// empty spaces == > nothing to do ....
|
||||
} else {
|
||||
// find data == > parse it...
|
||||
final Text text = new Text();
|
||||
_pos.value = iii;
|
||||
_filePos.add(tmpPos);
|
||||
if (text.iParse(_data, _pos, _caseSensitive, _filePos, _doc) == false) {
|
||||
return false;
|
||||
}
|
||||
iii = _pos.value;
|
||||
this.m_listSub.add(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_mainNode == true) {
|
||||
return true;
|
||||
}
|
||||
_doc.createError(_data, _pos.value, _filePos, "Did not find end of the exml::internal::Element : '" + this.m_value + "'");
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
180
src/org/atriasoft/exml/FilePos.java
Normal file
180
src/org/atriasoft/exml/FilePos.java
Normal file
@ -0,0 +1,180 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Position in the file of the original data.
|
||||
*/
|
||||
public class FilePos {
|
||||
private int m_col; //!< source text colomn
|
||||
private int m_line; //!< source Line colomn
|
||||
|
||||
/**
|
||||
* @brief default contructor (set line and col at 0)
|
||||
*/
|
||||
public FilePos() {
|
||||
this.m_col = 0;
|
||||
this.m_line = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief initialize constructor
|
||||
* @param[in] _line Line in the file
|
||||
* @param[in] _col Colomn in the file
|
||||
*/
|
||||
public FilePos(final int _line, final int _col) {
|
||||
this.m_col = _col;
|
||||
this.m_line = _line;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Addition operator
|
||||
* @param[in] _obj Addition object..
|
||||
* @return Reference on this
|
||||
*/
|
||||
public FilePos add(final FilePos _obj) {
|
||||
if (_obj.m_line == 0) {
|
||||
this.m_col += _obj.m_col;
|
||||
} else {
|
||||
this.m_col = _obj.m_col;
|
||||
this.m_line += _obj.m_line;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Colomn addition operator
|
||||
* @param[in] _col Number of colomn to add
|
||||
* @return Reference on this
|
||||
*/
|
||||
public FilePos add(final int _col) {
|
||||
this.m_col += _col;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the value is a new line and update internal property
|
||||
* @param[in] _val Char value to check
|
||||
* @return true We find a new line
|
||||
* @return false We NOT find a new line
|
||||
*/
|
||||
public boolean check(final Character _val) {
|
||||
this.m_col++;
|
||||
if (_val == '\n') {
|
||||
newLine();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Reset position at 0,0
|
||||
*/
|
||||
public void clear() {
|
||||
this.m_col = 0;
|
||||
this.m_line = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FilePos clone() {
|
||||
final FilePos out = new FilePos();
|
||||
out.m_col = this.m_col;
|
||||
out.m_line = this.m_line;
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Decrement the colomn position
|
||||
* @return Reference on this
|
||||
*/
|
||||
public FilePos decrement() {
|
||||
this.m_col--;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof FilePos)) {
|
||||
return false;
|
||||
}
|
||||
final FilePos other = (FilePos) obj;
|
||||
return this.m_col == other.m_col && this.m_line == other.m_line;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the colomn position
|
||||
* @return Colomn in number of utf8-char
|
||||
*/
|
||||
public int getCol() {
|
||||
return this.m_col;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get the line number position
|
||||
* @return line ID (start at 0)
|
||||
*/
|
||||
public int getLine() {
|
||||
return this.m_line;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode() + this.m_line + this.m_col;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Increment the colomn position
|
||||
* @return Reference on this
|
||||
*/
|
||||
public FilePos increment() {
|
||||
this.m_col++;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Find a new line & reset colomn at 0
|
||||
*/
|
||||
public void newLine() {
|
||||
this.m_col = 0;
|
||||
this.m_line++;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Asignment operator
|
||||
* @param[in] _obj Object to copy
|
||||
* @return Reference on this
|
||||
*/
|
||||
public FilePos set(final FilePos _obj) {
|
||||
this.m_col = _obj.m_col;
|
||||
this.m_line = _obj.m_line;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Setter of specific data
|
||||
* @param[in] _line Line in the file
|
||||
* @param[in] _col Colomn in the file
|
||||
*/
|
||||
public void set(final int _line, final int _col) {
|
||||
this.m_col = _col;
|
||||
this.m_line = _line;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String out = "(l=";
|
||||
out += this.m_line;
|
||||
out += ",c=";
|
||||
out += this.m_col;
|
||||
out += ")";
|
||||
return out;
|
||||
}
|
||||
|
||||
};
|
275
src/org/atriasoft/exml/Node.java
Normal file
275
src/org/atriasoft/exml/Node.java
Normal file
@ -0,0 +1,275 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
/**
|
||||
* @brief Basic main object of all xml elements.
|
||||
*/
|
||||
public abstract class Node {
|
||||
|
||||
protected class PositionParsing {
|
||||
public int value = 0;
|
||||
}
|
||||
|
||||
protected static boolean isWhiteChar(final Character _val) {
|
||||
if (_val == ' ' || _val == '\t' || _val == '\n' || _val == '\r') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected FilePos m_pos; //!< position in the readed file == > not correct when the file is generated;
|
||||
|
||||
protected String m_value; //!< value of the node (for element this is the name, for text it is the inside text ...);
|
||||
|
||||
/**
|
||||
* @brief basic element of a xml structure
|
||||
*/
|
||||
public Node() {
|
||||
this.m_pos = new FilePos(0, 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief basic element of a xml structure
|
||||
* @param[in] _value value of the node
|
||||
*/
|
||||
public Node(final String _value) {
|
||||
this.m_pos = new FilePos(0, 0);
|
||||
this.m_value = _value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief add indentation of the string input.
|
||||
* @param[in,out] _data String where the indentation is done.
|
||||
* @param[in] _indent Number of tab to add at the string.
|
||||
*/
|
||||
protected void addIndent(final StringBuilder _data, final int _indent) {
|
||||
for (int iii = 0; iii < _indent; iii++) {
|
||||
_data.append("\t");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if an element or attribute is availlable (not : !"#$%&'()*+,/;<=>?@[\]^`{|}~ \\n\\t\\r and for first char : not -.0123456789).
|
||||
* @param[in] _val Value to check the conformity.
|
||||
* @param[in] _firstChar True if the element check is the first char.
|
||||
* @return true The value can be a part of attribute name
|
||||
* @return false The value can NOT be a part of attribute name
|
||||
*/
|
||||
protected boolean checkAvaillable(final Character _val, final boolean _firstChar) {
|
||||
if (_val == '!' || _val == '"' || _val == '#' || _val == '$' || _val == '%' || _val == '&' || _val == '\'' // '
|
||||
|| _val == '(' || _val == ')' || _val == '*' || _val == '+' || _val == ',' || _val == '/' || _val == ';' || _val == '<' || _val == '=' || _val == '>' || _val == '?' || _val == '@'
|
||||
|| _val == '[' || _val == '\\' || _val == ']' || _val == '^' || _val == '`' || _val == '{' || _val == '|' || _val == '}' || _val == '~' || _val == ' ' || _val == '\n' || _val == '\t'
|
||||
|| _val == '\r') {
|
||||
return false;
|
||||
}
|
||||
if (_firstChar == true) {
|
||||
if (_val == '-' || _val == '.' || (_val >= '0' && _val <= '9')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief clear the Node
|
||||
*/
|
||||
public void clear() {
|
||||
this.m_value = "";
|
||||
this.m_pos.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Node clone() throws CloneNotSupportedException {
|
||||
throw new CloneNotSupportedException("Can not clone an abstract class ...");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief count the number of white char in the string from the specify position (stop at the first element that is not a white char)
|
||||
* @param[in] _data Data to parse.
|
||||
* @param[in] _pos Start position in the string.
|
||||
* @param[out] _filePos new poistion of te file to add.
|
||||
* @return number of white element.
|
||||
*/
|
||||
protected int countWhiteChar(final String _data, final int _pos, final FilePos _filePos) {
|
||||
_filePos.clear();
|
||||
int white = 0;
|
||||
for (int iii = _pos; iii < _data.length(); iii++) {
|
||||
_filePos.check(_data.charAt(iii));
|
||||
if (isWhiteChar(_data.charAt(iii)) == true) {
|
||||
white++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
_filePos.decrement();
|
||||
return white;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Display the cuurent element that is curently parse.
|
||||
* @param[in] _val Char that is parsed.
|
||||
* @param[in] _filePos Position of the char in the file.
|
||||
*/
|
||||
protected void drawElementParsed(final Character _val, final FilePos _filePos) {
|
||||
if (_val == '\n') {
|
||||
Log.debug(_filePos + " parse '\\n'");
|
||||
} else if (_val == '\t') {
|
||||
Log.debug(_filePos + " parse '\\t'");
|
||||
} else {
|
||||
Log.debug(_filePos + " parse '" + _val + "'");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the current position where the element is in the file
|
||||
* @return The file position reference
|
||||
*/
|
||||
public FilePos getPos() {
|
||||
return this.m_pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the node type.
|
||||
* @return the type of the Node.
|
||||
*/
|
||||
NodeType getType() {
|
||||
return NodeType.node;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get the current element Value.
|
||||
* @return the reference of the string value.
|
||||
*/
|
||||
public String getValue() {
|
||||
return this.m_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief generate a string with the tree of the xml
|
||||
* @param[in,out] _data string where to add the elements
|
||||
* @param[in] _indent current indentation of the file
|
||||
* @return false if an error occured.
|
||||
*/
|
||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief parse the Current node [pure VIRUAL]
|
||||
* @param[in] _data data string to parse.
|
||||
* @param[in,out] _pos position in the string to start parse, return the position end of parsing.
|
||||
* @param[in] _caseSensitive Request a parsion of element that is not case sensitive (all element is in low case)
|
||||
* @param[in,out] _filePos file parsing position (line x col x)
|
||||
* @param[in,out] _doc Base document reference
|
||||
* @return false if an error occured.
|
||||
*/
|
||||
protected abstract boolean iParse(String _data, PositionParsing _pos, boolean _caseSensitive, FilePos _filePos, Document _doc);
|
||||
|
||||
/**
|
||||
* @brief check if the node is a exml::Attribute
|
||||
* @return true if the node is a exml::Attribute
|
||||
*/
|
||||
public boolean isAttribute() {
|
||||
return this instanceof Attribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if the node is a exml::Comment
|
||||
* @return true if the node is a exml::Comment
|
||||
*/
|
||||
public boolean isComment() {
|
||||
return this instanceof Comment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if the node is a exml::Declaration
|
||||
* @return true if the node is a exml::Declaration
|
||||
*/
|
||||
public boolean isDeclaration() {
|
||||
return this instanceof Declaration;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if the node is a exml::Document
|
||||
* @return true if the node is a exml::Document
|
||||
*/
|
||||
public boolean isDocument() {
|
||||
return this instanceof Document;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if the node is a exml::Element
|
||||
* @return true if the node is a exml::Element
|
||||
*/
|
||||
public boolean isElement() {
|
||||
return this instanceof Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if the node is a exml::Text
|
||||
* @return true if the node is a exml::Text
|
||||
*/
|
||||
public boolean isText() {
|
||||
return this instanceof Text;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set the value of the node.
|
||||
* @param[in] _value New value of the node.
|
||||
*/
|
||||
|
||||
public void setValue(final String _value) {
|
||||
this.m_value = _value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cast the element in a Attribute if it is possible.
|
||||
* @return pointer on the class or null.
|
||||
*/
|
||||
public Attribute toAttribute() {
|
||||
return (Attribute) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cast the element in a Comment if it is possible.
|
||||
* @return pointer on the class or null.
|
||||
*/
|
||||
public Comment toComment() {
|
||||
return (Comment) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cast the element in a Declaration if it is possible.
|
||||
* @return pointer on the class or null.
|
||||
*/
|
||||
public Declaration toDeclaration() {
|
||||
return (Declaration) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cast the element in a Document if it is possible.
|
||||
* @return pointer on the class or null.
|
||||
*/
|
||||
public Document toDocument() {
|
||||
return (Document) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cast the element in a Element if it is possible.
|
||||
* @return pointer on the class or null.
|
||||
*/
|
||||
public Element toElement() {
|
||||
return (Element) this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Cast the element in a Text if it is possible.
|
||||
* @return pointer on the class or null.
|
||||
*/
|
||||
public Text toText() {
|
||||
return (Text) this;
|
||||
}
|
||||
|
||||
}
|
20
src/org/atriasoft/exml/NodeType.java
Normal file
20
src/org/atriasoft/exml/NodeType.java
Normal file
@ -0,0 +1,20 @@
|
||||
package org.atriasoft.exml;
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @brief Type of the XML elements.
|
||||
*/
|
||||
public enum NodeType {
|
||||
unknow, //!< might be an error ...
|
||||
node, //!< might be an error ...
|
||||
document, //!< all the file main access
|
||||
declaration, //!< <?xml ... ?>
|
||||
attribute, //!< the <Element ATTRIBUTE="ATTRIBUTE_VALUE" />
|
||||
element, //!< the <XXX> ... </XXX>
|
||||
comment, //!< comment node : <!-- -->
|
||||
text, //!< <XXX> InsideText </XXX>
|
||||
}
|
114
src/org/atriasoft/exml/Text.java
Normal file
114
src/org/atriasoft/exml/Text.java
Normal file
@ -0,0 +1,114 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
/**
|
||||
* @brief Text node interface (internal data between two Marker: <XXX> ALL here </XXX>
|
||||
*/
|
||||
public class Text extends Node {
|
||||
|
||||
// transform the Text with :
|
||||
// "<" == "<"
|
||||
// ">" == ">"
|
||||
// "&" == "&"
|
||||
// "'" == "'"
|
||||
// """ == """
|
||||
private static String replaceSpecialChar(final String _inval) {
|
||||
final String out = _inval;
|
||||
out.replace("<", "<");
|
||||
out.replace(">", ">");
|
||||
out.replace("'", "'");
|
||||
out.replace(""", "\"");
|
||||
out.replace("&", "&");
|
||||
//EXML_ERROR("INNN '"<< _inval << "' => '" << out << "'");
|
||||
return out;
|
||||
}
|
||||
|
||||
private static String replaceSpecialCharOut(final String _inval) {
|
||||
final String out = _inval;
|
||||
out.replace("<", "<");
|
||||
out.replace(">", ">");
|
||||
out.replace("'", "'");
|
||||
out.replace("\"", """);
|
||||
out.replace("&", "&");
|
||||
//EXML_ERROR("OUTTT '"<< _inval << "' => '" << out << "'");
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
*/
|
||||
public Text() {};
|
||||
|
||||
/**
|
||||
* @brief Constructor
|
||||
* @param[in] _data String data of the current Text
|
||||
*/
|
||||
public Text(final String _data) {
|
||||
super(_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief count the number of line in the current text
|
||||
* @return The number of lines
|
||||
*/
|
||||
protected int countLines() {
|
||||
int count = 1;
|
||||
for (int iii = 0; iii < this.m_value.length(); iii++) {
|
||||
if (this.m_value.charAt(iii) == '\n') {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
NodeType getType() {
|
||||
return NodeType.text;
|
||||
};
|
||||
|
||||
@Override
|
||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||
_data.append(replaceSpecialCharOut(this.m_value));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||
Log.verbose("start parse : 'text'");
|
||||
this.m_pos = _filePos;
|
||||
// search end of the comment :
|
||||
for (int iii = _pos.value; iii < _data.length(); iii++) {
|
||||
drawElementParsed(_data.charAt(iii), _filePos);
|
||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||
continue;
|
||||
}
|
||||
if (_data.charAt(iii) == '>' || _data.charAt(iii) == '<') {
|
||||
// search whitespace :
|
||||
int newEnd = iii;
|
||||
for (int jjj = iii - 1; jjj > _pos.value; --jjj) {
|
||||
if (isWhiteChar(_data.charAt(jjj)) == true) {
|
||||
newEnd = jjj;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// find end of value:
|
||||
this.m_value = _data.substring(_pos.value, newEnd);
|
||||
Log.verbose(" find text '" + this.m_value + "'");
|
||||
_pos.value = iii - 1;
|
||||
this.m_value = replaceSpecialChar(this.m_value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_doc.createError(_data, _pos.value, _filePos, "Text got end of file without finding end node");
|
||||
_pos.value = _data.length();
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
45
src/org/atriasoft/exml/TextCDATA.java
Normal file
45
src/org/atriasoft/exml/TextCDATA.java
Normal file
@ -0,0 +1,45 @@
|
||||
package org.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.internal.Log;
|
||||
|
||||
public class TextCDATA extends Text {
|
||||
public TextCDATA() {
|
||||
super();
|
||||
}
|
||||
|
||||
public TextCDATA(final String data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iGenerate(final StringBuilder _data, final int _indent) {
|
||||
_data.append("<![CDATA[");
|
||||
_data.append(this.m_value);
|
||||
_data.append("]]>");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean iParse(final String _data, final PositionParsing _pos, final boolean _caseSensitive, final FilePos _filePos, final Document _doc) {
|
||||
Log.verbose("start parse : 'text::CDATA'");
|
||||
this.m_pos = _filePos;
|
||||
// search end of the comment :
|
||||
for (int iii = _pos.value; iii + 2 < _data.length(); iii++) {
|
||||
drawElementParsed(_data.charAt(iii), _filePos);
|
||||
if (_filePos.check(_data.charAt(iii)) == true) {
|
||||
continue;
|
||||
}
|
||||
if (_data.charAt(iii) == ']' && _data.charAt(iii + 1) == ']' && _data.charAt(iii + 2) == '>') {
|
||||
// find end of value:
|
||||
_filePos.add(2);
|
||||
this.m_value = _data.substring(_pos.value, iii);
|
||||
Log.verbose(" find text CDATA '" + this.m_value + "'");
|
||||
_pos.value = iii + 2;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_doc.createError(_data, _pos.value, _filePos, "text CDATA got end of file without finding end node");
|
||||
_pos.value = _data.length();
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package org.atriasoft.exml.exception;
|
||||
|
||||
public class ExmlAttributeDoesNotExist extends ExmlException {
|
||||
/**
|
||||
* Generate Unique ID for serialization
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ExmlAttributeDoesNotExist(final String data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
}
|
12
src/org/atriasoft/exml/exception/ExmlException.java
Normal file
12
src/org/atriasoft/exml/exception/ExmlException.java
Normal file
@ -0,0 +1,12 @@
|
||||
package org.atriasoft.exml.exception;
|
||||
|
||||
public class ExmlException extends Exception {
|
||||
/**
|
||||
* Generate Unique ID for serialization
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ExmlException(final String data) {
|
||||
super(data);
|
||||
}
|
||||
}
|
13
src/org/atriasoft/exml/exception/ExmlNodeDoesNotExist.java
Normal file
13
src/org/atriasoft/exml/exception/ExmlNodeDoesNotExist.java
Normal file
@ -0,0 +1,13 @@
|
||||
package org.atriasoft.exml.exception;
|
||||
|
||||
public class ExmlNodeDoesNotExist extends ExmlException {
|
||||
/**
|
||||
* Generate Unique ID for serialization
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public ExmlNodeDoesNotExist(final String data) {
|
||||
super(data);
|
||||
}
|
||||
|
||||
}
|
68
src/org/atriasoft/exml/internal/Log.java
Normal file
68
src/org/atriasoft/exml/internal/Log.java
Normal file
@ -0,0 +1,68 @@
|
||||
package org.atriasoft.exml.internal;
|
||||
|
||||
import io.scenarium.logger.LogLevel;
|
||||
import io.scenarium.logger.Logger;
|
||||
|
||||
public class Log {
|
||||
private static final String LIB_NAME = "exml";
|
||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
|
||||
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
|
||||
private static final boolean PRINT_ERROR = Logger.getNeedPrint(LIB_NAME, LogLevel.ERROR);
|
||||
private static final boolean PRINT_WARNING = Logger.getNeedPrint(LIB_NAME, LogLevel.WARNING);
|
||||
private static final boolean PRINT_INFO = Logger.getNeedPrint(LIB_NAME, LogLevel.INFO);
|
||||
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
|
||||
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LIB_NAME, LogLevel.VERBOSE);
|
||||
private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
|
||||
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
|
||||
|
||||
public static void critical(final String data) {
|
||||
if (PRINT_CRITICAL) {
|
||||
Logger.critical(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void debug(final String data) {
|
||||
if (PRINT_DEBUG) {
|
||||
Logger.debug(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void error(final String data) {
|
||||
if (PRINT_ERROR) {
|
||||
Logger.error(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void info(final String data) {
|
||||
if (PRINT_INFO) {
|
||||
Logger.info(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void print(final String data) {
|
||||
if (PRINT_PRINT) {
|
||||
Logger.print(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void todo(final String data) {
|
||||
if (PRINT_TODO) {
|
||||
Logger.todo(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void verbose(final String data) {
|
||||
if (PRINT_VERBOSE) {
|
||||
Logger.verbose(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void warning(final String data) {
|
||||
if (PRINT_WARNING) {
|
||||
Logger.warning(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
private Log() {}
|
||||
|
||||
}
|
1
test/.gitignore
vendored
Normal file
1
test/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/bin/
|
44
test/src/test/atriasoft/exml/ExmlLocal.java
Normal file
44
test/src/test/atriasoft/exml/ExmlLocal.java
Normal file
@ -0,0 +1,44 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.Document;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
class ExmlLocal {
|
||||
// _errorPos : -1 : no error , 1 : parsing error, 2 generation error, 3 comparaison error ????
|
||||
public static void test(final String _ref, final String _input, final int _errorPos) {
|
||||
test(_ref, _input, _errorPos, false);
|
||||
}
|
||||
|
||||
public static void test(final String _ref, final String _input, final int _errorPos, final boolean _caseInSensitive) {
|
||||
final Document doc = new Document();
|
||||
//doc.setCaseSensitive(!_caseInSensitive);
|
||||
Log.verbose("parse : \n" + _input);
|
||||
final boolean retParse = doc.parse(_input);
|
||||
if (_errorPos == 1) {
|
||||
Assertions.assertEquals(retParse, false);
|
||||
return;
|
||||
} else {
|
||||
Assertions.assertEquals(retParse, true);
|
||||
}
|
||||
final StringBuilder out = new StringBuilder();
|
||||
final boolean retGenerate = doc.generate(out);
|
||||
if (_errorPos == 2) {
|
||||
Assertions.assertEquals(retGenerate, false);
|
||||
return;
|
||||
} else {
|
||||
Assertions.assertEquals(retGenerate, true);
|
||||
}
|
||||
final String data = out.toString();
|
||||
if (_errorPos == 3) {
|
||||
Assertions.assertNotEquals(_ref, data);
|
||||
return;
|
||||
} else {
|
||||
Assertions.assertEquals(_ref, data);
|
||||
}
|
||||
}
|
||||
}
|
73
test/src/test/atriasoft/exml/ExmlTestAll.java
Normal file
73
test/src/test/atriasoft/exml/ExmlTestAll.java
Normal file
@ -0,0 +1,73 @@
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestAll {
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBase() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test( "<exemple>\n"
|
||||
+ " <ex2 ploppp-plpl:erer=\"dfsdfsdfsdf\" lkmjmlk=\"156235\" sdfsdf=\"456321\"/>\n"
|
||||
+ " <exlkjl-_dsfg./>\n"
|
||||
+ " <ex2>Text example ...</ex2>\n"
|
||||
+ "</exemple>\n",
|
||||
"< exemple\n >\n"
|
||||
+ " <ex2 ploppp-plpl:erer=\"dfsdfsdfsdf\" lkmjmlk=\"156235\" sdfsdf=456321 />\n"
|
||||
+ " <exlkjl-_dsfg./>\n"
|
||||
+ " <ex2>\n"
|
||||
+ " Text example ...\n"
|
||||
+ " </ex2>\n"
|
||||
+ "</exemple>\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCaseSensitive() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test( "<exemple>\n"
|
||||
+" <ex2 ploppp-plpl:erer=\"dfsdfsdfsdf\" lkmjmlk=\"156235\" sdfsdf=\"456321\"/>\n"
|
||||
+" <exlkjl-_dsfg./>\n"
|
||||
+" <ex2>Text example ...</ex2>\n"
|
||||
+"</exemple>\n",
|
||||
"< exemple\n >\n"
|
||||
+" <ex2 ploppp-plpl:erer=\"dfsdfsdfsdf\" lkmjmlk=\"156235\" sdfsdf=456321 />\n"
|
||||
+" <exlkjl-_dsfg./>\n"
|
||||
+" <ex2>\n"
|
||||
+" Text example ...\n"
|
||||
+" </ex2>\n"
|
||||
+"</exemple>\n",
|
||||
-1,
|
||||
false);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testError() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test( "",
|
||||
"< exemple\n >\n"
|
||||
+" <ex2 ploppp-plpl:erer=\"dfsdfsdfsdf\" lkmjmlk=\"156235\" sdfsdf=456321 />\n"
|
||||
+" <exlkjl-_dsfg./> >\n"
|
||||
+" <ex2>\n"
|
||||
+" Text example ...\n"
|
||||
+" </ex2>\n"
|
||||
+"</exemple>\n",
|
||||
1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
}
|
170
test/src/test/atriasoft/exml/ExmlTestAttribute.java
Normal file
170
test/src/test/atriasoft/exml/ExmlTestAttribute.java
Normal file
@ -0,0 +1,170 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2021, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.Attribute;
|
||||
import org.atriasoft.exml.Document;
|
||||
import org.atriasoft.exml.Element;
|
||||
import org.atriasoft.exml.NodeType;
|
||||
import org.atriasoft.exml.exception.ExmlAttributeDoesNotExist;
|
||||
import org.atriasoft.exml.exception.ExmlNodeDoesNotExist;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestAttribute {
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void AttributeElementNotExist() {
|
||||
final Element myElement = new Element("NodeName");
|
||||
Assertions.assertThrows(ExmlAttributeDoesNotExist.class, () -> myElement.getAttr(65465465));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clear() {
|
||||
|
||||
final Attribute myAttribute = new Attribute("nameAttribute", "valueAttribute");
|
||||
myAttribute.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void create() {
|
||||
|
||||
final Attribute myAttribute = new Attribute("nameAttribute", "valueAttribute");
|
||||
Assertions.assertEquals(myAttribute.getType(), NodeType.attribute);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createAssignement() {
|
||||
final Attribute myAttribute = new Attribute("nameAttribute", "valueAttribute");
|
||||
final Attribute myOtherAttribute = myAttribute.clone();
|
||||
Assertions.assertEquals(myAttribute.getValue(), myOtherAttribute.getValue());
|
||||
Assertions.assertEquals(myAttribute.getName(), myOtherAttribute.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createCopy() {
|
||||
final Attribute myAttribute = new Attribute("nameAttribute", "valueAttribute");
|
||||
final Attribute myOtherAttribute = new Attribute(myAttribute);
|
||||
Assertions.assertEquals(myAttribute.getValue(), myOtherAttribute.getValue());
|
||||
Assertions.assertEquals(myAttribute.getName(), myOtherAttribute.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exist() {
|
||||
|
||||
final Element elem = new Element("elem");
|
||||
elem.setAttribute("valA", "plop");
|
||||
Assertions.assertEquals(elem.existAttribute("valA"), true);
|
||||
Assertions.assertEquals(elem.existAttribute("qsdfsdf"), false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void get() {
|
||||
|
||||
final Element elem = new Element("elem");
|
||||
elem.setAttribute("valA", "plop");
|
||||
try {
|
||||
Assertions.assertEquals(elem.getAttribute("valA"), "plop");
|
||||
} catch (final ExmlAttributeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
Assertions.assertThrows(ExmlAttributeDoesNotExist.class, () -> elem.getAttribute("qsdfsdf"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getpair() {
|
||||
|
||||
final Element elem = new Element("elem");
|
||||
elem.setAttribute("valA", "coucou");
|
||||
try {
|
||||
Assertions.assertEquals(elem.getAttrPair(0).first, "valA");
|
||||
Assertions.assertEquals(elem.getAttrPair(0).second, "coucou");
|
||||
} catch (final ExmlAttributeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
Assertions.assertThrows(ExmlAttributeDoesNotExist.class, () -> elem.getAttrPair(1));
|
||||
Assertions.assertThrows(ExmlAttributeDoesNotExist.class, () -> elem.getAttrPair(-1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void moveInAllElement() {
|
||||
final Document doc = new Document();
|
||||
doc.parse("<elem valA=\"plop\"/>");
|
||||
Element elem;
|
||||
try {
|
||||
elem = (Element) doc.getNode("elem");
|
||||
} catch (final ExmlNodeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
return;
|
||||
}
|
||||
for (final Attribute it : elem.getAttributes()) {
|
||||
Assertions.assertEquals(it.getName(), "valA");
|
||||
Assertions.assertEquals(it.getValue(), "plop");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void remove() {
|
||||
final Element elem = new Element("elem");
|
||||
elem.setAttribute("valA", "plop");
|
||||
Assertions.assertEquals(elem.existAttribute("valA"), true);
|
||||
elem.removeAttribute("valA");
|
||||
Assertions.assertEquals(elem.existAttribute("valA"), false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setGetName() {
|
||||
|
||||
final Attribute myAttribute = new Attribute("nameAttribute", "valueAttribute");
|
||||
Assertions.assertEquals(myAttribute.getName(), "nameAttribute");
|
||||
myAttribute.setName("newName");
|
||||
Assertions.assertEquals(myAttribute.getName(), "newName");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setGetValue() {
|
||||
|
||||
final Attribute myAttribute = new Attribute("nameAttribute", "valueAttribute");
|
||||
Assertions.assertEquals(myAttribute.getValue(), "valueAttribute");
|
||||
myAttribute.setValue("new value");
|
||||
Assertions.assertEquals(myAttribute.getValue(), "new value");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setterNew() {
|
||||
|
||||
final Element elem = new Element("elem");
|
||||
elem.setAttribute("valA", "coucou");
|
||||
try {
|
||||
Assertions.assertEquals(elem.getAttribute("valA"), "coucou");
|
||||
} catch (final ExmlAttributeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setterRewrite() {
|
||||
|
||||
final Element elem = new Element("elem");
|
||||
elem.setAttribute("valA", "coucou");
|
||||
try {
|
||||
Assertions.assertEquals(elem.getAttribute("valA"), "coucou");
|
||||
} catch (final ExmlAttributeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
elem.setAttribute("valA", "coucou2");
|
||||
try {
|
||||
Assertions.assertEquals(elem.getAttribute("valA"), "coucou2");
|
||||
} catch (final ExmlAttributeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
}
|
||||
}
|
35
test/src/test/atriasoft/exml/ExmlTestCData.java
Normal file
35
test/src/test/atriasoft/exml/ExmlTestCData.java
Normal file
@ -0,0 +1,35 @@
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.Document;
|
||||
import org.atriasoft.exml.Element;
|
||||
import org.atriasoft.exml.TextCDATA;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestCData {
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generate() {
|
||||
final Document doc = new Document();
|
||||
doc.append(new TextCDATA("Text &é<>examp]le]] ..."));
|
||||
doc.append(new TextCDATA("Text &é<>examp]le]] ..."));
|
||||
final String out = doc.getText();
|
||||
doc.parse("<elem><![CDATA[Text &é<>examp]le]] ...]]></elem>");
|
||||
Assertions.assertEquals("<![CDATA[Text &é<>examp]le]] ...]]><![CDATA[Text &é<>examp]le]] ...]]>", out);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseCDATA() {
|
||||
final Document doc = new Document();
|
||||
doc.parse("<elem><![CDATA[Text &é<>examp]le]] ...]]></elem>");
|
||||
final Element elem = Assertions.assertDoesNotThrow(() -> {
|
||||
return (Element) doc.getNode("elem");
|
||||
});
|
||||
Assertions.assertEquals("Text &é<>examp]le]] ...", elem.getText());
|
||||
}
|
||||
}
|
48
test/src/test/atriasoft/exml/ExmlTestComment.java
Normal file
48
test/src/test/atriasoft/exml/ExmlTestComment.java
Normal file
@ -0,0 +1,48 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.Comment;
|
||||
import org.atriasoft.exml.Node;
|
||||
import org.atriasoft.exml.NodeType;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestComment {
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void create() {
|
||||
final Comment myComment = new Comment("my Comment");
|
||||
Assertions.assertEquals(myComment.getType(), NodeType.comment);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createAssignement() {
|
||||
final Comment myComment = new Comment("my comment");
|
||||
final Comment myOtherComment = myComment.clone();
|
||||
Assertions.assertEquals(myComment.getValue(), myOtherComment.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createCopy() {
|
||||
final Comment myComment = new Comment("my Comment");
|
||||
final Comment myOtherComment = new Comment(myComment);
|
||||
Assertions.assertEquals(myComment.getValue(), myOtherComment.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void transform() {
|
||||
Comment myComment = new Comment("my comment");
|
||||
final Node myNode = myComment;
|
||||
myComment = myNode.toComment();
|
||||
Assertions.assertEquals(myComment.getValue(), "my comment");
|
||||
}
|
||||
}
|
62
test/src/test/atriasoft/exml/ExmlTestDeclarationXML.java
Normal file
62
test/src/test/atriasoft/exml/ExmlTestDeclarationXML.java
Normal file
@ -0,0 +1,62 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.DeclarationXML;
|
||||
import org.atriasoft.exml.NodeType;
|
||||
import org.atriasoft.exml.exception.ExmlAttributeDoesNotExist;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestDeclarationXML {
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void create() {
|
||||
final DeclarationXML myDeclarationXML = new DeclarationXML("1.0", "UTF-8", true);
|
||||
Assertions.assertEquals(myDeclarationXML.getType(), NodeType.declaration);
|
||||
try {
|
||||
Assertions.assertEquals(myDeclarationXML.getAttribute("version"), "1.0");
|
||||
Assertions.assertEquals(myDeclarationXML.getAttribute("encoding"), "UTF-8");
|
||||
Assertions.assertEquals(myDeclarationXML.getAttribute("standalone"), "true");
|
||||
} catch (final ExmlAttributeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createAssignement() {
|
||||
|
||||
final DeclarationXML myDeclarationXML = new DeclarationXML("1.0", "UTF-8", true);
|
||||
final DeclarationXML myOtherDeclarationXML = myDeclarationXML.clone();
|
||||
Assertions.assertEquals(myDeclarationXML.getValue(), myOtherDeclarationXML.getValue());
|
||||
try {
|
||||
Assertions.assertEquals(myDeclarationXML.getAttribute("version"), myOtherDeclarationXML.getAttribute("version"));
|
||||
Assertions.assertEquals(myDeclarationXML.getAttribute("encoding"), myOtherDeclarationXML.getAttribute("encoding"));
|
||||
Assertions.assertEquals(myDeclarationXML.getAttribute("standalone"), myOtherDeclarationXML.getAttribute("standalone"));
|
||||
} catch (final ExmlAttributeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createCopy() {
|
||||
final DeclarationXML myDeclarationXML = new DeclarationXML("1.0", "UTF-8", true);
|
||||
final DeclarationXML myOtherDeclarationXML = new DeclarationXML(myDeclarationXML);
|
||||
Assertions.assertEquals(myDeclarationXML.getValue(), myOtherDeclarationXML.getValue());
|
||||
try {
|
||||
Assertions.assertEquals(myDeclarationXML.getAttribute("version"), myOtherDeclarationXML.getAttribute("version"));
|
||||
Assertions.assertEquals(myDeclarationXML.getAttribute("encoding"), myOtherDeclarationXML.getAttribute("encoding"));
|
||||
Assertions.assertEquals(myDeclarationXML.getAttribute("standalone"), myOtherDeclarationXML.getAttribute("standalone"));
|
||||
} catch (final ExmlAttributeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
}
|
||||
}
|
127
test/src/test/atriasoft/exml/ExmlTestElement.java
Normal file
127
test/src/test/atriasoft/exml/ExmlTestElement.java
Normal file
@ -0,0 +1,127 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.atriasoft.exml.Document;
|
||||
import org.atriasoft.exml.Element;
|
||||
import org.atriasoft.exml.Node;
|
||||
import org.atriasoft.exml.NodeType;
|
||||
import org.atriasoft.exml.exception.ExmlNodeDoesNotExist;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestElement {
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void append() {
|
||||
final Element myElement = new Element("NodeName");
|
||||
Assertions.assertEquals(myElement.getNodes().size(), 0);
|
||||
myElement.append(new Element("jkjhkjhkh"));
|
||||
Assertions.assertEquals(myElement.getNodes().size(), 1);
|
||||
try {
|
||||
myElement.getNode("jkjhkjhkh");
|
||||
} catch (final ExmlNodeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
Assertions.assertEquals(myElement.getNodes().size(), 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clear() {
|
||||
final Element myElement = new Element("NodeName");
|
||||
Assertions.assertEquals(myElement.getNodes().size(), 0);
|
||||
myElement.append(new Element("jkjhkjhkh"));
|
||||
Assertions.assertEquals(myElement.getNodes().size(), 1);
|
||||
try {
|
||||
myElement.getNode("jkjhkjhkh");
|
||||
} catch (final ExmlNodeDoesNotExist e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
Assertions.assertEquals(myElement.getNodes().size(), 1);
|
||||
myElement.clear();
|
||||
Assertions.assertEquals(myElement.getNodes().size(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void create() {
|
||||
final Element myElement = new Element("NodeName");
|
||||
Assertions.assertEquals(myElement.getType(), NodeType.element);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createAssignement() {
|
||||
final Element myElement = new Element("NodeName");
|
||||
try {
|
||||
final Element myOtherElement = myElement.clone();
|
||||
Assertions.assertEquals(myElement.getValue(), myOtherElement.getValue());
|
||||
} catch (final CloneNotSupportedException e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createCopy() {
|
||||
final Element myElement = new Element("NodeName");
|
||||
try {
|
||||
final Element myOtherElement = new Element(myElement);
|
||||
Assertions.assertEquals(myElement.getValue(), myOtherElement.getValue());
|
||||
} catch (final CloneNotSupportedException e) {
|
||||
Assertions.fail("Should Not have thrown an exception");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getNamed() {
|
||||
|
||||
final Element myElement = new Element("NodeName");
|
||||
Assertions.assertEquals(myElement.existNode("jkjhkjhkh"), false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getNodeId() {
|
||||
final Element myElement = new Element("NodeName");
|
||||
Assertions.assertEquals(false, myElement.existNode(465));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getText1() {
|
||||
|
||||
final Element myElement = new Element("NodeName");
|
||||
Assertions.assertEquals("", myElement.getText());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getText2() {
|
||||
|
||||
final Element myElement = new Element("NodeName");
|
||||
myElement.append(new Element("jkjhkjhkh"));
|
||||
Assertions.assertEquals("<jkjhkjhkh/>\n", myElement.getText());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTypeId() {
|
||||
final Element myElement = new Element("NodeName");
|
||||
Assertions.assertEquals(NodeType.unknow, myElement.getType(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void moveInAllElement() {
|
||||
final Document doc = new Document();
|
||||
doc.parse("<elem><elem1/><elem2/></elem>");
|
||||
for (final Node it : doc.getNodes()) {
|
||||
final Element elem = (Element) it;
|
||||
Assertions.assertEquals("elem", elem.getValue());
|
||||
Assertions.assertEquals(2, elem.getNodes().size());
|
||||
Assertions.assertEquals(2, elem.size());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
115
test/src/test/atriasoft/exml/ExmlTestParseAttribute.java
Normal file
115
test/src/test/atriasoft/exml/ExmlTestParseAttribute.java
Normal file
@ -0,0 +1,115 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestParseAttribute {
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBase() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<elementtt attr=\"plop\"/>\n",
|
||||
"<elementtt attr=\"plop\"/>\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyAttribute() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<elementtt attr=\"\"/>\n",
|
||||
"<elementtt attr=\"\"/>\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmptyAttributeNoQuote() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<elementtt attr=\"\"/>\n",
|
||||
"<elementtt attr=/>\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEndAttributeError() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("",
|
||||
"<elementtt attr",
|
||||
1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEndAttributeErrorMissingEqual() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("",
|
||||
"<elementtt attr \"kjlkj\"/>\n",
|
||||
1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiline() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<elementtt attr=\"plop\"/>\n",
|
||||
"<elementtt attr\n=\n\"plop\"/>\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultilineNoQuote() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<elementtt attr=\"plop\"/>\n",
|
||||
"<elementtt attr \n = \n\t plop/>\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoQuote() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<elementtt attr=\"plop\"/>\n",
|
||||
"<elementtt attr=plop/>\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoQuoteNumber() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<elementtt attr=\"234345@3452345_.'\"/>\n",
|
||||
"<elementtt attr=234345@3452345_.' />\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpace1() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<elementtt attr=\"plop\"/>\n",
|
||||
"<elementtt attr =\"plop\"/>\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpace2() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<elementtt attr=\"plop\"/>\n",
|
||||
"<elementtt attr= \"plop\"/>\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
}
|
60
test/src/test/atriasoft/exml/ExmlTestParseComment.java
Normal file
60
test/src/test/atriasoft/exml/ExmlTestParseComment.java
Normal file
@ -0,0 +1,60 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestParseComment {
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAll() {
|
||||
//@formatter:off
|
||||
ExmlLocal.test("<!--<.:!*%^$0945- '(- &<<< >>> '& ( '( '-' <elementPouris>-->\n",
|
||||
"<!-- <.:!*%^$0945- '(- &<<< >>> '& ( '( '-' <elementPouris> -->\n",
|
||||
-1);
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBase() {
|
||||
ExmlLocal.test("<!--exemple-->\n", "<!--exemple-->\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEndError() {
|
||||
ExmlLocal.test("<!--exemple-->\n", "<!-- ssdfgdfg >\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiline() {
|
||||
ExmlLocal.test("<!--exemple-->\n", "<!-- \t \t\t exemple \n\n\n\t-->\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleEnd() {
|
||||
ExmlLocal.test("<!--exemple-->\n", "<!-- ---> exemple -->\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoCharInComment() {
|
||||
ExmlLocal.test("<!---->\n", "<!---->\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTiretInComment() {
|
||||
ExmlLocal.test("<!---- exemple-->\n", "<!-- -- exemple -->\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWrongEndParsing() {
|
||||
ExmlLocal.test("<!--> exemple-->\n", "<!--> exemple -->\n", -1);
|
||||
}
|
||||
}
|
56
test/src/test/atriasoft/exml/ExmlTestParseDeclaration.java
Normal file
56
test/src/test/atriasoft/exml/ExmlTestParseDeclaration.java
Normal file
@ -0,0 +1,56 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestParseDeclaration {
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAll() {
|
||||
ExmlLocal.test("<?xml attr=\"p65421lop\"?>\n", "<?xml attr \n = \n\t p65421lop?>\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAttribute() {
|
||||
ExmlLocal.test("<?xml attr=\"plop\"?>\n", "<?xml attr=\"plop\"?>\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBase() {
|
||||
ExmlLocal.test("<?testDeclaration?>\n", "<?testDeclaration?>\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiline() {
|
||||
ExmlLocal.test("<?xml attr=\"plop\"?>\n", "<?xml attr\n=\n\"plop\"?>\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoQuote() {
|
||||
ExmlLocal.test("<?xml attr=\"plop\"?>\n", "<?xml attr=plop?>\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNumberNoQuote() {
|
||||
ExmlLocal.test("<?xml attr=\"234345@3452345_.'\"?>\n", "<?xml attr=234345@3452345_.' ?>\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpace1() {
|
||||
ExmlLocal.test("<?xml attr=\"plop\"?>\n", "<?xml attr =\"plop\"?>\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpace2() {
|
||||
ExmlLocal.test("<?xml attr=\"plop\"?>\n", "<?xml attr= \"plop\"?>\n", -1);
|
||||
}
|
||||
}
|
84
test/src/test/atriasoft/exml/ExmlTestParseElement.java
Normal file
84
test/src/test/atriasoft/exml/ExmlTestParseElement.java
Normal file
@ -0,0 +1,84 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2014, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ExmlTestParseElement {
|
||||
static String refOutputElement = "<exemple/>\n";
|
||||
|
||||
@BeforeAll
|
||||
public static void beforeClass() {
|
||||
Log.verbose("----------------------------------------------------------------");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBase() {
|
||||
ExmlLocal.test(refOutputElement, "<exemple/>\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBase2() {
|
||||
ExmlLocal.test("<exemple--/>\n", "<exemple-->\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBase3() {
|
||||
ExmlLocal.test("<exemple/>\n", "<exemple>\n</exemple sdfgsdfg>\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDotPresent() {
|
||||
ExmlLocal.test(refOutputElement, "< . exemple < />\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExclamationPresence() {
|
||||
ExmlLocal.test(refOutputElement, "< exemple ? />\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiline() {
|
||||
ExmlLocal.test(refOutputElement, "< \t\r exemple/>\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultilineMultiTabbed() {
|
||||
ExmlLocal.test(refOutputElement, "< \t\r exemple \t\r\r\r\n \t\t />\n", -1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleSlash() {
|
||||
ExmlLocal.test(refOutputElement, "< exemple / />\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStarPresence() {
|
||||
ExmlLocal.test(refOutputElement, "< exemple * />\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWrong1() {
|
||||
ExmlLocal.test(refOutputElement, "<! exemple < />\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWrong2() {
|
||||
ExmlLocal.test(refOutputElement, "<!- exemple < />\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWrong3() {
|
||||
ExmlLocal.test(refOutputElement, "< exemple < />\n", 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWrongStart() {
|
||||
ExmlLocal.test(refOutputElement, "< exemple < >\n", 1);
|
||||
}
|
||||
}
|
68
test/src/test/atriasoft/exml/Log.java
Normal file
68
test/src/test/atriasoft/exml/Log.java
Normal file
@ -0,0 +1,68 @@
|
||||
package test.atriasoft.exml;
|
||||
|
||||
import io.scenarium.logger.LogLevel;
|
||||
import io.scenarium.logger.Logger;
|
||||
|
||||
public class Log {
|
||||
private static final String LIB_NAME = "exml-test";
|
||||
private static final String LIB_NAME_DRAW = Logger.getDrawableName(LIB_NAME);
|
||||
private static final boolean PRINT_CRITICAL = Logger.getNeedPrint(LIB_NAME, LogLevel.CRITICAL);
|
||||
private static final boolean PRINT_ERROR = Logger.getNeedPrint(LIB_NAME, LogLevel.ERROR);
|
||||
private static final boolean PRINT_WARNING = Logger.getNeedPrint(LIB_NAME, LogLevel.WARNING);
|
||||
private static final boolean PRINT_INFO = Logger.getNeedPrint(LIB_NAME, LogLevel.INFO);
|
||||
private static final boolean PRINT_DEBUG = Logger.getNeedPrint(LIB_NAME, LogLevel.DEBUG);
|
||||
private static final boolean PRINT_VERBOSE = Logger.getNeedPrint(LIB_NAME, LogLevel.VERBOSE);
|
||||
private static final boolean PRINT_TODO = Logger.getNeedPrint(LIB_NAME, LogLevel.TODO);
|
||||
private static final boolean PRINT_PRINT = Logger.getNeedPrint(LIB_NAME, LogLevel.PRINT);
|
||||
|
||||
public static void critical(final String data) {
|
||||
if (PRINT_CRITICAL) {
|
||||
Logger.critical(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void debug(final String data) {
|
||||
if (PRINT_DEBUG) {
|
||||
Logger.debug(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void error(final String data) {
|
||||
if (PRINT_ERROR) {
|
||||
Logger.error(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void info(final String data) {
|
||||
if (PRINT_INFO) {
|
||||
Logger.info(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void print(final String data) {
|
||||
if (PRINT_PRINT) {
|
||||
Logger.print(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void todo(final String data) {
|
||||
if (PRINT_TODO) {
|
||||
Logger.todo(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void verbose(final String data) {
|
||||
if (PRINT_VERBOSE) {
|
||||
Logger.verbose(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
public static void warning(final String data) {
|
||||
if (PRINT_WARNING) {
|
||||
Logger.warning(LIB_NAME_DRAW, data);
|
||||
}
|
||||
}
|
||||
|
||||
private Log() {}
|
||||
|
||||
}
|
1
version.txt
Normal file
1
version.txt
Normal file
@ -0,0 +1 @@
|
||||
0.1.0
|
Loading…
x
Reference in New Issue
Block a user