Validating xml file against schematron (.sch) in .Net (Saxon) - saxon

I need to validate an XML file against Schematron (.sch file). I read that Saxon can do it. How can I use Schematron file directly as all the sample uses XSLT, not the Schematron file?

There are Schematron processors that use Saxon "underneath the hood", but Saxon itself does not have any schematron capability.

Related

Delphi Script Engine auto generate code based on file

Is there a way in which you can generate Delphi code from a file type which you define and know the definition of the language inside?
Basically I would like to perform the same operation as occurs in C# with some tools. Something like SpecFlow where you define a .feature file and it generates the NUnit code to match the spec in that file.
Also a way to hook this in for each compile, and to have it automatically hook into the file types extension name. This means that when you add a .feature file into the project, it knows to generate a pas file for that .feature file based on the contents.
The only way I can think of doing this at present would be to write an extension for Delphi. Is there something simpler that I am missing?
I have found Delphi Live Template Engine by Nick Hodges which seems to get me part of the way, however the auto file generation and linkage is the missing piece.

Delphi4 XE / iOS / read XML file /

Am I correct in that Delphi 4 XE Pro does not supply any native way of reading XML documents? (TXMLDocument is Windows only) I have pondered about using TClientDataSet, but I am not sure if that is the right way to go.
Here is an example of what I want:
Readonly XML file that defines a list of contacts. In the XML file, it also contains e.g. file path to photo of contact.
Ideally I then want to show the data in e.g. a TListBox (which might mean I need to write my own logic for loading images in/out of memory.)
If validation is not required (as in the linked answer above), try
NativeXml
or
OmniXML
Both are free open source libraries for Delphi, however I have not checked if they can be used on other platforms.
Update: see http://www.kluug.net/omnixml.php and Windows & Mac XML library for delphi XE2

Delphi 7 Soap WCF Service using basicHttpBinding

I added a basicHttpBinding to an existing Service I have in production in order to expose it for use in Delphi.
When I try to use the WSDLImporter from Delphi 7 on the wsdl file, it doesn't work right.
A section in the resulting tlb says
// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[#] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
This service is consumed fine by .NET client. The service is using complexTypes but they are in the files and they are the newer split out to multiple files for imports by xsd.
Any way of doing this in Delphi 7? I even tried pulling all imported types back to 1 wsdl document. No difference.
Thanks,
David
I know this is old (very) but it might help someone else out struggling through this like we were with WCF interoperability with Delphi.
What made the difference in my own experience was
using basicHttpBinding
using the Delphi wsdlImp command line tool
enforcing Soap 1.1
pointing to the SingleWsdl address.
Here is an what our WsdlImp command looks like:
wsdlimp -P -XName -Ox- -SOAP11 -Oa- -Ol+ -ob+ -= http://srvAddress:1253/WCF.Server/Utils.svc/metadata?singleWsdl=UtilsWsdl.pas
First guess is that the WCF service is SOAP 1.2, for which support was added in Delphi 2010.
For Delphi 7, you could try some of the answers to this question.
--jeroen

Is there any good XPath Library for Delphi 2007 or above?

I have created my own XPath library for Delphi 2006 and have used it since. It works fine but could have more performance, and I don’t really have the time to maintain it any more.
What other library could I use?
OmniXML has good XML and XPath support, and it's free with source. Works with many versions of Delphi, too, including 2007 and 2009.
I import the MSXML library and use it directly. Works like a charm.
The Open XML, Alternative Document Object Model (ADOM) is also a great (and 100% Delphi) XML library including XPath support. It has DTD validation support, but unfortunately no XSD support.
http://www.philo.de/xml/downloads.shtml

How can I set the default file format in the Delphi IDE to UTF8?

Delphi 2009 sets the default file format for new source code files to ANSI, this makes the source code platform-dependent.
Even for a new XSD file created in the IDE, which by default starts with this line
<?xml version="1.0" encoding="UTF-8" ?>
Delphi sets the file format to ANSI (this looks like a bug, for new XML and XSLT documents UTF8 is selected by default).
Is there a hidden option to set the default file format for source code files?
In fact this blog post from 2004 mentions a hidden IDE option.
It states that you can set a default file filter in the registry to make UTF-8 the default encoding in Delphi 8. This still works under Tokyo! Clearly, you have to adapt the path of the registry key to recent versions like this:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Embarcadero\BDS\19.0\Editor]
"DefaultFileFilter"="Borland.FileFilter.UTF8ToUTF8"
After setting this value Delphi will encode new units in UTF-8 with BOM.
Right-click on your source code in the Delphi 2009 IDE, and select File Format. Then choose UTF-8. Hope that helps.
Although the answer from MBulli should be still relevant, since version 10.4 of Delphi (as far as I remember) it is possible to change the default encoding within the IDE.
Go to Tools > Options and choose User interface > Editor from the navigation area.
You will find the Default file encoding setting down below.
If you install UTF8ize Plugin (english translation of his page & latest version) to your IDE, when you edit any file within the IDE, the plugin set the file's codepage to UTF8 automatically.
(FYI: The author creates many useful plugins. I posted some of his plugins with image here, but my post was deleted by the modelator. I just wanted to know his useful plugins, but yes, it's off topic here. sorry.)
AFAIK, there is no IDE-wide setting for specifying the default file format.

Resources