Hi Madhura,
as you suggested: please send me your XSD and an XML example instance of it to ruediger dot plantiko at gmail dot com, so that I can look at the generated DTD in your case. And also at the supposed "misarrangement" and "strange characters" that you observed in the DTD.
So your argument is that you don't want to transform once from XSD to DTD, because the XSD might change in future, and with every change, the DTD had to be adapted, too. OK, this is conceivable if you expect frequent type changes in your process.
The .sh file is a shell script which clearly only runs on a *nix system, not on your Windows box.
For simplicity, I downloaded the xsdv.jar file from
xsd-validator/lib/xsdv.jar at master · amouat/xsd-validator · GitHub
to my C:\temp, and did a test validation with the command
java -jar xsdv.jar test.xsd test.xml
... and it works like a charm - nothing is "broken": all schema violations of the xml document are reported (if present), like so:
test.xml fails to validate because: org.xml.sax.SAXParseException: cvc-complex-type.2.1: Element 'Label' must have no character or element information item [children], because the type's content type is empty.
If the xml document is correct, I instead get the output
test.xml validates
As you know, Java is device-independent, so the validation will work on Unix / Linux systems as well, provided the Java version is sufficiently high.
Actually, the source code of that jar file is quite simple, it's more ore less the call of the validate() method of javax.xml.validation.Validator :
xsd-validator/src/xsdvalidator/validate.java at master · amouat/xsd-validator · GitHub
To use it from the ABAP stack, you can make a "Z_JAVA" command in transaction SM69, with "java" as command, and additional parameters allowed. After having copied the .xsd and .xml file to a temporary directory of the OS (using the ABAP statements OPEN DATASET and TRANSFER), you can call the validation and afterwards evaluate (scan) the output from command execution for errors (table parameter EXEC_PROTOCOL in function module SXPG_COMMAND_EXECUTE).
Hope this helps
Rüdiger