From 4d9082f33b81ddd0f7191e38d5f945f6c9f76b21 Mon Sep 17 00:00:00 2001 From: Tom Lemmens Date: Sun, 16 Jun 2024 16:53:35 +0200 Subject: [PATCH 1/7] replace-formatting --- AbstractXsdTypes.jl/Project.toml | 2 +- AbstractXsdTypes.jl/src/AbstractXsdTypes.jl | 2 +- AbstractXsdTypes.jl/src/restrictions/numeric_restrictions.jl | 2 +- XmlStructWriter.jl/Project.toml | 1 - XmlStructWriter.jl/src/XmlStructWriter.jl | 4 ++-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/AbstractXsdTypes.jl/Project.toml b/AbstractXsdTypes.jl/Project.toml index 7090b4d..90ac29e 100644 --- a/AbstractXsdTypes.jl/Project.toml +++ b/AbstractXsdTypes.jl/Project.toml @@ -4,5 +4,5 @@ authors = ["Tom Lemmens", "Matthijs Cox"] version = "0.1.0" [deps] -Formatting = "59287772-0a20-5a39-b81b-1366585eb4c0" +Format = "1fa38f19-a742-5d3f-a2b9-30dd87b9d5f8" Memoization = "6fafb56a-5788-4b4e-91ca-c0cea6611c73" diff --git a/AbstractXsdTypes.jl/src/AbstractXsdTypes.jl b/AbstractXsdTypes.jl/src/AbstractXsdTypes.jl index 3039549..a25a516 100644 --- a/AbstractXsdTypes.jl/src/AbstractXsdTypes.jl +++ b/AbstractXsdTypes.jl/src/AbstractXsdTypes.jl @@ -1,7 +1,7 @@ module AbstractXsdTypes using Memoization -using Formatting +using Format include("type_definitions.jl") include("construction_and_conversion_functions.jl") diff --git a/AbstractXsdTypes.jl/src/restrictions/numeric_restrictions.jl b/AbstractXsdTypes.jl/src/restrictions/numeric_restrictions.jl index 211bfb2..28a1c5b 100644 --- a/AbstractXsdTypes.jl/src/restrictions/numeric_restrictions.jl +++ b/AbstractXsdTypes.jl/src/restrictions/numeric_restrictions.jl @@ -88,7 +88,7 @@ end # format into string and parse back, if these are equal we are ok max_fraction_digits = get_max_fraction_digits(T) - value_string = sprintf1("%.$(max_fraction_digits)f", value) + value_string = cfmt("%.$(max_fraction_digits)f", value) if parse(S, value_string) != value throw( diff --git a/XmlStructWriter.jl/Project.toml b/XmlStructWriter.jl/Project.toml index da9f089..ef3fd6d 100644 --- a/XmlStructWriter.jl/Project.toml +++ b/XmlStructWriter.jl/Project.toml @@ -5,7 +5,6 @@ version = "0.1.0" [deps] AbstractXsdTypes = "1d4aff4b-e088-40cb-b713-ffe4caf1580b" -Formatting = "59287772-0a20-5a39-b81b-1366585eb4c0" LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179" Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53" diff --git a/XmlStructWriter.jl/src/XmlStructWriter.jl b/XmlStructWriter.jl/src/XmlStructWriter.jl index 87fe6f6..8fbd59b 100644 --- a/XmlStructWriter.jl/src/XmlStructWriter.jl +++ b/XmlStructWriter.jl/src/XmlStructWriter.jl @@ -3,7 +3,7 @@ module XmlStructWriter using LightXML using TimeZones using Printf -using Formatting +using Format using AbstractXsdTypes export write_xml @@ -149,7 +149,7 @@ function generate_xml_string(xml_object::AbstractXsdTypes.AbstractXSDFloat)::Str @debug "Generating XML string from $xml_object" if AbstractXsdTypes.fraction_digits_check in AbstractXsdTypes.get_restriction_checks(typeof(xml_object)) max_fraction_digits = AbstractXsdTypes.get_max_fraction_digits(typeof(xml_object)) - xml_object = sprintf1("%.$(max_fraction_digits)f", xml_object) + xml_object = cfmt("%.$(max_fraction_digits)f", xml_object) else xml_object = @sprintf("%f", xml_object) end From 7a0706993d270abc8a698ccfe3db00c97cade059 Mon Sep 17 00:00:00 2001 From: Tom Lemmens Date: Sun, 16 Jun 2024 17:08:35 +0200 Subject: [PATCH 2/7] Add badges --- AbstractXsdTypes.jl/README.md | 6 ++++-- XmlStructLoader.jl/README.md | 4 +++- XmlStructWriter.jl/README.md | 4 +++- XsdToStruct.jl/README.md | 4 +++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/AbstractXsdTypes.jl/README.md b/AbstractXsdTypes.jl/README.md index c5528b6..3345d0f 100644 --- a/AbstractXsdTypes.jl/README.md +++ b/AbstractXsdTypes.jl/README.md @@ -1,4 +1,6 @@ -# AbstractXsdTypes +# AbstractXsdTypes.jl + +[![Dev Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://tom-lemmens.github.io/XmlStructTools.jl/AbstractXsdTypes.jl/dev/) This package contains abstract types and generic functions used by the output of the `XsdToStruct` package. @@ -12,4 +14,4 @@ This package also provides a `defaults` function for handling specified default ## Naive conversion -There are also some naive conversion functions included with this package. These give a "best effort" generic conversion of one type generated by XsdToStruct into another one. For example, a common use case is when an two XSD files describe compatible data types for certain particular elements but are otherwise completely different. You might have a function available written for the data type of the first schema but want to use it on data loaded from an XML file that follows the second schema. You will not be able to parse the complete XML file using the types of the first schema and a function call on the data loaded using the second schema will not dispatch to the correct function. With the naive `convert` function included in this package you can load the data of the XML and then try to convert the compatible subfield into the type from the first schema, which will then dispatch correctly. \ No newline at end of file +There are also some naive conversion functions included with this package. These give a "best effort" generic conversion of one type generated by XsdToStruct into another one. For example, a common use case is when an two XSD files describe compatible data types for certain particular elements but are otherwise completely different. You might have a function available written for the data type of the first schema but want to use it on data loaded from an XML file that follows the second schema. You will not be able to parse the complete XML file using the types of the first schema and a function call on the data loaded using the second schema will not dispatch to the correct function. With the naive `convert` function included in this package you can load the data of the XML and then try to convert the compatible subfield into the type from the first schema, which will then dispatch correctly. diff --git a/XmlStructLoader.jl/README.md b/XmlStructLoader.jl/README.md index f9b84a5..ddd2586 100644 --- a/XmlStructLoader.jl/README.md +++ b/XmlStructLoader.jl/README.md @@ -1,4 +1,6 @@ -# XmlStructLoaderExampleXml +# XmlStructLoader.jl + +[![Dev Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://tom-lemmens.github.io/XmlStructTools.jl/XmlStructLoader.jl/dev/) ## Getting the required files diff --git a/XmlStructWriter.jl/README.md b/XmlStructWriter.jl/README.md index c1f38e5..bfd10fd 100644 --- a/XmlStructWriter.jl/README.md +++ b/XmlStructWriter.jl/README.md @@ -1,4 +1,6 @@ -# XmlStructWriter +# XmlStructWriter.jl + +[![Dev Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://tom-lemmens.github.io/XmlStructTools.jl/XmlStructWriter.jl/dev/) ## Getting the required files diff --git a/XsdToStruct.jl/README.md b/XsdToStruct.jl/README.md index 98334ac..1303146 100644 --- a/XsdToStruct.jl/README.md +++ b/XsdToStruct.jl/README.md @@ -1,4 +1,6 @@ -# XsdToStruct +# XsdToStruct.jl + +[![Dev Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://tom-lemmens.github.io/XmlStructTools.jl/XsdToStruct.jl/dev/) This package generates a module with struct definitions which correspond to the data types specified in a given XML Schema file. Apart from the definitions it also generates constructors which can (partially) validate the data that is given with the restrictions specified in the schema file. From b061f2d63dedc8cbc76d29de5612bd77e32dd76c Mon Sep 17 00:00:00 2001 From: Tom Lemmens Date: Sun, 16 Jun 2024 17:11:15 +0200 Subject: [PATCH 3/7] remove change logs --- AbstractXsdTypes.jl/CHANGELOG.MD | 0 XmlStructLoader.jl/CHANGELOG.MD | 0 XmlStructWriter.jl/CHANGELOG.MD | 0 XsdToStruct.jl/CHANGELOG.MD | 0 4 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 AbstractXsdTypes.jl/CHANGELOG.MD delete mode 100644 XmlStructLoader.jl/CHANGELOG.MD delete mode 100644 XmlStructWriter.jl/CHANGELOG.MD delete mode 100644 XsdToStruct.jl/CHANGELOG.MD diff --git a/AbstractXsdTypes.jl/CHANGELOG.MD b/AbstractXsdTypes.jl/CHANGELOG.MD deleted file mode 100644 index e69de29..0000000 diff --git a/XmlStructLoader.jl/CHANGELOG.MD b/XmlStructLoader.jl/CHANGELOG.MD deleted file mode 100644 index e69de29..0000000 diff --git a/XmlStructWriter.jl/CHANGELOG.MD b/XmlStructWriter.jl/CHANGELOG.MD deleted file mode 100644 index e69de29..0000000 diff --git a/XsdToStruct.jl/CHANGELOG.MD b/XsdToStruct.jl/CHANGELOG.MD deleted file mode 100644 index e69de29..0000000 From 2e4cd419f9a9549059f97301367ac971d41fa63d Mon Sep 17 00:00:00 2001 From: Tom Lemmens Date: Sun, 16 Jun 2024 17:15:26 +0200 Subject: [PATCH 4/7] update license --- AbstractXsdTypes.jl/LICENSE | 2 +- XmlStructLoader.jl/LICENSE | 2 +- XmlStructWriter.jl/LICENSE | 2 +- XsdToStruct.jl/LICENSE | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/AbstractXsdTypes.jl/LICENSE b/AbstractXsdTypes.jl/LICENSE index 8447f51..35d190a 100644 --- a/AbstractXsdTypes.jl/LICENSE +++ b/AbstractXsdTypes.jl/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 ASML Netherlands B.V. +Copyright (c) 2023-2024 Tom Lemmens, ASML Netherlands B.V., and other AbstractXsdTypes.jl contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/XmlStructLoader.jl/LICENSE b/XmlStructLoader.jl/LICENSE index 8447f51..35d190a 100644 --- a/XmlStructLoader.jl/LICENSE +++ b/XmlStructLoader.jl/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 ASML Netherlands B.V. +Copyright (c) 2023-2024 Tom Lemmens, ASML Netherlands B.V., and other AbstractXsdTypes.jl contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/XmlStructWriter.jl/LICENSE b/XmlStructWriter.jl/LICENSE index 8447f51..35d190a 100644 --- a/XmlStructWriter.jl/LICENSE +++ b/XmlStructWriter.jl/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 ASML Netherlands B.V. +Copyright (c) 2023-2024 Tom Lemmens, ASML Netherlands B.V., and other AbstractXsdTypes.jl contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/XsdToStruct.jl/LICENSE b/XsdToStruct.jl/LICENSE index 8447f51..35d190a 100644 --- a/XsdToStruct.jl/LICENSE +++ b/XsdToStruct.jl/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 ASML Netherlands B.V. +Copyright (c) 2023-2024 Tom Lemmens, ASML Netherlands B.V., and other AbstractXsdTypes.jl contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 73bae3d89b5a6a8b8d5462d3895e65c35942e343 Mon Sep 17 00:00:00 2001 From: Tom Lemmens Date: Sun, 16 Jun 2024 17:24:48 +0200 Subject: [PATCH 5/7] add documenter for top level --- .github/workflows/documentation.yml | 12 +++++++++++- README.md | 2 ++ docs/.gitignore | 2 ++ docs/Project.toml | 5 +++++ docs/make.jl | 13 +++++++++++++ docs/src/index.md | 20 ++++++++++++++++++++ 6 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 docs/.gitignore create mode 100644 docs/Project.toml create mode 100644 docs/make.jl create mode 100644 docs/src/index.md diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 0add36f..fcb6e8a 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -8,7 +8,17 @@ on: pull_request: workflow_dispatch: -jobs: +jobs: + call-documenter-XmlStructTools: + permissions: + contents: write + pull-requests: read + statuses: write + uses: ./.github/workflows/subdirdocumenter.yml + with: + subdir: . + secrets: + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} call-documenter-AbstractXsdTypes: permissions: contents: write diff --git a/README.md b/README.md index a693b56..8517136 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # XmlStructTools.jl +[![Dev Docs](https://img.shields.io/badge/docs-dev-blue.svg)](https://tom-lemmens.github.io/XmlStructTools.jl/dev/) + The tools in XmlStructTools.jl aim to fill the role of schema based XML data binding in Julia. The functionality is split up into four packages: diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..8a5f33c --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,2 @@ +build/ +Manifest.toml diff --git a/docs/Project.toml b/docs/Project.toml new file mode 100644 index 0000000..7d54f1b --- /dev/null +++ b/docs/Project.toml @@ -0,0 +1,5 @@ +[deps] +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" + +[compat] +Documenter = "1.4" diff --git a/docs/make.jl b/docs/make.jl new file mode 100644 index 0000000..1f561c3 --- /dev/null +++ b/docs/make.jl @@ -0,0 +1,13 @@ +using Documenter + +repo = Remotes.GitHub("Tom-Lemmens", "XmlStructTools.jl") + +makedocs(; + repo = repo, + sitename = "XmlStructTools.jl", + pages = ["Home" => "index.md"], +) + +deploydocs( + repo="github.com/$(repo.user)/$(repo.repo)", +) diff --git a/docs/src/index.md b/docs/src/index.md new file mode 100644 index 0000000..a693b56 --- /dev/null +++ b/docs/src/index.md @@ -0,0 +1,20 @@ +# XmlStructTools.jl + +The tools in XmlStructTools.jl aim to fill the role of schema based XML data binding in Julia. +The functionality is split up into four packages: + +- XsdToStruct.jl can generate Julia struct definitions from XSD files. +- AbstractXsdTypes.jl contains the shared functionality that is common between different XSD struct types. +- XmlStructLoader.jl can use the module generated by AbstractXsdTypes.jl to validate and load XML files into the +generated struct definitions. +- XmlStructWriter.jl can write XSD struct instances to valid XML files. + +For a quick introduction you can watch [XML Data and Julian Types](https://www.youtube.com/watch?v=Z7qgOBNk-to) +from JuliaCon Local Eindhoven 2023 to get a quick introduction to these packages. + +**Warning** +These packages are still a work in progress. +Only a small part of the entire W3C XSD recommendation is implemented. +There are already some known bugs and a fix for them is on its way. +But since this fix was developed at ASML this will take some time to go through the proper reviews. +Please be patient while we get this sorted out. From 605b3d747d37bbe9d6e88367523056baa995ee06 Mon Sep 17 00:00:00 2001 From: Tom Lemmens Date: Sun, 16 Jun 2024 17:28:40 +0200 Subject: [PATCH 6/7] Fix building docs --- .github/workflows/documentation.yml | 18 ++++++++++++------ .github/workflows/subdirdocumenter.yml | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index fcb6e8a..8ad94fc 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -9,16 +9,22 @@ on: workflow_dispatch: jobs: - call-documenter-XmlStructTools: + documenter-XmlStructTools: permissions: contents: write pull-requests: read statuses: write - uses: ./.github/workflows/subdirdocumenter.yml - with: - subdir: . - secrets: - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/setup-julia@v2 + with: + version: '1.10' + - uses: julia-actions/cache@v1 + - name: Build and deploy + env: + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + run: julia --project=docs/ docs/make.jl call-documenter-AbstractXsdTypes: permissions: contents: write diff --git a/.github/workflows/subdirdocumenter.yml b/.github/workflows/subdirdocumenter.yml index 35b8f70..2a9e72c 100644 --- a/.github/workflows/subdirdocumenter.yml +++ b/.github/workflows/subdirdocumenter.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 with: - version: '1.9' + version: '1.10' - uses: julia-actions/cache@v1 - name: Install dependencies run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()' From 549efaa98115e4fb0bbfa1311447a29136da35dd Mon Sep 17 00:00:00 2001 From: Tom Lemmens Date: Sun, 16 Jun 2024 17:30:07 +0200 Subject: [PATCH 7/7] Fix building docs --- .github/workflows/documentation.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 8ad94fc..e2cfef1 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -21,6 +21,8 @@ jobs: with: version: '1.10' - uses: julia-actions/cache@v1 + - name: Install dependencies + run: julia --project=docs/ -e 'using Pkg; Pkg.instantiate()' - name: Build and deploy env: DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}