ValidateXmlAgainstXsd

Methode (Function) · gibt Boolean zurück

ValidateXmlAgainstXsd ist eine Methode der Klasse Aloaha_ZUGFeRD.XML im Aloaha ZUGFeRD SDK.

Beschreibung (Originaltext der englischen SDK-Dokumentation): Validates an XML file against an XSD schema. The messages can be read with GetXSDValidationErrors.

Rückgabe: True if no validation message was reported; False if validation errors occurred or an exception was raised (e.g. file not found or invalid schema).

Deklaration

Public Function ValidateXmlAgainstXsd(ByVal xmlPath As String, ByVal xsdPath As String, Optional ByVal schemaNamespace As String = Nothing) As Boolean

Parameter

NameTypPflichtBeschreibung
xmlPathStringerforderlichPath of the XML file
xsdPathStringerforderlichPath of the XSD schema file
schemaNamespaceStringoptional (Standard: Nothing)Target namespace of the schema; if empty the namespace from the XSD is used

Aufruf (VB.NET)

Dim alo As New Aloaha_ZUGFeRD.XML(Aloaha_ZUGFeRD.iXML.ZUGFeRDProfile.comfort, False, "IHR-LIZENZSCHLUESSEL")
Dim xmlPath As String = ""
Dim xsdPath As String = ""
If Not alo.ValidateXmlAgainstXsd(xmlPath, xsdPath) Then
    Console.WriteLine("Fehler: " & alo.Last_Error)
End If

Aufruf (C#)

var zfStandard = Aloaha_ZUGFeRD.iXML.ZUGFeRDVersion.xInvoice;   // Optional ByRef im Konstruktor: in C# mit ref übergeben
var alo = new Aloaha_ZUGFeRD.XML(Aloaha_ZUGFeRD.iXML.ZUGFeRDProfile.comfort, false, "IHR-LIZENZSCHLUESSEL", ref zfStandard);
string xmlPath = "";
string xsdPath = "";
if (!alo.ValidateXmlAgainstXsd(xmlPath, xsdPath))
{
    Console.WriteLine("Fehler: " + alo.Last_Error);
}

COM-Schnittstelle

ValidateXmlAgainstXsd ist Mitglied der Schnittstelle Aloaha_ZUGFeRD.iXML (Position 321 von 343) und damit auch aus VB6, VBA/Access und anderen COM-Clients über CreateObject("Aloaha_ZUGFeRD.XML") aufrufbar. Neue Mitglieder werden immer am Ende von iXML angefügt, damit bestehende COM-Clients unverändert weiterlaufen; nach einem Update die Typbibliothek neu registrieren.

Quelle: XML-Dokumentationskommentare des Aloaha ZUGFeRD SDK (xml.vb). Gleiche Signatur in VB6/VBA über COM. In C# werden ByRef-Parameter mit ref übergeben, VB-Eigenschaften mit Parametern heißen get_…/set_…, optionale Parameter können entfallen.