diff --git a/AbstractXsdTypes.jl/dev/.documenter-siteinfo.json b/AbstractXsdTypes.jl/dev/.documenter-siteinfo.json index 068629d..2ad70c1 100644 --- a/AbstractXsdTypes.jl/dev/.documenter-siteinfo.json +++ b/AbstractXsdTypes.jl/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-17T11:43:34","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-17T11:55:16","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/AbstractXsdTypes.jl/dev/docstrings/index.html b/AbstractXsdTypes.jl/dev/docstrings/index.html index c7fcfdf..540755d 100644 --- a/AbstractXsdTypes.jl/dev/docstrings/index.html +++ b/AbstractXsdTypes.jl/dev/docstrings/index.html @@ -16,7 +16,7 @@ |-- Element1: value |-- Element2: 0.001 |-- __xml_attributes: Dict("x" => "y") -|-- __validated: truesource
AbstractXsdTypes.AbstractXSDFloatType
AbstractXSDFloat <: AbstractFloat

Must have a value field, an __xml_attributes field, and a __validated field.

import AbstractXsdTypes: AbstractXSDFloat
+|-- __validated: true
source
AbstractXsdTypes.AbstractXSDFloatType
AbstractXSDFloat <: AbstractFloat

Must have a value field, an __xml_attributes field, and a __validated field.

import AbstractXsdTypes: AbstractXSDFloat
 
 struct FloatType <: AbstractXSDFloat
     value::Float64
@@ -29,7 +29,7 @@
 
 # output
 
-1.0
source
AbstractXsdTypes.AbstractXSDSignedType
AbstractXSDSigned <: Signed

Must have a value field, an __xml_attributes field, and a __validated field.

import AbstractXsdTypes: AbstractXSDSigned
+1.0
source
AbstractXsdTypes.AbstractXSDSignedType
AbstractXSDSigned <: Signed

Must have a value field, an __xml_attributes field, and a __validated field.

import AbstractXsdTypes: AbstractXSDSigned
 
 struct SignedType <: AbstractXSDSigned
     value::Int64
@@ -42,7 +42,7 @@
 
 # output
 
-1
source
AbstractXsdTypes.AbstractXSDStringType
AbstractXSDString <: AbstractString

Must have a value field, an __xml_attributes field, and a __validated field.

import AbstractXsdTypes: AbstractXSDString
+1
source
AbstractXsdTypes.AbstractXSDStringType
AbstractXSDString <: AbstractString

Must have a value field, an __xml_attributes field, and a __validated field.

import AbstractXsdTypes: AbstractXSDString
 
 struct StringType <: AbstractXSDString
     value::String
@@ -55,12 +55,12 @@
 
 # output
 
-"value"
source
AbstractXsdTypes.AbstractXSDUnionType
AbstractXsdTypes.AbstractXSDUnion

Abstract type used for XSD Union types.

First field must be the value, which will be another XSD type.

You must use the AbstractXsdTypes.union_value function in the constructor as shown below. This is to make sure the values get converted to a union value.

You must implement the AbstractXsdTypes.union_types function.

xml attributes will be passed along to the value type.

Base.@kwdef @concrete struct UnionType <: AbstractXsdTypes.AbstractXSDUnion
+"value"
source
AbstractXsdTypes.AbstractXSDUnionType
AbstractXsdTypes.AbstractXSDUnion

Abstract type used for XSD Union types.

First field must be the value, which will be another XSD type.

You must use the AbstractXsdTypes.union_value function in the constructor as shown below. This is to make sure the values get converted to a union value.

You must implement the AbstractXsdTypes.union_types function.

xml attributes will be passed along to the value type.

Base.@kwdef @concrete struct UnionType <: AbstractXsdTypes.AbstractXSDUnion
     value <: Union{FloatType,AnotherFloatType,StringType}
     __validated::Bool = true
 end
 
-AbstractXsdTypes.union_types(::Type{<:UnionType}) = (FloatType, AnotherFloatType, StringType)
source
AbstractXsdTypes.AbstractXSDUnsignedType
AbstractXSDUnsigned <: Unsigned

Must have a value field, an __xml_attributes field, and a __validated field.

import AbstractXsdTypes: AbstractXSDUnsigned
+AbstractXsdTypes.union_types(::Type{<:UnionType}) = (FloatType, AnotherFloatType, StringType)
source
AbstractXsdTypes.AbstractXSDUnsignedType
AbstractXSDUnsigned <: Unsigned

Must have a value field, an __xml_attributes field, and a __validated field.

import AbstractXsdTypes: AbstractXSDUnsigned
 
 struct UnsignedType <: AbstractXSDUnsigned
     value::UInt64
