react-native-nitro-xlsx 0.1.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NitroXlsx.podspec +27 -27
- package/Package.swift +35 -10
- package/README.md +220 -58
- package/android/CMakeLists.txt +24 -27
- package/android/cpp-adapter.cpp +12 -0
- package/android/src/main/java/com/margelo/nitro/xlsx/NitroXlsxPackage.kt +9 -0
- package/cpp/HybridNitroXlsx.cpp +25 -179
- package/cpp/HybridNitroXlsx.hpp +2 -2
- package/cpp/HybridXlsxConditionalFormat.cpp +252 -0
- package/cpp/HybridXlsxConditionalFormat.hpp +62 -0
- package/cpp/HybridXlsxConditionalFormats.cpp +46 -0
- package/cpp/HybridXlsxConditionalFormats.hpp +28 -0
- package/cpp/HybridXlsxWorkbook.cpp +159 -196
- package/cpp/HybridXlsxWorkbook.hpp +7 -2
- package/cpp/HybridXlsxWorksheet.cpp +433 -62
- package/cpp/HybridXlsxWorksheet.hpp +73 -26
- package/cpp/XlsxCacheDir.cpp +76 -0
- package/cpp/XlsxCacheDir.hpp +27 -0
- package/cpp/XlsxError.hpp +68 -0
- package/cpp/XlsxJson.cpp +185 -0
- package/cpp/XlsxJson.hpp +36 -0
- package/ios/XlsxCacheDir.mm +60 -0
- package/nitrogen/generated/android/NitroXlsx+autolinking.cmake +2 -0
- package/nitrogen/generated/shared/c++/HybridNitroXlsxSpec.hpp +5 -3
- package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatSpec.cpp +54 -0
- package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatSpec.hpp +95 -0
- package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatsSpec.cpp +24 -0
- package/nitrogen/generated/shared/c++/HybridXlsxConditionalFormatsSpec.hpp +68 -0
- package/nitrogen/generated/shared/c++/HybridXlsxWorkbookSpec.cpp +3 -0
- package/nitrogen/generated/shared/c++/HybridXlsxWorkbookSpec.hpp +6 -1
- package/nitrogen/generated/shared/c++/HybridXlsxWorksheetSpec.cpp +47 -19
- package/nitrogen/generated/shared/c++/HybridXlsxWorksheetSpec.hpp +52 -20
- package/package.json +3 -3
- package/scripts/run-cpp-tests.sh +14 -0
- package/src/__mocks__/react-native-nitro-modules.ts +1 -0
- package/src/__tests__/index.test.ts +76 -7
- package/src/index.ts +107 -18
- package/src/specs/NitroXlsx.nitro.ts +141 -44
- package/thirdparty/OpenXLSX/.clang-format +118 -0
- package/thirdparty/OpenXLSX/.clang-tidy +28 -0
- package/thirdparty/OpenXLSX/.gitignore +130 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_before_XMLNode_wrappers +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_and_stripping +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_char_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespace_support +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-07-29-benchmarks_with_XMLNode_wrappers_and_namespaced_name_disabled +49 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-11-benchmarks_post-XLCellIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-08-14-benchmarks_post-default-row-column-style-support +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-09-02-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-19-benchmarks +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2024-12-30-benchmarks-post-XLSharedStrings-by-ref +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-09-benchmarks-post-conditionalFormatsAndSheetProtection +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-10-benchmarks-post-XLCellValue-bugfix +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-01-31-benchmarks-post-XLComments-implementation +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-02-02-benchmarks-post-XLRowIterator-Rework +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-07-20-benchmarks-after-hiding-pugixml-internals +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/2025-08-29-benchmarks-after-code-review-with-libzip +46 -0
- package/thirdparty/OpenXLSX/Benchmarks/Benchmark.cpp +249 -0
- package/thirdparty/OpenXLSX/Benchmarks/CMakeLists.txt +19 -0
- package/thirdparty/OpenXLSX/CMakeLists.txt +466 -0
- package/thirdparty/OpenXLSX/Documentation/CMakeLists.txt +31 -0
- package/thirdparty/OpenXLSX/Documentation/Doxyfile.in +2471 -0
- package/thirdparty/OpenXLSX/Documentation/DoxygenLayout.xml +194 -0
- package/thirdparty/OpenXLSX/Documentation/customdoxygen.css +1355 -0
- package/thirdparty/OpenXLSX/Examples/CMakeLists.txt +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo1.cpp +279 -0
- package/thirdparty/OpenXLSX/Examples/Demo10.cpp +545 -0
- package/thirdparty/OpenXLSX/Examples/Demo1A.cpp +137 -0
- package/thirdparty/OpenXLSX/Examples/Demo2.cpp +65 -0
- package/thirdparty/OpenXLSX/Examples/Demo3.cpp +89 -0
- package/thirdparty/OpenXLSX/Examples/Demo4.cpp +86 -0
- package/thirdparty/OpenXLSX/Examples/Demo5.cpp +77 -0
- package/thirdparty/OpenXLSX/Examples/Demo6.cpp +103 -0
- package/thirdparty/OpenXLSX/Examples/Demo7.cpp +79 -0
- package/thirdparty/OpenXLSX/Examples/Demo8.cpp +117 -0
- package/thirdparty/OpenXLSX/Examples/Demo9.cpp +363 -0
- package/thirdparty/OpenXLSX/Examples/cmake/FindLIBZIP.cmake +61 -0
- package/thirdparty/OpenXLSX/Examples/external/CustomZip/CustomZip.hpp +256 -0
- package/thirdparty/OpenXLSX/LICENSE.md +29 -0
- package/thirdparty/OpenXLSX/Makefile.GNU +530 -0
- package/thirdparty/OpenXLSX/Notes/TBDs.txt +16 -0
- package/thirdparty/OpenXLSX/Notes/confirmed-TBCs.txt +8 -0
- package/thirdparty/OpenXLSX/Notes/styles-missing-support.xml +12 -0
- package/thirdparty/OpenXLSX/Notes/todo-list.txt +108 -0
- package/thirdparty/OpenXLSX/OpenXLSX/CMakeLists.txt +631 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSX.hpp +63 -0
- package/thirdparty/OpenXLSX/OpenXLSX/OpenXLSXConfig.cmake +11 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/bundle_static_library.cmake +198 -0
- package/thirdparty/OpenXLSX/OpenXLSX/cmake/patch_pkg_config.cmake +69 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/IZipArchive.hpp +361 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/OpenXLSX-Exports.hpp +12 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCell.hpp +367 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellIterator.hpp +252 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellRange.hpp +223 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellReference.hpp +317 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCellValue.hpp +793 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColor.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLColumn.hpp +159 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLCommandQuery.hpp +228 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLComments.hpp +270 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLConstants.hpp +18 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLContentTypes.hpp +264 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDateTime.hpp +175 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDocument.hpp +505 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLDrawing.hpp +452 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLException.hpp +161 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLFormula.hpp +375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLIterator.hpp +40 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLMergeCells.hpp +216 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLProperties.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRelationships.hpp +348 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRow.hpp +721 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLRowData.hpp +488 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSharedStrings.hpp +204 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLSheet.hpp +1640 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLStyles.hpp +2390 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLTables.hpp +132 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLWorkbook.hpp +404 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlData.hpp +283 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlFile.hpp +194 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParser.hpp +282 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLXmlParserForwardDeclarations.hpp +85 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/XLZipArchive.hpp +232 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/LibZip.hpp +447 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/OpenXLSXFileSystemTools.hpp +207 -0
- package/thirdparty/OpenXLSX/OpenXLSX/headers/detail/Zippy.hpp +1375 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCell.cpp +340 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellIterator.cpp +427 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellRange.cpp +221 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellReference.cpp +408 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLCellValue.cpp +519 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColor.cpp +202 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLColumn.cpp +141 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLComments.cpp +637 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLContentTypes.cpp +329 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDateTime.cpp +269 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDocument.cpp +1678 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLDrawing.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLFormula.cpp +201 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLMergeCells.cpp +357 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLProperties.cpp +810 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRelationships.cpp +529 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRow.cpp +918 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLRowData.cpp +508 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSharedStrings.cpp +220 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLSheet.cpp +1970 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLStyles.cpp +3014 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLTables.cpp +125 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLWorkbook.cpp +784 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlData.cpp +247 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlFile.cpp +160 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLXmlParser.cpp +261 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/XLZipArchive.cpp +266 -0
- package/thirdparty/OpenXLSX/OpenXLSX/sources/utilities/XLUtilities.hpp +478 -0
- package/thirdparty/OpenXLSX/README.md +1279 -0
- package/thirdparty/OpenXLSX/Scripts/cmake-cleanup.sh +102 -0
- package/thirdparty/OpenXLSX/Scripts/compile.sh +23 -0
- package/thirdparty/OpenXLSX/Scripts/demos-cleanup.sh +25 -0
- package/thirdparty/OpenXLSX/Scripts/demos-run-all.sh +60 -0
- package/thirdparty/OpenXLSX/Scripts/guarded-xml-format.sh +47 -0
- package/thirdparty/OpenXLSX/Scripts/make-gnu.sh +11 -0
- package/thirdparty/OpenXLSX/Scripts/uninstall-manifest.sh +48 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format-all.sh +19 -0
- package/thirdparty/OpenXLSX/Scripts/xml-format.sh +38 -0
- package/thirdparty/OpenXLSX/Tests/CMakeLists.txt +37 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch.hpp +17799 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_automake.hpp +68 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_sonarqube.hpp +182 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_tap.hpp +278 -0
- package/thirdparty/OpenXLSX/Tests/catch/catch_reporter_teamcity.hpp +212 -0
- package/thirdparty/OpenXLSX/Tests/main.cpp +55 -0
- package/thirdparty/OpenXLSX/Tests/testXLCell.cpp +176 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellRange.cpp +180 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellReference.cpp +160 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValue.cpp +366 -0
- package/thirdparty/OpenXLSX/Tests/testXLCellValueProxy.cpp +255 -0
- package/thirdparty/OpenXLSX/Tests/testXLColor.cpp +75 -0
- package/thirdparty/OpenXLSX/Tests/testXLDateTime.cpp +229 -0
- package/thirdparty/OpenXLSX/Tests/testXLDocument.cpp +197 -0
- package/thirdparty/OpenXLSX/Tests/testXLFormula.cpp +131 -0
- package/thirdparty/OpenXLSX/Tests/testXLRow.cpp +597 -0
- package/thirdparty/OpenXLSX/Tests/testXLSheet.cpp +77 -0
- package/thirdparty/OpenXLSX/Tests/ziptest-with-libs.cpp +88 -0
- package/thirdparty/OpenXLSX/Tests/ziptest.cpp +735 -0
- package/thirdparty/OpenXLSX/cmake/get-git-HEAD-ID.cmake +45 -0
- package/thirdparty/OpenXLSX/cmake/libopenxlsxCPackOptions.cmake.in +20 -0
- package/thirdparty/OpenXLSX/cmake/manage_dependency.cmake +813 -0
- package/thirdparty/OpenXLSX/cmake/recursive_library_type_test.cmake +52 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-shared.hpp +42 -0
- package/thirdparty/OpenXLSX/gnu-make-crutch/OpenXLSX-Exports-static.hpp +42 -0
- package/thirdparty/OpenXLSX/vcpkg.json +24 -0
- package/thirdparty/README.md +42 -0
- package/thirdparty/miniz/.clang-format +47 -0
- package/thirdparty/miniz/.travis.yml +2 -0
- package/thirdparty/miniz/CMakeLists.txt +333 -0
- package/thirdparty/miniz/CMakePresets.json +31 -0
- package/thirdparty/miniz/ChangeLog.md +272 -0
- package/thirdparty/miniz/Config.cmake.in +1 -0
- package/thirdparty/miniz/LICENSE +22 -0
- package/thirdparty/miniz/amalgamate.sh +57 -0
- package/thirdparty/miniz/examples/example1.c +105 -0
- package/thirdparty/miniz/examples/example2.c +164 -0
- package/thirdparty/miniz/examples/example3.c +269 -0
- package/thirdparty/miniz/examples/example4.c +102 -0
- package/thirdparty/miniz/examples/example5.c +327 -0
- package/thirdparty/miniz/examples/example6.c +189 -0
- package/thirdparty/miniz/meson.build +21 -0
- package/thirdparty/miniz/miniz.c +646 -0
- package/thirdparty/miniz/miniz.h +615 -0
- package/thirdparty/miniz/miniz.pc.in +13 -0
- package/thirdparty/miniz/miniz_common.h +89 -0
- package/thirdparty/miniz/miniz_export.h +20 -0
- package/thirdparty/miniz/miniz_tdef.c +1602 -0
- package/thirdparty/miniz/miniz_tdef.h +199 -0
- package/thirdparty/miniz/miniz_tinfl.c +778 -0
- package/thirdparty/miniz/miniz_tinfl.h +150 -0
- package/thirdparty/miniz/miniz_zip.c +4895 -0
- package/thirdparty/miniz/miniz_zip.h +454 -0
- package/thirdparty/miniz/readme.md +46 -0
- package/thirdparty/miniz/test.sh +36 -0
- package/thirdparty/miniz/tests/add_in_place_fuzzer.c +87 -0
- package/thirdparty/miniz/tests/catch_amalgamated.cpp +10795 -0
- package/thirdparty/miniz/tests/catch_amalgamated.hpp +13143 -0
- package/thirdparty/miniz/tests/checksum_fuzzer.c +26 -0
- package/thirdparty/miniz/tests/compress_fuzzer.c +91 -0
- package/thirdparty/miniz/tests/flush_fuzzer.c +88 -0
- package/thirdparty/miniz/tests/fuzz_main.c +55 -0
- package/thirdparty/miniz/tests/large_fuzzer.c +133 -0
- package/thirdparty/miniz/tests/main.cpp +185 -0
- package/thirdparty/miniz/tests/miniz_tdefl_fuzzer.cc +115 -0
- package/thirdparty/miniz/tests/miniz_tester.cpp +1881 -0
- package/thirdparty/miniz/tests/miniz_zip_validate_fuzzer.cc +71 -0
- package/thirdparty/miniz/tests/miniz_zip_writer_fuzzer.cc +96 -0
- package/thirdparty/miniz/tests/ossfuzz.sh +48 -0
- package/thirdparty/miniz/tests/small_fuzzer.c +126 -0
- package/thirdparty/miniz/tests/timer.cpp +152 -0
- package/thirdparty/miniz/tests/timer.h +40 -0
- package/thirdparty/miniz/tests/uncompress2_fuzzer.c +21 -0
- package/thirdparty/miniz/tests/uncompress_fuzzer.c +30 -0
- package/thirdparty/miniz/tests/zip.dict +9 -0
- package/thirdparty/miniz/tests/zip_fuzzer.c +63 -0
- package/thirdparty/pugixml/.codecov.yml +7 -0
- package/thirdparty/pugixml/.gitattributes +1 -0
- package/thirdparty/pugixml/CMakeLists.txt +330 -0
- package/thirdparty/pugixml/LICENSE.md +24 -0
- package/thirdparty/pugixml/Makefile +98 -0
- package/thirdparty/pugixml/README.md +81 -0
- package/thirdparty/pugixml/SECURITY.md +9 -0
- package/thirdparty/pugixml/appveyor.yml +50 -0
- package/thirdparty/pugixml/docs/config.adoc +7 -0
- package/thirdparty/pugixml/docs/images/dom_tree.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_link2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch2.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch3.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2005_pch4.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link1.png +0 -0
- package/thirdparty/pugixml/docs/images/vs2010_link2.png +0 -0
- package/thirdparty/pugixml/docs/manual.adoc +3326 -0
- package/thirdparty/pugixml/docs/manual.html +6395 -0
- package/thirdparty/pugixml/docs/quickstart.adoc +287 -0
- package/thirdparty/pugixml/docs/quickstart.html +1107 -0
- package/thirdparty/pugixml/docs/samples/character.xml +8 -0
- package/thirdparty/pugixml/docs/samples/custom_memory_management.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/include.cpp +64 -0
- package/thirdparty/pugixml/docs/samples/load_error_handling.cpp +33 -0
- package/thirdparty/pugixml/docs/samples/load_file.cpp +16 -0
- package/thirdparty/pugixml/docs/samples/load_memory.cpp +66 -0
- package/thirdparty/pugixml/docs/samples/load_options.cpp +30 -0
- package/thirdparty/pugixml/docs/samples/load_stream.cpp +97 -0
- package/thirdparty/pugixml/docs/samples/modify_add.cpp +29 -0
- package/thirdparty/pugixml/docs/samples/modify_base.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/modify_remove.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_custom_writer.cpp +116 -0
- package/thirdparty/pugixml/docs/samples/save_declaration.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/save_file.cpp +17 -0
- package/thirdparty/pugixml/docs/samples/save_options.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/save_stream.cpp +18 -0
- package/thirdparty/pugixml/docs/samples/save_subtree.cpp +26 -0
- package/thirdparty/pugixml/docs/samples/text.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/transitions.xml +7 -0
- package/thirdparty/pugixml/docs/samples/traverse_base.cpp +51 -0
- package/thirdparty/pugixml/docs/samples/traverse_iter.cpp +27 -0
- package/thirdparty/pugixml/docs/samples/traverse_predicate.cpp +48 -0
- package/thirdparty/pugixml/docs/samples/traverse_rangefor.cpp +32 -0
- package/thirdparty/pugixml/docs/samples/traverse_walker.cpp +35 -0
- package/thirdparty/pugixml/docs/samples/tree.xml +12 -0
- package/thirdparty/pugixml/docs/samples/weekly-shift_jis.xml +78 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-16.xml +0 -0
- package/thirdparty/pugixml/docs/samples/weekly-utf-8.xml +78 -0
- package/thirdparty/pugixml/docs/samples/xgconsole.xml +12 -0
- package/thirdparty/pugixml/docs/samples/xpath_error.cpp +43 -0
- package/thirdparty/pugixml/docs/samples/xpath_query.cpp +36 -0
- package/thirdparty/pugixml/docs/samples/xpath_select.cpp +28 -0
- package/thirdparty/pugixml/docs/samples/xpath_variables.cpp +38 -0
- package/thirdparty/pugixml/readme.txt +50 -0
- package/thirdparty/pugixml/scripts/archive.py +54 -0
- package/thirdparty/pugixml/scripts/cocoapods_push.sh +4 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml.natvis +77 -0
- package/thirdparty/pugixml/scripts/natvis/pugixml_compact.natvis +506 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml-propertiesui.xml +17 -0
- package/thirdparty/pugixml/scripts/nuget/build/native/pugixml.targets +28 -0
- package/thirdparty/pugixml/scripts/nuget/pugixml.nuspec +20 -0
- package/thirdparty/pugixml/scripts/nuget_build.ps1 +60 -0
- package/thirdparty/pugixml/scripts/premake4.lua +92 -0
- package/thirdparty/pugixml/scripts/pugixml-config.cmake.in +12 -0
- package/thirdparty/pugixml/scripts/pugixml.pc.in +11 -0
- package/thirdparty/pugixml/scripts/pugixml.podspec +14 -0
- package/thirdparty/pugixml/scripts/pugixml.xcodeproj/project.pbxproj +212 -0
- package/thirdparty/pugixml/scripts/pugixml_airplay.mkf +13 -0
- package/thirdparty/pugixml/scripts/pugixml_codeblocks.cbp +44 -0
- package/thirdparty/pugixml/scripts/pugixml_codelite.project +56 -0
- package/thirdparty/pugixml/scripts/pugixml_dll.rc +45 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2005_static.vcproj +343 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2008_static.vcproj +339 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2010_static.vcxproj +191 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2013_static.vcxproj +199 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2015_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017.vcxproj +172 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2017_static.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2019_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2022_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026.vcxproj +176 -0
- package/thirdparty/pugixml/scripts/pugixml_vs2026_static.vcxproj +180 -0
- package/thirdparty/pugixml/scripts/sbom.cdx.json +47 -0
- package/thirdparty/pugixml/src/pugiconfig.hpp +81 -0
- package/thirdparty/pugixml/src/pugixml.cpp +13776 -0
- package/thirdparty/pugixml/src/pugixml.hpp +1604 -0
- package/thirdparty/pugixml/tests/allocator.cpp +175 -0
- package/thirdparty/pugixml/tests/allocator.hpp +10 -0
- package/thirdparty/pugixml/tests/autotest-appveyor.ps1 +93 -0
- package/thirdparty/pugixml/tests/cmake-appveyor.ps1 +57 -0
- package/thirdparty/pugixml/tests/data/empty.xml +0 -0
- package/thirdparty/pugixml/tests/data/large.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_latin1.xml +1 -0
- package/thirdparty/pugixml/tests/data/latintest_utf8.xml +1 -0
- package/thirdparty/pugixml/tests/data/multiline.xml +3 -0
- package/thirdparty/pugixml/tests/data/small.xml +1 -0
- package/thirdparty/pugixml/tests/data/truncation.xml +19 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf16_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_be_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_bom.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_clean.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf32_le_nodecl.xml +0 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_bom.xml +87 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_clean.xml +84 -0
- package/thirdparty/pugixml/tests/data/utftest_utf8_nodecl.xml +86 -0
- package/thirdparty/pugixml/tests/data//321/202/320/265/321/201/321/202.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/basic.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/doctype.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/refs.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/types.xml +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf16.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_parse/utf32.xml +0 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/basic.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/functions.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/math.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/path.xpath +1 -0
- package/thirdparty/pugixml/tests/data_fuzz_xpath/predicate.xpath +1 -0
- package/thirdparty/pugixml/tests/fuzz_parse.cpp +14 -0
- package/thirdparty/pugixml/tests/fuzz_parse.dict +72 -0
- package/thirdparty/pugixml/tests/fuzz_setup.sh +11 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.cpp +46 -0
- package/thirdparty/pugixml/tests/fuzz_xpath.dict +72 -0
- package/thirdparty/pugixml/tests/helpers.hpp +114 -0
- package/thirdparty/pugixml/tests/main.cpp +218 -0
- package/thirdparty/pugixml/tests/test.cpp +220 -0
- package/thirdparty/pugixml/tests/test.hpp +175 -0
- package/thirdparty/pugixml/tests/test_compact.cpp +150 -0
- package/thirdparty/pugixml/tests/test_deprecated.cpp +25 -0
- package/thirdparty/pugixml/tests/test_document.cpp +1910 -0
- package/thirdparty/pugixml/tests/test_dom_modify.cpp +2122 -0
- package/thirdparty/pugixml/tests/test_dom_text.cpp +601 -0
- package/thirdparty/pugixml/tests/test_dom_traverse.cpp +1481 -0
- package/thirdparty/pugixml/tests/test_header_guard.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iosfwd_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_iostream_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_only_1.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_only_2.cpp +21 -0
- package/thirdparty/pugixml/tests/test_header_string_1.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_2.cpp +3 -0
- package/thirdparty/pugixml/tests/test_header_string_iostream.cpp +5 -0
- package/thirdparty/pugixml/tests/test_memory.cpp +303 -0
- package/thirdparty/pugixml/tests/test_parse.cpp +1463 -0
- package/thirdparty/pugixml/tests/test_parse_doctype.cpp +366 -0
- package/thirdparty/pugixml/tests/test_unicode.cpp +152 -0
- package/thirdparty/pugixml/tests/test_version.cpp +5 -0
- package/thirdparty/pugixml/tests/test_write.cpp +757 -0
- package/thirdparty/pugixml/tests/test_xpath.cpp +833 -0
- package/thirdparty/pugixml/tests/test_xpath_api.cpp +646 -0
- package/thirdparty/pugixml/tests/test_xpath_functions.cpp +844 -0
- package/thirdparty/pugixml/tests/test_xpath_operators.cpp +566 -0
- package/thirdparty/pugixml/tests/test_xpath_parse.cpp +428 -0
- package/thirdparty/pugixml/tests/test_xpath_paths.cpp +787 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_abbrev_w3c.cpp +219 -0
- package/thirdparty/pugixml/tests/test_xpath_paths_w3c.cpp +312 -0
- package/thirdparty/pugixml/tests/test_xpath_variables.cpp +683 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_1.cpp +411 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_2.cpp +417 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_3.cpp +321 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_4.cpp +300 -0
- package/thirdparty/pugixml/tests/test_xpath_xalan_5.cpp +295 -0
- package/thirdparty/pugixml/tests/writer_string.cpp +79 -0
- package/thirdparty/pugixml/tests/writer_string.hpp +27 -0
- package/ios/dummy.swift +0 -2
- package/scripts/prepare-openxlsx.js +0 -109
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
#ifndef PUGIXML_NO_XPATH
|
|
2
|
+
|
|
3
|
+
#include "test.hpp"
|
|
4
|
+
|
|
5
|
+
using namespace pugi;
|
|
6
|
+
|
|
7
|
+
TEST_XML(xpath_paths_axes_child, "<node attr='value'><child attr='value'><subchild/></child><another/><last/></node>")
|
|
8
|
+
{
|
|
9
|
+
xml_node c;
|
|
10
|
+
xml_node n = doc.child(STR("node"));
|
|
11
|
+
xpath_node na(n.attribute(STR("attr")), n);
|
|
12
|
+
|
|
13
|
+
CHECK_XPATH_NODESET(c, STR("child:: node()"));
|
|
14
|
+
|
|
15
|
+
CHECK_XPATH_NODESET(n, STR("child:: node()")) % 4 % 7 % 8; // child, another, last
|
|
16
|
+
CHECK_XPATH_NODESET(n, STR("another/child:: node()"));
|
|
17
|
+
|
|
18
|
+
CHECK_XPATH_NODESET(n, STR("@attr/child::node()"));
|
|
19
|
+
CHECK_XPATH_NODESET(na, STR("child::node()"));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
TEST_XML(xpath_paths_axes_descendant, "<node attr='value'><child attr='value'><subchild/></child><another><subchild/></another><last/></node>")
|
|
23
|
+
{
|
|
24
|
+
xml_node c;
|
|
25
|
+
xml_node n = doc.child(STR("node"));
|
|
26
|
+
xpath_node na(n.attribute(STR("attr")), n);
|
|
27
|
+
|
|
28
|
+
CHECK_XPATH_NODESET(c, STR("descendant:: node()"));
|
|
29
|
+
|
|
30
|
+
CHECK_XPATH_NODESET(n, STR("descendant:: node()")) % 4 % 6 % 7 % 8 % 9; // child, subchild, another, subchild, last
|
|
31
|
+
CHECK_XPATH_NODESET(doc, STR("descendant:: node()")) % 2 % 4 % 6 % 7 % 8 % 9; // node, child, subchild, another, subchild, last
|
|
32
|
+
CHECK_XPATH_NODESET(n, STR("another/descendant:: node()")) % 8; // subchild
|
|
33
|
+
CHECK_XPATH_NODESET(n, STR("last/descendant:: node()"));
|
|
34
|
+
|
|
35
|
+
CHECK_XPATH_NODESET(n, STR("@attr/descendant::node()"));
|
|
36
|
+
CHECK_XPATH_NODESET(na, STR("descendant::node()"));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
TEST_XML(xpath_paths_axes_parent, "<node attr='value'><child attr='value'><subchild/></child><another><subchild/></another><last/></node>")
|
|
40
|
+
{
|
|
41
|
+
xml_node c;
|
|
42
|
+
xml_node n = doc.child(STR("node"));
|
|
43
|
+
xpath_node na(n.attribute(STR("attr")), n);
|
|
44
|
+
|
|
45
|
+
CHECK_XPATH_NODESET(c, STR("parent:: node()"));
|
|
46
|
+
|
|
47
|
+
CHECK_XPATH_NODESET(n.child(STR("child")), STR("parent:: node()")) % 2; // node
|
|
48
|
+
CHECK_XPATH_NODESET(n, STR("child/subchild/parent:: node()")) % 4; // child
|
|
49
|
+
CHECK_XPATH_NODESET(n, STR("@attr/parent:: node()")) % 2; // node
|
|
50
|
+
CHECK_XPATH_NODESET(n, STR("parent:: node()")) % 1; // root
|
|
51
|
+
CHECK_XPATH_NODESET(doc, STR("parent:: node()"));
|
|
52
|
+
|
|
53
|
+
CHECK_XPATH_NODESET(na, STR("parent:: node()")) % 2; // node
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
TEST_XML(xpath_paths_axes_ancestor, "<node attr='value'><child attr='value'><subchild/></child><another><subchild/></another><last/></node>")
|
|
57
|
+
{
|
|
58
|
+
xml_node c;
|
|
59
|
+
xml_node n = doc.child(STR("node"));
|
|
60
|
+
xpath_node na(n.child(STR("child")).attribute(STR("attr")), n.child(STR("child")));
|
|
61
|
+
|
|
62
|
+
CHECK_XPATH_NODESET(c, STR("ancestor:: node()"));
|
|
63
|
+
|
|
64
|
+
CHECK_XPATH_NODESET(n.child(STR("child")), STR("ancestor:: node()")) % 2 % 1; // node, root
|
|
65
|
+
CHECK_XPATH_NODESET(n, STR("child/subchild/ancestor:: node()")) % 4 % 2 % 1; // child, node, root
|
|
66
|
+
CHECK_XPATH_NODESET(n, STR("child/@attr/ancestor:: node()")) % 4 % 2 % 1; // child, node, root
|
|
67
|
+
CHECK_XPATH_NODESET(n, STR("ancestor:: node()")) % 1; // root
|
|
68
|
+
CHECK_XPATH_NODESET(doc, STR("ancestor:: node()"));
|
|
69
|
+
|
|
70
|
+
CHECK_XPATH_NODESET(na, STR("ancestor:: node()")) % 4 % 2 % 1; // child, node, root
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
TEST_XML(xpath_paths_axes_following_sibling, "<node attr1='value' attr2='value'><child attr='value'><subchild/></child><another><subchild/></another><last/></node>")
|
|
74
|
+
{
|
|
75
|
+
xml_node c;
|
|
76
|
+
xml_node n = doc.child(STR("node"));
|
|
77
|
+
xpath_node na(n.attribute(STR("attr1")), n);
|
|
78
|
+
|
|
79
|
+
CHECK_XPATH_NODESET(c, STR("following-sibling:: node()"));
|
|
80
|
+
|
|
81
|
+
CHECK_XPATH_NODESET(n.child(STR("child")), STR("following-sibling:: node()")) % 8 % 10; // another, last
|
|
82
|
+
CHECK_XPATH_NODESET(n.child(STR("last")), STR("following-sibling:: node()"));
|
|
83
|
+
|
|
84
|
+
CHECK_XPATH_NODESET(n, STR("@attr1/following-sibling:: node()")); // attributes are not siblings
|
|
85
|
+
CHECK_XPATH_NODESET(na, STR("following-sibling:: node()")); // attributes are not siblings
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
TEST_XML(xpath_paths_axes_preceding_sibling, "<node attr1='value' attr2='value'><child attr='value'><subchild/></child><another><subchild/></another><last/></node>")
|
|
89
|
+
{
|
|
90
|
+
xml_node c;
|
|
91
|
+
xml_node n = doc.child(STR("node"));
|
|
92
|
+
xpath_node na(n.attribute(STR("attr2")), n);
|
|
93
|
+
|
|
94
|
+
CHECK_XPATH_NODESET(c, STR("preceding-sibling:: node()"));
|
|
95
|
+
|
|
96
|
+
CHECK_XPATH_NODESET(n.child(STR("child")), STR("preceding-sibling:: node()"));
|
|
97
|
+
CHECK_XPATH_NODESET(n.child(STR("last")), STR("preceding-sibling:: node()")) % 8 % 5; // another, child
|
|
98
|
+
|
|
99
|
+
CHECK_XPATH_NODESET(n, STR("@attr2/following-sibling:: node()")); // attributes are not siblings
|
|
100
|
+
CHECK_XPATH_NODESET(na, STR("following-sibling:: node()")); // attributes are not siblings
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
TEST_XML(xpath_paths_axes_following, "<node attr1='value' attr2='value'><child attr='value'><subchild/></child><another><subchild/></another><almost/><last/></node>")
|
|
104
|
+
{
|
|
105
|
+
xml_node c;
|
|
106
|
+
xml_node n = doc.child(STR("node"));
|
|
107
|
+
xpath_node na(n.attribute(STR("attr1")), n);
|
|
108
|
+
|
|
109
|
+
CHECK_XPATH_NODESET(c, STR("following:: node()"));
|
|
110
|
+
|
|
111
|
+
CHECK_XPATH_NODESET(n, STR("following:: node()")); // no descendants
|
|
112
|
+
CHECK_XPATH_NODESET(n.child(STR("child")), STR("following:: node()")) % 8 % 9 % 10 % 11; // another, subchild, almost, last
|
|
113
|
+
CHECK_XPATH_NODESET(n.child(STR("child")).child(STR("subchild")), STR("following:: node()")) % 8 % 9 % 10 % 11; // another, subchild, almost, last
|
|
114
|
+
CHECK_XPATH_NODESET(n.child(STR("last")), STR("following:: node()"));
|
|
115
|
+
|
|
116
|
+
CHECK_XPATH_NODESET(n, STR("@attr1/following::node()")) % 5 % 7 % 8 % 9 % 10 % 11; // child, subchild, another, subchild, almost, last - because @/following
|
|
117
|
+
CHECK_XPATH_NODESET(n, STR("child/@attr/following::node()")) % 7 % 8 % 9 % 10 % 11; // subchild, another, subchild, almost, last
|
|
118
|
+
CHECK_XPATH_NODESET(na, STR("following::node()")) % 5 % 7 % 8 % 9 % 10 % 11; // child, subchild, another, subchild, almost, last - because @/following
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
TEST_XML(xpath_paths_axes_preceding, "<node attr1='value' attr2='value'><child attr='value'><subchild/></child><another><subchild id='1'/></another><almost/><last/></node>")
|
|
122
|
+
{
|
|
123
|
+
xml_node c;
|
|
124
|
+
xml_node n = doc.child(STR("node"));
|
|
125
|
+
xpath_node na(n.child(STR("child")).attribute(STR("attr")), n.child(STR("child")));
|
|
126
|
+
|
|
127
|
+
CHECK_XPATH_NODESET(c, STR("preceding:: node()"));
|
|
128
|
+
|
|
129
|
+
CHECK_XPATH_NODESET(n.child(STR("child")), STR("preceding:: node()")); // no ancestors
|
|
130
|
+
CHECK_XPATH_NODESET(n.child(STR("last")), STR("preceding:: node()")) % 11 % 9 % 8 % 7 % 5; // almost, subchild, another, subchild, child
|
|
131
|
+
CHECK_XPATH_NODESET(n.child(STR("another")).child(STR("subchild")), STR("preceding:: node()")) % 7 % 5; // subchild, child
|
|
132
|
+
CHECK_XPATH_NODESET(n, STR("preceding:: node()"));
|
|
133
|
+
|
|
134
|
+
CHECK_XPATH_NODESET(n, STR("child/@attr/preceding::node()")); // no ancestors
|
|
135
|
+
CHECK_XPATH_NODESET(n, STR("//subchild[@id]/@id/preceding::node()")) % 7 % 5; // subchild, child
|
|
136
|
+
CHECK_XPATH_NODESET(na, STR("preceding::node()")); // no ancestors
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
TEST_XML(xpath_paths_axes_attribute, "<node attr1='value' attr2='value'><child attr='value'><subchild/></child><another xmlns:foo='bar'><subchild/></another><last/></node>")
|
|
140
|
+
{
|
|
141
|
+
xml_node c;
|
|
142
|
+
xml_node n = doc.child(STR("node"));
|
|
143
|
+
xpath_node na(n.attribute(STR("attr1")), n);
|
|
144
|
+
|
|
145
|
+
CHECK_XPATH_NODESET(c, STR("attribute:: node()"));
|
|
146
|
+
|
|
147
|
+
CHECK_XPATH_NODESET(n.child(STR("child")), STR("attribute:: node()")) % 6; // child/@attr
|
|
148
|
+
CHECK_XPATH_NODESET(n.child(STR("last")), STR("attribute:: node()"));
|
|
149
|
+
CHECK_XPATH_NODESET(n, STR("attribute:: node()")) % 3 % 4; // node/@attr1 node/@attr2
|
|
150
|
+
CHECK_XPATH_NODESET(doc, STR("descendant-or-self:: node()/attribute:: node()")) % 3 % 4 % 6; // all attributes
|
|
151
|
+
CHECK_XPATH_NODESET(n.child(STR("another")), STR("attribute:: node()")); // namespace nodes are not attributes
|
|
152
|
+
|
|
153
|
+
CHECK_XPATH_NODESET(n, STR("@attr1/attribute::node()"));
|
|
154
|
+
CHECK_XPATH_NODESET(na, STR("attribute::node()"));
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
TEST_XML(xpath_paths_axes_namespace, "<node xmlns:foo='bar' attr='value'/>")
|
|
158
|
+
{
|
|
159
|
+
xml_node n = doc.child(STR("node"));
|
|
160
|
+
xpath_node na(n.attribute(STR("attr")), n);
|
|
161
|
+
|
|
162
|
+
// namespace nodes are not supported
|
|
163
|
+
CHECK_XPATH_NODESET(n, STR("namespace:: node()"));
|
|
164
|
+
CHECK_XPATH_NODESET(n, STR("@attr/attribute::node()"));
|
|
165
|
+
CHECK_XPATH_NODESET(na, STR("attribute::node()"));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
TEST_XML(xpath_paths_axes_self, "<node attr='value'><child attr='value'><subchild/></child><another><subchild/></another><last/></node>")
|
|
169
|
+
{
|
|
170
|
+
xml_node c;
|
|
171
|
+
xml_node n = doc.child(STR("node"));
|
|
172
|
+
xpath_node na(n.attribute(STR("attr")), n);
|
|
173
|
+
|
|
174
|
+
CHECK_XPATH_NODESET(c, STR("self:: node()"));
|
|
175
|
+
|
|
176
|
+
CHECK_XPATH_NODESET(n.child(STR("child")), STR("self:: node()")) % 4; // child
|
|
177
|
+
CHECK_XPATH_NODESET(n, STR("self:: node()")) % 2; // node
|
|
178
|
+
CHECK_XPATH_NODESET(n, STR("child/self:: node()")) % 4; // child
|
|
179
|
+
CHECK_XPATH_NODESET(n, STR("child/@attr/self:: node()")) % 5; // @attr
|
|
180
|
+
CHECK_XPATH_NODESET(doc, STR("self:: node()")) % 1; // root
|
|
181
|
+
CHECK_XPATH_NODESET(na, STR("self:: node()")) % 3; // @attr
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
TEST_XML(xpath_paths_axes_descendant_or_self, "<node attr='value'><child attr='value'><subchild/></child><another><subchild/></another><last/></node>")
|
|
185
|
+
{
|
|
186
|
+
xml_node c;
|
|
187
|
+
xml_node n = doc.child(STR("node"));
|
|
188
|
+
xpath_node na(n.child(STR("child")).attribute(STR("attr")), n.child(STR("child")));
|
|
189
|
+
|
|
190
|
+
CHECK_XPATH_NODESET(c, STR("descendant-or-self:: node()"));
|
|
191
|
+
|
|
192
|
+
CHECK_XPATH_NODESET(n, STR("descendant-or-self:: node()")) % 2 % 4 % 6 % 7 % 8 % 9; // node, child, subchild, another, subchild, last
|
|
193
|
+
CHECK_XPATH_NODESET(doc, STR("descendant-or-self:: node()")) % 1 % 2 % 4 % 6 % 7 % 8 % 9; // root, node, child, subchild, another, subchild, last
|
|
194
|
+
CHECK_XPATH_NODESET(n, STR("another/descendant-or-self:: node()")) % 7 % 8; // another, subchild
|
|
195
|
+
CHECK_XPATH_NODESET(n, STR("last/descendant-or-self:: node()")) % 9; // last
|
|
196
|
+
|
|
197
|
+
CHECK_XPATH_NODESET(n, STR("child/@attr/descendant-or-self::node()")) % 5; // @attr
|
|
198
|
+
CHECK_XPATH_NODESET(na, STR("descendant-or-self::node()")) % 5; // @attr
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
TEST_XML(xpath_paths_axes_ancestor_or_self, "<node attr='value'><child attr='value'><subchild/></child><another><subchild/></another><last/></node>")
|
|
202
|
+
{
|
|
203
|
+
xml_node c;
|
|
204
|
+
xml_node n = doc.child(STR("node"));
|
|
205
|
+
xpath_node na(n.child(STR("child")).attribute(STR("attr")), n.child(STR("child")));
|
|
206
|
+
|
|
207
|
+
CHECK_XPATH_NODESET(c, STR("ancestor-or-self:: node()"));
|
|
208
|
+
|
|
209
|
+
CHECK_XPATH_NODESET(n.child(STR("child")), STR("ancestor-or-self:: node()")) % 4 % 2 % 1; // child, node, root
|
|
210
|
+
CHECK_XPATH_NODESET(n, STR("child/subchild/ancestor-or-self:: node()")) % 6 % 4 % 2 % 1; // subchild, child, node, root
|
|
211
|
+
CHECK_XPATH_NODESET(n, STR("child/@attr/ancestor-or-self:: node()")) % 5 % 4 % 2 % 1; // @attr, child, node, root
|
|
212
|
+
CHECK_XPATH_NODESET(n, STR("ancestor-or-self:: node()")) % 2 % 1; // root, node
|
|
213
|
+
CHECK_XPATH_NODESET(doc, STR("ancestor-or-self:: node()")) % 1; // root
|
|
214
|
+
CHECK_XPATH_NODESET(n, STR("ancestor-or-self:: node()")) % 2 % 1; // root, node
|
|
215
|
+
CHECK_XPATH_NODESET(n, STR("last/ancestor-or-self::node()")) % 9 % 2 % 1; // root, node, last
|
|
216
|
+
CHECK_XPATH_NODESET(na, STR("ancestor-or-self:: node()")) % 5 % 4 % 2 % 1; // @attr, child, node, root
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
TEST_XML(xpath_paths_axes_abbrev, "<node attr='value'><foo/></node>")
|
|
220
|
+
{
|
|
221
|
+
xml_node c;
|
|
222
|
+
xml_node n = doc.child(STR("node"));
|
|
223
|
+
|
|
224
|
+
// @ axis
|
|
225
|
+
CHECK_XPATH_NODESET(c, STR("@attr"));
|
|
226
|
+
CHECK_XPATH_NODESET(n, STR("@attr")) % 3;
|
|
227
|
+
|
|
228
|
+
// no axis - child implied
|
|
229
|
+
CHECK_XPATH_NODESET(c, STR("foo"));
|
|
230
|
+
CHECK_XPATH_NODESET(n, STR("foo")) % 4;
|
|
231
|
+
CHECK_XPATH_NODESET(doc, STR("node()")) % 2;
|
|
232
|
+
|
|
233
|
+
// @ axis should disable all other axis specifiers
|
|
234
|
+
CHECK_XPATH_FAIL(STR("@child::foo"));
|
|
235
|
+
CHECK_XPATH_FAIL(STR("@attribute::foo"));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
TEST_XML(xpath_paths_nodetest_all, "<node a1='v1' x:a2='v2'><c1/><x:c2/><c3/><x:c4/></node>")
|
|
239
|
+
{
|
|
240
|
+
xml_node c;
|
|
241
|
+
xml_node n = doc.child(STR("node"));
|
|
242
|
+
|
|
243
|
+
CHECK_XPATH_NODESET(c, STR("*"));
|
|
244
|
+
CHECK_XPATH_NODESET(c, STR("child::*"));
|
|
245
|
+
|
|
246
|
+
CHECK_XPATH_NODESET(n, STR("*")) % 5 % 6 % 7 % 8;
|
|
247
|
+
CHECK_XPATH_NODESET(n, STR("child::*")) % 5 % 6 % 7 % 8;
|
|
248
|
+
CHECK_XPATH_NODESET(n, STR("attribute::*")) % 3 % 4;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
TEST_XML_FLAGS(xpath_paths_nodetest_name, "<node a1='v1' x:a2='v2'><c1/><x:c2/><c3/><x:c4/><?c1?></node>", parse_default | parse_pi)
|
|
252
|
+
{
|
|
253
|
+
xml_node c;
|
|
254
|
+
xml_node n = doc.child(STR("node"));
|
|
255
|
+
|
|
256
|
+
CHECK_XPATH_NODESET(c, STR("c1"));
|
|
257
|
+
CHECK_XPATH_NODESET(c, STR("child::c1"));
|
|
258
|
+
|
|
259
|
+
CHECK_XPATH_NODESET(n, STR("c1")) % 5;
|
|
260
|
+
CHECK_XPATH_NODESET(n, STR("x:c2")) % 6;
|
|
261
|
+
|
|
262
|
+
CHECK_XPATH_NODESET(n, STR("child::c1")) % 5;
|
|
263
|
+
CHECK_XPATH_NODESET(n, STR("child::x:c2")) % 6;
|
|
264
|
+
|
|
265
|
+
CHECK_XPATH_NODESET(n, STR("attribute::a1")) % 3;
|
|
266
|
+
CHECK_XPATH_NODESET(n, STR("attribute::x:a2")) % 4;
|
|
267
|
+
CHECK_XPATH_NODESET(n, STR("@x:a2")) % 4;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
TEST_XML(xpath_paths_nodetest_all_in_namespace, "<node a1='v1' x:a2='v2'><c1/><x:c2/><c3/><x:c4/></node>")
|
|
271
|
+
{
|
|
272
|
+
xml_node c;
|
|
273
|
+
xml_node n = doc.child(STR("node"));
|
|
274
|
+
|
|
275
|
+
CHECK_XPATH_NODESET(c, STR("x:*"));
|
|
276
|
+
CHECK_XPATH_NODESET(c, STR("child::x:*"));
|
|
277
|
+
|
|
278
|
+
CHECK_XPATH_NODESET(n, STR("x:*")) % 6 % 8;
|
|
279
|
+
CHECK_XPATH_NODESET(n, STR("child::x:*")) % 6 % 8;
|
|
280
|
+
|
|
281
|
+
CHECK_XPATH_NODESET(n, STR("attribute::x:*")) % 4;
|
|
282
|
+
CHECK_XPATH_NODESET(n, STR("@x:*")) % 4;
|
|
283
|
+
|
|
284
|
+
CHECK_XPATH_FAIL(STR(":*"));
|
|
285
|
+
CHECK_XPATH_FAIL(STR("@:*"));
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
TEST_XML_FLAGS(xpath_paths_nodetest_type, "<node attr='value'>pcdata<child/><?pi1 value?><?pi2 value?><!--comment--><![CDATA[cdata]]></node>", parse_default | parse_pi | parse_comments)
|
|
289
|
+
{
|
|
290
|
+
xml_node c;
|
|
291
|
+
xml_node n = doc.child(STR("node"));
|
|
292
|
+
|
|
293
|
+
// check on empty nodes
|
|
294
|
+
CHECK_XPATH_NODESET(c, STR("node()"));
|
|
295
|
+
CHECK_XPATH_NODESET(c, STR("text()"));
|
|
296
|
+
CHECK_XPATH_NODESET(c, STR("comment()"));
|
|
297
|
+
CHECK_XPATH_NODESET(c, STR("processing-instruction()"));
|
|
298
|
+
CHECK_XPATH_NODESET(c, STR("processing-instruction('foobar')"));
|
|
299
|
+
|
|
300
|
+
// child axis
|
|
301
|
+
CHECK_XPATH_NODESET(n, STR("node()")) % 4 % 5 % 6 % 7 % 8 % 9;
|
|
302
|
+
CHECK_XPATH_NODESET(n, STR("text()")) % 4 % 9;
|
|
303
|
+
CHECK_XPATH_NODESET(n, STR("comment()")) % 8;
|
|
304
|
+
CHECK_XPATH_NODESET(n, STR("processing-instruction()")) % 6 % 7;
|
|
305
|
+
CHECK_XPATH_NODESET(n, STR("processing-instruction('pi2')")) % 7;
|
|
306
|
+
|
|
307
|
+
// attribute axis
|
|
308
|
+
CHECK_XPATH_NODESET(n, STR("@node()")) % 3;
|
|
309
|
+
CHECK_XPATH_NODESET(n, STR("@text()"));
|
|
310
|
+
CHECK_XPATH_NODESET(n, STR("@comment()"));
|
|
311
|
+
CHECK_XPATH_NODESET(n, STR("@processing-instruction()"));
|
|
312
|
+
CHECK_XPATH_NODESET(n, STR("@processing-instruction('pi2')"));
|
|
313
|
+
|
|
314
|
+
// incorrect 'argument' number
|
|
315
|
+
CHECK_XPATH_FAIL(STR("node('')"));
|
|
316
|
+
CHECK_XPATH_FAIL(STR("text('')"));
|
|
317
|
+
CHECK_XPATH_FAIL(STR("comment('')"));
|
|
318
|
+
CHECK_XPATH_FAIL(STR("processing-instruction(1)"));
|
|
319
|
+
CHECK_XPATH_FAIL(STR("processing-instruction('', '')"));
|
|
320
|
+
CHECK_XPATH_FAIL(STR("processing-instruction(concat('a', 'b'))"));
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
TEST_XML_FLAGS(xpath_paths_nodetest_principal, "<node attr='value'>pcdata<child/><?pi1 value?><?pi2 value?><!--comment--><![CDATA[cdata]]></node><abra:cadabra abra:arba=''/>", parse_default | parse_pi | parse_comments)
|
|
324
|
+
{
|
|
325
|
+
// node() test is true for any node type
|
|
326
|
+
CHECK_XPATH_NODESET(doc, STR("//node()")) % 2 % 4 % 5 % 6 % 7 % 8 % 9 % 10;
|
|
327
|
+
CHECK_XPATH_NODESET(doc, STR("//attribute::node()")) % 3 % 11;
|
|
328
|
+
CHECK_XPATH_NODESET(doc, STR("//attribute::node()/ancestor-or-self::node()")) % 1 % 2 % 3 % 10 % 11;
|
|
329
|
+
|
|
330
|
+
// name test is true only for node with principal node type (depends on axis)
|
|
331
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::child")) % 5;
|
|
332
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::attr")) % 3;
|
|
333
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::pi1"));
|
|
334
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::attr"));
|
|
335
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::child/self::child")) % 5;
|
|
336
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::attr/self::attr")); // attribute is not of element type
|
|
337
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::child/ancestor-or-self::child")) % 5;
|
|
338
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::attr/ancestor-or-self::attr")); // attribute is not of element type
|
|
339
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::child/descendant-or-self::child")) % 5;
|
|
340
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::attr/descendant-or-self::attr")); // attribute is not of element type
|
|
341
|
+
|
|
342
|
+
// any name test is true only for node with principal node type (depends on axis)
|
|
343
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::*")) % 5;
|
|
344
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::*")) % 3;
|
|
345
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::*/self::*")) % 5;
|
|
346
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::*/self::*")); // attribute is not of element type
|
|
347
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::*/ancestor-or-self::*")) % 5 % 2;
|
|
348
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::*/ancestor-or-self::*")) % 2; // attribute is not of element type
|
|
349
|
+
CHECK_XPATH_NODESET(doc, STR("node/child::*/descendant-or-self::*")) % 5;
|
|
350
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::*/descendant-or-self::*")); // attribute is not of element type
|
|
351
|
+
|
|
352
|
+
// namespace test is true only for node with principal node type (depends on axis)
|
|
353
|
+
CHECK_XPATH_NODESET(doc, STR("child::abra:*")) % 10;
|
|
354
|
+
CHECK_XPATH_NODESET(doc, STR("child::abra:*/attribute::abra:*")) % 11;
|
|
355
|
+
CHECK_XPATH_NODESET(doc, STR("child::abra:*/self::abra:*")) % 10;
|
|
356
|
+
CHECK_XPATH_NODESET(doc, STR("child::abra:*/attribute::abra:*/self::abra:*")); // attribute is not of element type
|
|
357
|
+
CHECK_XPATH_NODESET(doc, STR("child::abra:*/ancestor-or-self::abra:*")) % 10;
|
|
358
|
+
CHECK_XPATH_NODESET(doc, STR("child::abra:*/attribute::abra:*/ancestor-or-self::abra:*")) % 10; // attribute is not of element type
|
|
359
|
+
CHECK_XPATH_NODESET(doc, STR("child::abra:*/descendant-or-self::abra:*")) % 10;
|
|
360
|
+
CHECK_XPATH_NODESET(doc, STR("child::abra:*/attribute::abra:*/descendant-or-self::abra:*")); // attribute is not of element type
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
TEST_XML(xpath_paths_nodetest_attribute_namespace, "<node a1='v1' xmlns:x='?' />")
|
|
364
|
+
{
|
|
365
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::node()")) % 3;
|
|
366
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::xmlns:x"));
|
|
367
|
+
CHECK_XPATH_NODESET(doc, STR("node/attribute::xmlns:*"));
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
TEST_XML(xpath_paths_absolute, "<node attr='value'><foo><foo/><foo/></foo></node>")
|
|
371
|
+
{
|
|
372
|
+
xml_node c;
|
|
373
|
+
xml_node n = doc.child(STR("node"));
|
|
374
|
+
xpath_node na(n.attribute(STR("attr")), n);
|
|
375
|
+
|
|
376
|
+
CHECK_XPATH_NODESET(c, STR("/foo"));
|
|
377
|
+
CHECK_XPATH_NODESET(n, STR("/foo"));
|
|
378
|
+
CHECK_XPATH_NODESET(n, STR("/node/foo")) % 4;
|
|
379
|
+
CHECK_XPATH_NODESET(n.child(STR("foo")), STR("/node/foo")) % 4;
|
|
380
|
+
CHECK_XPATH_NODESET(na, STR("/node/foo")) % 4;
|
|
381
|
+
|
|
382
|
+
CHECK_XPATH_NODESET(c, STR("/"));
|
|
383
|
+
CHECK_XPATH_NODESET(n, STR("/")) % 1;
|
|
384
|
+
CHECK_XPATH_NODESET(n.child(STR("foo")), STR("/")) % 1;
|
|
385
|
+
CHECK_XPATH_NODESET(na, STR("/")) % 1;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
TEST_XML(xpath_paths_step_abbrev, "<node><foo/></node>")
|
|
389
|
+
{
|
|
390
|
+
xml_node c;
|
|
391
|
+
xml_node n = doc.child(STR("node"));
|
|
392
|
+
|
|
393
|
+
CHECK_XPATH_NODESET(c, STR("."));
|
|
394
|
+
CHECK_XPATH_NODESET(c, STR(".."));
|
|
395
|
+
|
|
396
|
+
CHECK_XPATH_NODESET(n, STR(".")) % 2;
|
|
397
|
+
CHECK_XPATH_NODESET(n, STR("..")) % 1;
|
|
398
|
+
CHECK_XPATH_NODESET(n, STR("../node")) % 2;
|
|
399
|
+
CHECK_XPATH_NODESET(n.child(STR("foo")), STR("..")) % 2;
|
|
400
|
+
|
|
401
|
+
CHECK_XPATH_FAIL(STR(".node"));
|
|
402
|
+
CHECK_XPATH_FAIL(STR("..node"));
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
TEST_XML(xpath_paths_relative_abbrev, "<node><foo><foo/><foo/></foo></node>")
|
|
406
|
+
{
|
|
407
|
+
xml_node c;
|
|
408
|
+
xml_node n = doc.child(STR("node"));
|
|
409
|
+
|
|
410
|
+
CHECK_XPATH_NODESET(c, STR("foo//bar"));
|
|
411
|
+
|
|
412
|
+
CHECK_XPATH_NODESET(n, STR("foo/foo")) % 4 % 5;
|
|
413
|
+
CHECK_XPATH_NODESET(n, STR("foo//foo")) % 4 % 5;
|
|
414
|
+
CHECK_XPATH_NODESET(n, STR(".//foo")) % 3 % 4 % 5;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
TEST_XML(xpath_paths_absolute_abbrev, "<node><foo><foo/><foo/></foo></node>")
|
|
418
|
+
{
|
|
419
|
+
xml_node c;
|
|
420
|
+
xml_node n = doc.child(STR("node"));
|
|
421
|
+
|
|
422
|
+
CHECK_XPATH_NODESET(c, STR("//bar"));
|
|
423
|
+
|
|
424
|
+
CHECK_XPATH_NODESET(n, STR("//foo")) % 3 % 4 % 5;
|
|
425
|
+
CHECK_XPATH_NODESET(n.child(STR("foo")), STR("//foo")) % 3 % 4 % 5;
|
|
426
|
+
CHECK_XPATH_NODESET(doc, STR("//foo")) % 3 % 4 % 5;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
TEST_XML(xpath_paths_predicate_boolean, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
|
|
430
|
+
{
|
|
431
|
+
xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling();
|
|
432
|
+
|
|
433
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[position()=1]")) % 6;
|
|
434
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[position()=2]")) % 7;
|
|
435
|
+
CHECK_XPATH_NODESET(n, STR("preceding-sibling::chapter[position()=1]")) % 4;
|
|
436
|
+
CHECK_XPATH_NODESET(n, STR("preceding-sibling::chapter[position()=2]")) % 3;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
TEST_XML(xpath_paths_predicate_number, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
|
|
440
|
+
{
|
|
441
|
+
xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling();
|
|
442
|
+
|
|
443
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[1]")) % 6;
|
|
444
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[2]")) % 7;
|
|
445
|
+
CHECK_XPATH_NODESET(n, STR("preceding-sibling::chapter[1]")) % 4;
|
|
446
|
+
CHECK_XPATH_NODESET(n, STR("preceding-sibling::chapter[2]")) % 3;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
TEST_XML(xpath_paths_predicate_number_boundary, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
|
|
450
|
+
{
|
|
451
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[0.999999999999999]"));
|
|
452
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[1]")) % 3;
|
|
453
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[1.000000000000001]"));
|
|
454
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[1.999999999999999]"));
|
|
455
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[2]")) % 4;
|
|
456
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[2.000000000000001]"));
|
|
457
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[4.999999999999999]"));
|
|
458
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[5]")) % 7;
|
|
459
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[5.000000000000001]"));
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
TEST_XML(xpath_paths_predicate_number_out_of_range, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
|
|
463
|
+
{
|
|
464
|
+
xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling();
|
|
465
|
+
|
|
466
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[0]"));
|
|
467
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[-1]"));
|
|
468
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[-1000000000000]"));
|
|
469
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[-1 div 0]"));
|
|
470
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[1000000000000]"));
|
|
471
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[1 div 0]"));
|
|
472
|
+
|
|
473
|
+
#ifndef MSVC6_NAN_BUG
|
|
474
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::chapter[0 div 0]"));
|
|
475
|
+
#endif
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
TEST_XML(xpath_paths_predicate_constant_boolean, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
|
|
479
|
+
{
|
|
480
|
+
xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling();
|
|
481
|
+
|
|
482
|
+
xpath_variable_set set;
|
|
483
|
+
set.set(STR("true"), true);
|
|
484
|
+
set.set(STR("false"), false);
|
|
485
|
+
|
|
486
|
+
CHECK_XPATH_NODESET_VAR(n, STR("following-sibling::chapter[$false]"), &set);
|
|
487
|
+
CHECK_XPATH_NODESET_VAR(n, STR("following-sibling::chapter[$true]"), &set) % 6 % 7;
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
TEST_XML(xpath_paths_predicate_position_eq, "<node><chapter/><chapter/><chapter>3</chapter><chapter/><chapter/></node>")
|
|
491
|
+
{
|
|
492
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[position()=1]")) % 3;
|
|
493
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[position()=2+2]")) % 7;
|
|
494
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[position()=last()]")) % 8;
|
|
495
|
+
|
|
496
|
+
#ifndef MSVC6_NAN_BUG
|
|
497
|
+
CHECK_XPATH_NODESET(doc, STR("node/chapter[position()=string()]")) % 5;
|
|
498
|
+
#endif
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
TEST_XML(xpath_paths_predicate_several, "<node><employee/><employee secretary=''/><employee assistant=''/><employee secretary='' assistant=''/><employee assistant='' secretary=''/></node>")
|
|
502
|
+
{
|
|
503
|
+
xml_node n = doc.child(STR("node"));
|
|
504
|
+
|
|
505
|
+
CHECK_XPATH_NODESET(n, STR("employee")) % 3 % 4 % 6 % 8 % 11;
|
|
506
|
+
CHECK_XPATH_NODESET(n, STR("employee[@secretary]")) % 4 % 8 % 11;
|
|
507
|
+
CHECK_XPATH_NODESET(n, STR("employee[@assistant]")) % 6 % 8 % 11;
|
|
508
|
+
CHECK_XPATH_NODESET(n, STR("employee[@secretary][@assistant]")) % 8 % 11;
|
|
509
|
+
CHECK_XPATH_NODESET(n, STR("employee[@assistant][@secretary]")) % 8 % 11;
|
|
510
|
+
CHECK_XPATH_NODESET(n, STR("employee[@secretary and @assistant]")) % 8 % 11;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
TEST_XML(xpath_paths_predicate_filter_boolean, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
|
|
514
|
+
{
|
|
515
|
+
xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling();
|
|
516
|
+
|
|
517
|
+
CHECK_XPATH_NODESET(n, STR("(following-sibling::chapter)[position()=1]")) % 6;
|
|
518
|
+
CHECK_XPATH_NODESET(n, STR("(following-sibling::chapter)[position()=2]")) % 7;
|
|
519
|
+
CHECK_XPATH_NODESET(n, STR("(preceding-sibling::chapter)[position()=1]")) % 3;
|
|
520
|
+
CHECK_XPATH_NODESET(n, STR("(preceding-sibling::chapter)[position()=2]")) % 4;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
TEST_XML(xpath_paths_predicate_filter_number, "<node><chapter/><chapter/><chapter/><chapter/><chapter/></node>")
|
|
524
|
+
{
|
|
525
|
+
xml_node n = doc.child(STR("node")).child(STR("chapter")).next_sibling().next_sibling();
|
|
526
|
+
|
|
527
|
+
CHECK_XPATH_NODESET(n, STR("(following-sibling::chapter)[1]")) % 6;
|
|
528
|
+
CHECK_XPATH_NODESET(n, STR("(following-sibling::chapter)[2]")) % 7;
|
|
529
|
+
CHECK_XPATH_NODESET(n, STR("(preceding-sibling::chapter)[1]")) % 3;
|
|
530
|
+
CHECK_XPATH_NODESET(n, STR("(preceding-sibling::chapter)[2]")) % 4;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
TEST_XML(xpath_paths_predicate_filter_posinv, "<node><employee/><employee secretary=''/><employee assistant=''/><employee secretary='' assistant=''/><employee assistant='' secretary=''/></node>")
|
|
534
|
+
{
|
|
535
|
+
xml_node n = doc.child(STR("node"));
|
|
536
|
+
|
|
537
|
+
CHECK_XPATH_NODESET(n, STR("employee")) % 3 % 4 % 6 % 8 % 11;
|
|
538
|
+
CHECK_XPATH_NODESET(n, STR("(employee[@secretary])[@assistant]")) % 8 % 11;
|
|
539
|
+
CHECK_XPATH_NODESET(n, STR("((employee)[@assistant])[@secretary]")) % 8 % 11;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
TEST_XML(xpath_paths_step_compose, "<node><foo><foo/><foo/></foo><foo/></node>")
|
|
543
|
+
{
|
|
544
|
+
xml_node n = doc.child(STR("node"));
|
|
545
|
+
|
|
546
|
+
CHECK_XPATH_NODESET(n, STR("(.)/foo")) % 3 % 6;
|
|
547
|
+
CHECK_XPATH_NODESET(n, STR("(.)//foo")) % 3 % 4 % 5 % 6;
|
|
548
|
+
CHECK_XPATH_NODESET(n, STR("(./..)//*")) % 2 % 3 % 4 % 5 % 6;
|
|
549
|
+
|
|
550
|
+
CHECK_XPATH_FAIL(STR("(1)/foo"));
|
|
551
|
+
CHECK_XPATH_FAIL(STR("(1)//foo"));
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
TEST_XML(xpath_paths_descendant_double_slash_w3c, "<node><para><para/><para/><para><para/></para></para><para/></node>")
|
|
555
|
+
{
|
|
556
|
+
CHECK_XPATH_NODESET(doc, STR("//para")) % 3 % 4 % 5 % 6 % 7 % 8;
|
|
557
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant::para")) % 3 % 4 % 5 % 6 % 7 % 8;
|
|
558
|
+
CHECK_XPATH_NODESET(doc, STR("//para[1]")) % 3 % 4 % 7;
|
|
559
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant::para[1]")) % 3;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
TEST_XML(xpath_paths_needs_sorting, "<node><child/><child/><child><subchild/><subchild/></child></node>")
|
|
563
|
+
{
|
|
564
|
+
CHECK_XPATH_NODESET(doc, STR("(node/child/subchild)[2]")) % 7;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
TEST_XML(xpath_paths_descendant_filters, "<node><para><para/><para/><para><para/></para></para><para/></node>")
|
|
568
|
+
{
|
|
569
|
+
CHECK_XPATH_NODESET(doc, STR("//para[1]")) % 3 % 4 % 7;
|
|
570
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant::para[1]")) % 3;
|
|
571
|
+
CHECK_XPATH_NODESET(doc, STR("//para[true()][1]")) % 3 % 4 % 7;
|
|
572
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant::para[true()][1]")) % 3;
|
|
573
|
+
CHECK_XPATH_NODESET(doc, STR("//para[1][true()]")) % 3 % 4 % 7;
|
|
574
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant::para[1][true()]")) % 3;
|
|
575
|
+
CHECK_XPATH_NODESET(doc, STR("//para[1][2]"));
|
|
576
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant::para[1][2]"));
|
|
577
|
+
CHECK_XPATH_NODESET(doc, STR("//para[true()]")) % 3 % 4 % 5 % 6 % 7 % 8;
|
|
578
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant::para[true()]")) % 3 % 4 % 5 % 6 % 7 % 8;
|
|
579
|
+
CHECK_XPATH_NODESET(doc, STR("//para[position()=1][true()]")) % 3 % 4 % 7;
|
|
580
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant::para[position()=1][true()]")) % 3;
|
|
581
|
+
CHECK_XPATH_NODESET(doc, STR("//para[true()][position()=1]")) % 3 % 4 % 7;
|
|
582
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant::para[true()][position()=1]")) % 3;
|
|
583
|
+
CHECK_XPATH_NODESET(doc, STR("//node()[self::para]")) % 3 % 4 % 5 % 6 % 7 % 8;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
TEST_XML(xpath_paths_descendant_optimize, "<node><para><para/><para/><para><para/></para></para><para/></node>")
|
|
587
|
+
{
|
|
588
|
+
CHECK_XPATH_NODESET(doc, STR("//para")) % 3 % 4 % 5 % 6 % 7 % 8;
|
|
589
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant-or-self::node()/child::para")) % 3 % 4 % 5 % 6 % 7 % 8;
|
|
590
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant-or-self::node()[name()='para']/child::para")) % 4 % 5 % 6 % 7;
|
|
591
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant-or-self::node()[name()='para']/child::para[1]")) % 4 % 7;
|
|
592
|
+
CHECK_XPATH_NODESET(doc, STR("/descendant-or-self::node()[3]/child::para")) % 4 % 5 % 6;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
TEST_XML(xpath_paths_descendant_optimize_axes, "<node><para><para/><para/><para><para/></para></para><para/></node>")
|
|
596
|
+
{
|
|
597
|
+
CHECK_XPATH_NODESET(doc, STR("//.")) % 1 % 2 % 3 % 4 % 5 % 6 % 7 % 8;
|
|
598
|
+
CHECK_XPATH_NODESET(doc, STR("//descendant::*")) % 2 % 3 % 4 % 5 % 6 % 7 % 8;
|
|
599
|
+
CHECK_XPATH_NODESET(doc, STR("//descendant-or-self::*")) % 2 % 3 % 4 % 5 % 6 % 7 % 8;
|
|
600
|
+
|
|
601
|
+
CHECK_XPATH_NODESET(doc, STR("//..")) % 1 % 2 % 3 % 6;
|
|
602
|
+
CHECK_XPATH_NODESET(doc, STR("//ancestor::*")) % 2 % 3 % 6;
|
|
603
|
+
CHECK_XPATH_NODESET(doc, STR("//ancestor-or-self::*")) % 2 % 3 % 4 % 5 % 6 % 7 % 8;
|
|
604
|
+
CHECK_XPATH_NODESET(doc, STR("//preceding-sibling::*")) % 3 % 4 % 5;
|
|
605
|
+
CHECK_XPATH_NODESET(doc, STR("//following-sibling::*")) % 5 % 6 % 8;
|
|
606
|
+
CHECK_XPATH_NODESET(doc, STR("//preceding::*")) % 3 % 4 % 5 % 6 % 7;
|
|
607
|
+
CHECK_XPATH_NODESET(doc, STR("//following::*")) % 5 % 6 % 7 % 8;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
TEST_XML(xpath_paths_descendant_optimize_last, "<node><para><para/><para/><para><para/></para></para><para/></node>")
|
|
611
|
+
{
|
|
612
|
+
CHECK_XPATH_NODESET(doc, STR("//para[last()]")) % 6 % 7 % 8;
|
|
613
|
+
CHECK_XPATH_NODESET(doc, STR("//para[last() = 1]")) % 7;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
TEST_XML(xpath_paths_precision, "<node><para/><para/><para/><para/><para/></node>")
|
|
617
|
+
{
|
|
618
|
+
CHECK_XPATH_NODESET(doc, STR("//para[1]")) % 3;
|
|
619
|
+
CHECK_XPATH_NODESET(doc, STR("//para[3 div 3]")) % 3;
|
|
620
|
+
CHECK_XPATH_NODESET(doc, STR("//para[6 div 3 - 1]")) % 3;
|
|
621
|
+
CHECK_XPATH_NODESET(doc, STR("//para[6 * (1 div 3) - 1]")) % 3;
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
TEST_XML(xpath_paths_unsorted_child, "<node><foo><bar/></foo><node><foo><bar/></foo></node><foo><bar/></foo></node>")
|
|
625
|
+
{
|
|
626
|
+
CHECK_XPATH_NODESET(doc, STR("//node/foo")) % 3 % 6 % 8;
|
|
627
|
+
CHECK_XPATH_NODESET(doc, STR("//node/foo/bar")) % 4 % 7 % 9;
|
|
628
|
+
|
|
629
|
+
xpath_node_set ns = doc.select_nodes(STR("//node/foo/bar"));
|
|
630
|
+
CHECK(ns.type() == xpath_node_set::type_unsorted);
|
|
631
|
+
|
|
632
|
+
xpath_node_set nss = ns;
|
|
633
|
+
nss.sort();
|
|
634
|
+
|
|
635
|
+
CHECK(ns[0] == nss[0]);
|
|
636
|
+
CHECK(ns[1] == nss[2]);
|
|
637
|
+
CHECK(ns[2] == nss[1]);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
TEST_XML(xpath_paths_optimize_compare_attribute, "<node id='1' /><node id='2' /><node xmlns='3' />")
|
|
641
|
+
{
|
|
642
|
+
xml_node node = doc.first_child();
|
|
643
|
+
|
|
644
|
+
CHECK_XPATH_NODESET(doc, STR("node[@id = '1']")) % 2;
|
|
645
|
+
CHECK_XPATH_NODESET(doc, STR("node[@id = '2']")) % 4;
|
|
646
|
+
CHECK_XPATH_NODESET(doc, STR("node[@id = 2]")) % 4;
|
|
647
|
+
CHECK_XPATH_BOOLEAN(node, STR("@id < 2"), true);
|
|
648
|
+
CHECK_XPATH_BOOLEAN(node, STR("2 > @id"), true);
|
|
649
|
+
CHECK_XPATH_NODESET(doc, STR("node[@id[. > 3] = '2']"));
|
|
650
|
+
CHECK_XPATH_NODESET(doc, STR("node['1' = @id]")) % 2;
|
|
651
|
+
|
|
652
|
+
xpath_variable_set set;
|
|
653
|
+
set.set(STR("var1"), STR("2"));
|
|
654
|
+
set.set(STR("var2"), 2.0);
|
|
655
|
+
|
|
656
|
+
CHECK_XPATH_NODESET_VAR(doc, STR("node[@id = $var1]"), &set) % 4;
|
|
657
|
+
CHECK_XPATH_NODESET_VAR(doc, STR("node[@id = $var2]"), &set) % 4;
|
|
658
|
+
|
|
659
|
+
CHECK_XPATH_NODESET(doc, STR("node[@xmlns = '3']"));
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
TEST_XML(xpath_paths_optimize_step_once, "<node><para1><para2/><para3/><para4><para5 attr5=''/></para4></para1><para6/></node>")
|
|
663
|
+
{
|
|
664
|
+
CHECK_XPATH_BOOLEAN(doc, STR("node//para2/following::*"), true);
|
|
665
|
+
CHECK_XPATH_BOOLEAN(doc, STR("node//para6/following::*"), false);
|
|
666
|
+
|
|
667
|
+
CHECK_XPATH_STRING(doc, STR("name(node//para2/following::*)"), STR("para3"));
|
|
668
|
+
CHECK_XPATH_STRING(doc, STR("name(node//para6/following::*)"), STR(""));
|
|
669
|
+
|
|
670
|
+
CHECK_XPATH_BOOLEAN(doc, STR("node//para1/preceding::*"), false);
|
|
671
|
+
CHECK_XPATH_BOOLEAN(doc, STR("node//para6/preceding::*"), true);
|
|
672
|
+
|
|
673
|
+
CHECK_XPATH_STRING(doc, STR("name(node//para1/preceding::*)"), STR(""));
|
|
674
|
+
CHECK_XPATH_STRING(doc, STR("name(node//para6/preceding::*)"), STR("para1"));
|
|
675
|
+
|
|
676
|
+
CHECK_XPATH_BOOLEAN(doc, STR("node//para6/preceding::para4"), true);
|
|
677
|
+
|
|
678
|
+
CHECK_XPATH_BOOLEAN(doc, STR("//@attr5/ancestor-or-self::*"), true);
|
|
679
|
+
CHECK_XPATH_BOOLEAN(doc, STR("//@attr5/ancestor::*"), true);
|
|
680
|
+
|
|
681
|
+
CHECK_XPATH_BOOLEAN(doc, STR("//@attr5/following::para6"), true);
|
|
682
|
+
CHECK_XPATH_STRING(doc, STR("name(//@attr5/following::para6)"), STR("para6"));
|
|
683
|
+
|
|
684
|
+
CHECK_XPATH_BOOLEAN(doc, STR("//para5/ancestor-or-self::*"), true);
|
|
685
|
+
CHECK_XPATH_BOOLEAN(doc, STR("//para5/ancestor::*"), true);
|
|
686
|
+
|
|
687
|
+
CHECK_XPATH_BOOLEAN(doc, STR("//@attr5/ancestor-or-self::node()"), true);
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
TEST_XML(xpath_paths_null_nodeset_entries, "<node attr='value'/>")
|
|
691
|
+
{
|
|
692
|
+
xpath_node nodes[] =
|
|
693
|
+
{
|
|
694
|
+
xpath_node(doc.first_child()),
|
|
695
|
+
xpath_node(xml_node()),
|
|
696
|
+
xpath_node(doc.first_child().first_attribute(), doc.first_child()),
|
|
697
|
+
xpath_node(xml_attribute(), doc.first_child()),
|
|
698
|
+
xpath_node(xml_attribute(), xml_node()),
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
xpath_node_set ns(nodes, nodes + sizeof(nodes) / sizeof(nodes[0]));
|
|
702
|
+
|
|
703
|
+
xpath_variable_set vars;
|
|
704
|
+
vars.set(STR("x"), ns);
|
|
705
|
+
|
|
706
|
+
xpath_node_set rs = xpath_query(STR("$x/."), &vars).evaluate_node_set(xml_node());
|
|
707
|
+
|
|
708
|
+
CHECK(rs.size() == 2);
|
|
709
|
+
CHECK(rs[0] == nodes[0]);
|
|
710
|
+
CHECK(rs[1] == nodes[2]);
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
TEST_XML(xpath_paths_step_leaf_coverage, "<n><n1/><n2 a='v'><child/></n2><n3/></n>")
|
|
714
|
+
{
|
|
715
|
+
xml_node n = doc.child(STR("n")).child(STR("n2"));
|
|
716
|
+
|
|
717
|
+
CHECK_XPATH_NODESET(n, STR("ancestor::node()")) % 2 % 1;
|
|
718
|
+
CHECK_XPATH_NODESET(n, STR("ancestor-or-self::node()")) % 4 % 2 % 1;
|
|
719
|
+
CHECK_XPATH_NODESET(n, STR("attribute::node()")) % 5;
|
|
720
|
+
CHECK_XPATH_NODESET(n, STR("child::node()")) % 6;
|
|
721
|
+
CHECK_XPATH_NODESET(n, STR("descendant::node()")) % 6;
|
|
722
|
+
CHECK_XPATH_NODESET(n, STR("descendant-or-self::node()")) % 4 % 6;
|
|
723
|
+
CHECK_XPATH_NODESET(n, STR("following::node()")) % 7;
|
|
724
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::node()")) % 7;
|
|
725
|
+
CHECK_XPATH_NODESET(n, STR("namespace::node()"));
|
|
726
|
+
CHECK_XPATH_NODESET(n, STR("parent::node()")) % 2;
|
|
727
|
+
CHECK_XPATH_NODESET(n, STR("preceding::node()")) % 3;
|
|
728
|
+
CHECK_XPATH_NODESET(n, STR("preceding-sibling::node()")) % 3;
|
|
729
|
+
CHECK_XPATH_NODESET(n, STR("self::node()")) % 4;
|
|
730
|
+
}
|
|
731
|
+
TEST_XML(xpath_paths_step_leaf_predicate_coverage, "<n><n1/><n2 a='v'><child/></n2><n3/></n>")
|
|
732
|
+
{
|
|
733
|
+
xml_node n = doc.child(STR("n")).child(STR("n2"));
|
|
734
|
+
|
|
735
|
+
CHECK_XPATH_NODESET(n, STR("ancestor::node()[1]")) % 2;
|
|
736
|
+
CHECK_XPATH_NODESET(n, STR("ancestor-or-self::node()[1]")) % 4;
|
|
737
|
+
CHECK_XPATH_NODESET(n, STR("attribute::node()[1]")) % 5;
|
|
738
|
+
CHECK_XPATH_NODESET(n, STR("child::node()[1]")) % 6;
|
|
739
|
+
CHECK_XPATH_NODESET(n, STR("descendant::node()[1]")) % 6;
|
|
740
|
+
CHECK_XPATH_NODESET(n, STR("descendant-or-self::node()[1]")) % 4;
|
|
741
|
+
CHECK_XPATH_NODESET(n, STR("following::node()[1]")) % 7;
|
|
742
|
+
CHECK_XPATH_NODESET(n, STR("following-sibling::node()[1]")) % 7;
|
|
743
|
+
CHECK_XPATH_NODESET(n, STR("namespace::node()[1]"));
|
|
744
|
+
CHECK_XPATH_NODESET(n, STR("parent::node()[1]")) % 2;
|
|
745
|
+
CHECK_XPATH_NODESET(n, STR("preceding::node()[1]")) % 3;
|
|
746
|
+
CHECK_XPATH_NODESET(n, STR("preceding-sibling::node()[1]")) % 3;
|
|
747
|
+
CHECK_XPATH_NODESET(n, STR("self::node()[1]")) % 4;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
TEST_XML(xpath_paths_step_step_coverage, "<n><n1/><n2 a='v'><child/></n2><n3/></n>")
|
|
751
|
+
{
|
|
752
|
+
xml_node n = doc.child(STR("n")).child(STR("n2"));
|
|
753
|
+
|
|
754
|
+
CHECK_XPATH_NODESET(n, STR("./ancestor::node()")) % 2 % 1;
|
|
755
|
+
CHECK_XPATH_NODESET(n, STR("./ancestor-or-self::node()")) % 4 % 2 % 1;
|
|
756
|
+
CHECK_XPATH_NODESET(n, STR("./attribute::node()")) % 5;
|
|
757
|
+
CHECK_XPATH_NODESET(n, STR("./child::node()")) % 6;
|
|
758
|
+
CHECK_XPATH_NODESET(n, STR("./descendant::node()")) % 6;
|
|
759
|
+
CHECK_XPATH_NODESET(n, STR("./descendant-or-self::node()")) % 4 % 6;
|
|
760
|
+
CHECK_XPATH_NODESET(n, STR("./following::node()")) % 7;
|
|
761
|
+
CHECK_XPATH_NODESET(n, STR("./following-sibling::node()")) % 7;
|
|
762
|
+
CHECK_XPATH_NODESET(n, STR("./namespace::node()"));
|
|
763
|
+
CHECK_XPATH_NODESET(n, STR("./parent::node()")) % 2;
|
|
764
|
+
CHECK_XPATH_NODESET(n, STR("./preceding::node()")) % 3;
|
|
765
|
+
CHECK_XPATH_NODESET(n, STR("./preceding-sibling::node()")) % 3;
|
|
766
|
+
CHECK_XPATH_NODESET(n, STR("./self::node()")) % 4;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
TEST_XML(xpath_paths_step_step_predicate_coverage, "<n><n1/><n2 a='v'><child/></n2><n3/></n>")
|
|
770
|
+
{
|
|
771
|
+
xml_node n = doc.child(STR("n")).child(STR("n2"));
|
|
772
|
+
|
|
773
|
+
CHECK_XPATH_NODESET(n, STR("./ancestor::node()[1]")) % 2;
|
|
774
|
+
CHECK_XPATH_NODESET(n, STR("./ancestor-or-self::node()[1]")) % 4;
|
|
775
|
+
CHECK_XPATH_NODESET(n, STR("./attribute::node()[1]")) % 5;
|
|
776
|
+
CHECK_XPATH_NODESET(n, STR("./child::node()[1]")) % 6;
|
|
777
|
+
CHECK_XPATH_NODESET(n, STR("./descendant::node()[1]")) % 6;
|
|
778
|
+
CHECK_XPATH_NODESET(n, STR("./descendant-or-self::node()[1]")) % 4;
|
|
779
|
+
CHECK_XPATH_NODESET(n, STR("./following::node()[1]")) % 7;
|
|
780
|
+
CHECK_XPATH_NODESET(n, STR("./following-sibling::node()[1]")) % 7;
|
|
781
|
+
CHECK_XPATH_NODESET(n, STR("./namespace::node()[1]"));
|
|
782
|
+
CHECK_XPATH_NODESET(n, STR("./parent::node()[1]")) % 2;
|
|
783
|
+
CHECK_XPATH_NODESET(n, STR("./preceding::node()[1]")) % 3;
|
|
784
|
+
CHECK_XPATH_NODESET(n, STR("./preceding-sibling::node()[1]")) % 3;
|
|
785
|
+
CHECK_XPATH_NODESET(n, STR("./self::node()[1]")) % 4;
|
|
786
|
+
}
|
|
787
|
+
#endif
|