Interface: Save Used XML Schema in Document
This commit is contained in:
parent
1784f69041
commit
a1609ee3c7
@ -1,13 +1,8 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.IO
|
||||
Imports System.Reflection.Emit
|
||||
Imports System.IO
|
||||
Imports System.Xml
|
||||
Imports System.Xml.Serialization
|
||||
Imports System.Xml.XPath
|
||||
Imports System.Xml.Xsl
|
||||
Imports DigitalData.Modules.Interfaces.Exceptions
|
||||
Imports DigitalData.Modules.Interfaces.ZUGFeRD
|
||||
Imports DigitalData.Modules.Interfaces.ZUGFeRDInterface
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports GdPicture14
|
||||
|
||||
@ -24,6 +19,11 @@ Public Class ZUGFeRDInterface
|
||||
Public Const ZUGFERD_SPEC_10 = "ZUGFERD_10"
|
||||
Public Const ZUGFERD_SPEC_2x = "ZUGFERD_2x"
|
||||
|
||||
Public Const XMLSCHEMA_ZUGFERD_10 = "Version1_0"
|
||||
Public Const XMLSCHEMA_ZUGFERD_20 = "Version2_0"
|
||||
Public Const XMLSCHEMA_ZUGFERD_211 = "Version2_1_1"
|
||||
Public Const XMLSCHEMA_ZUGFERD_22 = "Version2_2_FacturX"
|
||||
|
||||
Private ReadOnly ValidFilenames As New List(Of String) From {
|
||||
PDFEmbeds.ZUGFERD_XML_FILENAME.ToUpper,
|
||||
PDFEmbeds.FACTUR_X_XML_FILENAME_DE.ToUpper,
|
||||
@ -57,6 +57,7 @@ Public Class ZUGFeRDInterface
|
||||
Public Property XElementObject As XElement
|
||||
Public Property SchemaObject As Object
|
||||
Public Property Specification As String
|
||||
Public Property UsedXMLSchema As String
|
||||
Public Property ValidationErrors As New List(Of ZugferdValidationError)
|
||||
End Class
|
||||
|
||||
@ -279,6 +280,7 @@ Public Class ZUGFeRDInterface
|
||||
Private Class AllowedType
|
||||
Public SchemaType As Type
|
||||
Public Specification As String
|
||||
Public XMLSchema As String
|
||||
End Class
|
||||
|
||||
Public Function ValidateZUGFeRDDocument(pResult As ZugferdResult) As ZugferdResult
|
||||
@ -291,13 +293,15 @@ Public Class ZUGFeRDInterface
|
||||
|
||||
Dim oObject As Object = Nothing
|
||||
Dim oSpecification As String = Nothing
|
||||
Dim oUsedXMLSchema As String = Nothing
|
||||
|
||||
Dim oAllowedTypes As New List(Of AllowedType)
|
||||
|
||||
If _Options.AllowZugferd_1_0_Schema Then
|
||||
oAllowedTypes.Add(New AllowedType With {
|
||||
.SchemaType = GetType(Version1_0.CrossIndustryDocumentType),
|
||||
.Specification = ZUGFERD_SPEC_10
|
||||
.Specification = ZUGFERD_SPEC_10,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_10
|
||||
})
|
||||
End If
|
||||
|
||||
@ -305,15 +309,18 @@ Public Class ZUGFeRDInterface
|
||||
oAllowedTypes.AddRange(New List(Of AllowedType) From {
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_0.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_20
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_1_1.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_211
|
||||
},
|
||||
New AllowedType With {
|
||||
.SchemaType = GetType(Version2_2_FacturX.CrossIndustryInvoiceType),
|
||||
.Specification = ZUGFERD_SPEC_2x
|
||||
.Specification = ZUGFERD_SPEC_2x,
|
||||
.XMLSchema = XMLSCHEMA_ZUGFERD_22
|
||||
}
|
||||
})
|
||||
End If
|
||||
@ -327,6 +334,7 @@ Public Class ZUGFeRDInterface
|
||||
oReader = pResult.XElementObject.CreateReader()
|
||||
oObject = oSerializer.Deserialize(oReader)
|
||||
oSpecification = oType.Specification
|
||||
oUsedXMLSchema = oType.XMLSchema
|
||||
|
||||
_logger.Debug("Serializing with type [{0}] succeeded", oTypeName)
|
||||
Exit For
|
||||
@ -345,6 +353,7 @@ Public Class ZUGFeRDInterface
|
||||
End If
|
||||
|
||||
pResult.Specification = oSpecification
|
||||
pResult.UsedXMLSchema = oUsedXMLSchema
|
||||
pResult.SchemaObject = oObject
|
||||
|
||||
Return pResult
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user