@@ -73,9 +73,9 @@
 
 # output
 
-0x0000000000000001
source
AbstractXsdTypes.XSDRestrictionViolationErrorType

XSDRestrictionViolationError <: Exception

Custom exception type to indicate that something was passed to an XSD type constructor which violates a restriction for that type.

source
AbstractXsdTypes.XSDStringRestrictionViolationErrorType
XSDStringRestrictionViolationError <: XSDRestrictionViolationError

Custom exception type to indicate that a string was passed to an XSD type constructor which violates a string based restriction for that type.

source
AbstractXsdTypes.XSDValueRestrictionViolationErrorType
XSDValueRestrictionViolationError <: XSDRestrictionViolationError

Custom exception type to indicate that a value was passed to an XSD type constructor which violates a value based restriction for that type.

source
AbstractXsdTypes.can_be_convertedMethod
can_be_converted(::Type{T}, ::Type{S})::Bool where {T<:AbstractXSDComplex, S<:AbstractXSDComplex}

Naive check to see if type S can be converted to type T. This function will only look for compatible field names, compatibility of field types is not checked.

source
AbstractXsdTypes.defaultsFunction
AbstractXsdTypes.defaults(::Type{MyType}) = (:field_a=default_value, :field_b=>default_value)

Define default arguments for various fields of MyType, which will be generated by XsdToStruct and can be used by your custom XML parser.

source
AbstractXsdTypes.print_treeMethod
print_treeprint_tree(
+0x0000000000000001
source
AbstractXsdTypes.XSDRestrictionViolationErrorType

XSDRestrictionViolationError <: Exception

Custom exception type to indicate that something was passed to an XSD type constructor which violates a restriction for that type.

source
AbstractXsdTypes.XSDStringRestrictionViolationErrorType
XSDStringRestrictionViolationError <: XSDRestrictionViolationError

Custom exception type to indicate that a string was passed to an XSD type constructor which violates a string based restriction for that type.

source
AbstractXsdTypes.XSDValueRestrictionViolationErrorType
XSDValueRestrictionViolationError <: XSDRestrictionViolationError

Custom exception type to indicate that a value was passed to an XSD type constructor which violates a value based restriction for that type.

source
AbstractXsdTypes.can_be_convertedMethod
can_be_converted(::Type{T}, ::Type{S})::Bool where {T<:AbstractXSDComplex, S<:AbstractXSDComplex}

Naive check to see if type S can be converted to type T. This function will only look for compatible field names, compatibility of field types is not checked.

source
AbstractXsdTypes.defaultsFunction
AbstractXsdTypes.defaults(::Type{MyType}) = (:field_a=default_value, :field_b=>default_value)

Define default arguments for various fields of MyType, which will be generated by XsdToStruct and can be used by your custom XML parser.

source
AbstractXsdTypes.print_treeMethod
print_treeprint_tree(
     io::IO,
     x::AbstractXSDComplex;
     print_all::Bool=false,
     indent_string::AbstractString=""
-)::Nothing

Prints the AbstractXSDComplex as a tree.

source
+)::Nothing

Prints the AbstractXSDComplex as a tree.

source diff --git a/AbstractXsdTypes.jl/dev/index.html b/AbstractXsdTypes.jl/dev/index.html index b54dfa8..78c7cbd 100644 --- a/AbstractXsdTypes.jl/dev/index.html +++ b/AbstractXsdTypes.jl/dev/index.html @@ -1,2 +1,2 @@ -Home · AbstractXsdTypes.jl

AbstractXsdTypes

This package contains abstract types and generic functions used by the output of the XsdToStruct package.

Restrictions

The types defined in XSD documents often have restrictions on what data they can contain. The implementations of these restriction checks are contained in this package. Note that not all possible restrictions are implemented yet.

Defaults

This package also provides a defaults function for handling specified default values of XSD types. The generic implementation will return an empty NamedTuple. But, if there are defaults specified in the XSD file for a particular type the output of XsdToStruct will contain a defaults function that returns a NamedTuple which maps the field name to its default value.

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.

+Home · AbstractXsdTypes.jl

AbstractXsdTypes

This package contains abstract types and generic functions used by the output of the XsdToStruct package.

Restrictions

The types defined in XSD documents often have restrictions on what data they can contain. The implementations of these restriction checks are contained in this package. Note that not all possible restrictions are implemented yet.

Defaults

This package also provides a defaults function for handling specified default values of XSD types. The generic implementation will return an empty NamedTuple. But, if there are defaults specified in the XSD file for a particular type the output of XsdToStruct will contain a defaults function that returns a NamedTuple which maps the field name to its default value.

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.