Validate XML with XSD schema
Validate XML with XSD schema
Hi,
Do you know any way to validate XML file with XSD schema directly in Xbase ++ program? Maybe there is some library or ActiveX?
Regards
Piotr
Do you know any way to validate XML file with XSD schema directly in Xbase ++ program? Maybe there is some library or ActiveX?
Regards
Piotr
-
- Posts: 176
- Joined: Thu Nov 05, 2020 10:51 am
- Location: DOMINICAN REPUBLIC
Re: Validate XML with XSD schema
Hello Piotr
The topic is very interesting. Unfortunately I can't help you. I am also looking for such a solution. An XML validator with XSD. I only find examples in other languages like C#, in .Net, in Visual Basic, but not Xbase++
Although it is not a solution, but I will attach an example in C# so that anyone who wants to help us can better understand what we are looking for.
Cordial greetings.
The topic is very interesting. Unfortunately I can't help you. I am also looking for such a solution. An XML validator with XSD. I only find examples in other languages like C#, in .Net, in Visual Basic, but not Xbase++
Although it is not a solution, but I will attach an example in C# so that anyone who wants to help us can better understand what we are looking for.
Cordial greetings.
Code: Select all
using System;
using System.Xml;
using System.Xml.Schema;
class XmlSchemaSetExample
{
static void Main()
{
XmlReaderSettings booksSettings = new XmlReaderSettings();
booksSettings.Schemas.Add("http://www.contoso.com/books", "books.xsd");
booksSettings.ValidationType = ValidationType.Schema;
booksSettings.ValidationEventHandler += new ValidationEventHandler(booksSettingsValidationEventHandler);
XmlReader books = XmlReader.Create("books.xml", booksSettings);
while (books.Read()) { }
}
static void booksSettingsValidationEventHandler(object sender, ValidationEventArgs e)
{
if (e.Severity == XmlSeverityType.Warning)
{
Console.Write("WARNING: ");
Console.WriteLine(e.Message);
}
else if (e.Severity == XmlSeverityType.Error)
{
Console.Write("ERROR: ");
Console.WriteLine(e.Message);
}
}
} [code/]
Re: Validate XML with XSD schema
Dear Diego,
unable to find a library for Xbase to handle thisk task, I asked a friend to write a C# program. There are ready-made functions in C# to handle this task. The ready program is called by passing the XML file and the address of the XSD file as parameters. I get the validation effect back.
Piotr
unable to find a library for Xbase to handle thisk task, I asked a friend to write a C# program. There are ready-made functions in C# to handle this task. The ready program is called by passing the XML file and the address of the XSD file as parameters. I get the validation effect back.
Piotr
-
- Posts: 176
- Joined: Thu Nov 05, 2020 10:51 am
- Location: DOMINICAN REPUBLIC
Re: Validate XML with XSD schema
Dear Piotr,
I'm glad you found a solution. I use Xbase++ 2.0 and I notice that it has an XML handling library. But, I do not find anything specific to validate an XML visus XSD, this being so important today.
Maybe it does, and it has another name...
Best regards.
I'm glad you found a solution. I use Xbase++ 2.0 and I notice that it has an XML handling library. But, I do not find anything specific to validate an XML visus XSD, this being so important today.
Maybe it does, and it has another name...
Best regards.
Re: Validate XML with XSD schema
Sorry to be late to party, but in case there is no quick solution to get c# program there is almost always open source solution for that via command line:
Part of project libxml2 is also lint (syntax checker) for
Project:
https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home
xmllint manpage:
https://gnome.pages.gitlab.gnome.org/li ... llint.html
call sample:
xmllint --schema yourxsd.xsd yourxml.xml
catch stdout and analyse it
You can get project and compile on own, or get precompiled binaries at one of mainteiners webpage
https://www.zlatkovic.com/pub/libxml/
Part of project libxml2 is also lint (syntax checker) for
Project:
https://gitlab.gnome.org/GNOME/libxml2/-/wikis/home
xmllint manpage:
https://gnome.pages.gitlab.gnome.org/li ... llint.html
call sample:
xmllint --schema yourxsd.xsd yourxml.xml
catch stdout and analyse it
You can get project and compile on own, or get precompiled binaries at one of mainteiners webpage
https://www.zlatkovic.com/pub/libxml/
Diego Euri Almanzar wrote: ↑Fri Aug 05, 2022 2:14 am Dear Piotr,
I'm glad you found a solution. I use Xbase++ 2.0 and I notice that it has an XML handling library. But, I do not find anything specific to validate an XML visus XSD, this being so important today.
Maybe it does, and it has another name...
Best regards.
-
- Posts: 176
- Joined: Thu Nov 05, 2020 10:51 am
- Location: DOMINICAN REPUBLIC
Re: Validate XML with XSD schema
Excellent, Klaus, thank you very much.
Although, I would like to validate an XML via an XSD, via Xbase code. It is the only way that my work would look good, since I must do the process in my system.
Alaska Software offers many XML functions, but I haven't found one to validate yet.
Although, I would like to validate an XML via an XSD, via Xbase code. It is the only way that my work would look good, since I must do the process in my system.
Alaska Software offers many XML functions, but I haven't found one to validate yet.
- Attachments
-
- ALASKAXB.jpg (256.27 KiB) Viewed 10812 times
Re: Validate XML with XSD schema
Hi,
This should be possible with MSXML xml parser. This is an active-x component, which can be used in Xbase++.
Search in Google for
This should be possible with MSXML xml parser. This is an active-x component, which can be used in Xbase++.
Search in Google for
. There are some samples in VBscript, which should be rather easy to convert.validation xml with xsd schema vbscript
-
- Posts: 176
- Joined: Thu Nov 05, 2020 10:51 am
- Location: DOMINICAN REPUBLIC
Re: Validate XML with XSD schema
good alternative, Chris.
Thanks a lot. Although, I understand that Alaska software, in all those new functions of its library for XML, must have the solution. I did not send an email to them, because in July the subscription expired.
I thank you again.
Thanks a lot. Although, I understand that Alaska software, in all those new functions of its library for XML, must have the solution. I did not send an email to them, because in July the subscription expired.
I thank you again.
Re: Validate XML with XSD schema
Hi Diego,
No, the solution won't be in Xbase++.
No, the solution won't be in Xbase++.