Page 1 of 1

Handling XSD documents

Posted: Sun Feb 19, 2023 3:07 pm
by Diego Euri Almanzar
Hello!

I need to know the use and management of XSD for electronic invoicing, which is being implemented in my country. As I don't like to use external OCX, I have been reading for months how to use the excellent express library, for handling XSD. And, based on this example, the Express library can do it.

Understanding that XSD (XML Schema Definition) is a schema language used to describe the structure and restrictions of the contents of XML documents in a very precise way, beyond the syntactic rules imposed by the XML language itself.

DC_XmlNode():new( 'AuditFile',nil, ;
{ { "xmlns", "urn:OECD:StandardAuditFile-Tax:PT_1.00_01" }, ;
{ "xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance" } } )

Is this an example of handling an XSD, or am I wrong?

I need help, thanks.

Re: Handling XSD documents

Posted: Mon Feb 20, 2023 7:57 am
by rdonnay
DC_XmlNode() is a very simple system that I wrote in a few days for a customer.

It was never intended to be as robust as what you are trying to accomplish.
This is the first time that anyone has suggested such a purpose for such a simple class.

You have the source code for it, so be my guest and give it a try.

Re: Handling XSD documents

Posted: Mon Feb 20, 2023 10:40 pm
by Diego Euri Almanzar
Hi Roger Donnay

A few months ago, I didn't know exactly what an XSD document was. Now I understand that an XSD is an XML enriched with some attributes, such as field type, and that it is used to evaluate the information of an XML.

I notice that with the excellent commands and functions of the Express library, I can read any XML or XSD, and even transfer data between them.

From my point of view, with Express features, there is no reason to use Chilkat. Anyway, I'm going to evaluate the source document.

Thanks for your timely help.

Re: Handling XSD documents

Posted: Tue Feb 28, 2023 11:56 pm
by Diego Euri Almanzar
Hello!

After studying DC_XmlNode(), and its respective source document, I did not find a way to specify which is the xsd document, which validates the xml information that contains the data. Next, I show a small example, where I want to validate the content of NOTE, through an XSD document called validatornote.xsd

<?xml version="1.0"?>

<note xmlns="https://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.w3schools.com validatornote.xsd">

<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

Is there any way to specify with the Express library, the XSD document, which validates the XML information?

I will appreciate the help.

Re: Handling XSD documents

Posted: Tue Mar 07, 2023 4:00 am
by k-insis
Servus.

See this one: https://doc.alaska-software.com/content ... 2_xml.html

There is no validation xsd:xml support in xbase currently .

What you can do is to use xmlint which is open source util that does magic:

xmllint --schema yourxsd.xsd yourxml.xml --noout

and pipe output to file for analysing.

Links:
https://stackoverflow.com/questions/428 ... gh-xmllint
https://www.aleksey.com/xmlsec/

binaries at: https://www.zlatkovic.com/projects/libxml/index.html

Diego Euri Almanzar wrote: Tue Feb 28, 2023 11:56 pm Hello!

After studying DC_XmlNode(), and its respective source document, I did not find a way to specify which is the xsd document, which validates the xml information that contains the data. Next, I show a small example, where I want to validate the content of NOTE, through an XSD document called validatornote.xsd

<?xml version="1.0"?>

<note xmlns="https://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://www.w3schools.com validatornote.xsd">

<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>

Is there any way to specify with the Express library, the XSD document, which validates the XML information?

I will appreciate the help.

Re: Handling XSD documents

Posted: Fri Mar 10, 2023 11:45 pm
by Diego Euri Almanzar
Hello K-Insis!

I admit I've been stubborn about not wanting to get out of XBase++. or Express. However, I am urgent with the work of the Electronic Invoicing, and I have already evaluated other alternatives for the xsd:xml validation

I even studied the Chilkat alternative. But, to my surprise, Chilkat has no support for xsd:xml validation.

Therefore, I will study the information that you provide me, which is very valuable to me. Thank you.

What I do understand that Chilkat is going to help me with is the digital signature that electronic invoicing requires.

Have you had experience with digital signature management?

Best regards.

Re: Handling XSD documents

Posted: Mon Mar 13, 2023 1:40 am
by k-insis
> Have you had experience with digital signature management?
> I am urgent with the work of the Electronic Invoicing

As signing invoice xml with local certificate ?

This is one of ways, can be automated easily and works for large volumes of invoices too.

xmlsec sign --pkcs12 MyFileWithPkcsStoredCert.pks --output Invoicesignedxml.xml --pwd secretpasswordtocert --id-attr:Id NameOfInvoiceAtrrToSign outputfile.xml

You have to format and check structure before signing and add basic information to sectin of attr to sign, but it will process it and validation tools will accept it as signed xml.

Diego Euri Almanzar wrote: Fri Mar 10, 2023 11:45 pm Hello K-Insis!

I admit I've been stubborn about not wanting to get out of XBase++. or Express. However, I am urgent with the work of the Electronic Invoicing, and I have already evaluated other alternatives for the xsd:xml validation

I even studied the Chilkat alternative. But, to my surprise, Chilkat has no support for xsd:xml validation.

Therefore, I will study the information that you provide me, which is very valuable to me. Thank you.

What I do understand that Chilkat is going to help me with is the digital signature that electronic invoicing requires.

Have you had experience with digital signature management?

Best regards.

Re: Handling XSD documents

Posted: Tue Mar 14, 2023 8:40 am
by Diego Euri Almanzar
Hello K-Insis!

I was researching and I understand that what you suggest is the correct path.

XMLSec is a C library that implements the standards XML Signature and XML Encryption.

I will continue to investigate, to see if it can be used via Xbase++

Have you used it with Xbase++ ?

Thank you.