• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 943
  • Last Modified:

Convert DTD to XSD, Consolidate Multiple XSD into one SINGLE XSD and Generate XML instance also generate SINGLE Valid XSD.

Title : Convert DTD to XSD, Consolidate Multiple XSD into one SINGLE XSD and Generate XML instance also to generate SINGLE Valid XSD.

Subject:
I have following task : I've a DTD file which is converted into XSD using XML Spy. However XML Spy tool split the DTD into 3 separate XSD file, then this 3 XSD need to be combined and consolidate in to one single XSD.
XSD schema should be valid XSD to exchange message from partner system.

http://xml.cxml.org/schemas/cXML/1.2.011/InvoiceDetail.dtd

When you use XML and pass this DTD it generate  3 XSD file.
  As Input: XMLSpy > InvoiceDetail.dtd
  As Output: InvoiceDetail.dtd > InvoiceDetail.XSD, InvoiceDetail2.XSD, InvoiceDetai3.XSD

Expected Output: SingleInvoiceDetail.XSD  ( InvoiceDetail.XSD + InvoiceDetail2.XSD + InvoiceDetai3.XSD )
Exepected Single Generated XML
Exepected Single Generated Validated XSD


Regards,
Anss
0
Anss
Asked:
Anss
  • 3
3 Solutions
 
Geert BormansCommented:
Hi Anns,

This question can not be answered without actually seeing the XSDs

DTDs are unaware of namespaces (the DTD specification predates the namespace specification)
BUT you can add the namespace prefix as an attribute declaration to DTDs and fix the prefix
This technique is used a lot, not really offering namespace support but emulating upto a certain extent
As such DTDs providing (emulated) namespace support don't care at all how many files are used to put the DTD in

XSD do have support for namespaces
BUT each target namespace requires a different file
That implies that there is NO pssible way that you can compile an XSD with multiple namespaces in one file
There are also differences between the available include or import mechanisms that control inheritance

If XML Spy generated multiple XSD files from one DTD, there most likely is a very good reason for that
I suspect there is very little chance that it is possible to compile that into one file
But in order to be sure you need to show me the DTD
0
 
Geert BormansCommented:
hehe, I missed the link, sorry

In the DTD I find this

<!ATTLIST ds:Signature  
      xmlns:ds      CDATA      #FIXED 'http://www.w3.org/2000/09/xmldsig#'

which is a namespace declaration
each element name that starts with ds: belongs to that namespace
each element name that does not  start with ds: belongs to a different namespace (or no namespace at all)

From a very quick look at the DTD I can assure you it is NOT possible to compile an equivalent XSD in one file
0
 
AnssAuthor Commented:
Hi Geert Bormans,

You have correct observation,  Please can you guide any solution to consolidate it, As my end goal is to convert this Invoice CXML  DTD into SINGLE consolidated XSD to use as BizTalk Schema  for further transformation and messaging with ARIBA network.

-Cheers
0
 
Geert BormansCommented:
I am not sure you understood what I wrote
you CAN NOT consolidate the schema in one file, full stop
There is however no reason why you need consolidations
BizzTalk can handle muktiple imported schemata.
You just need to make sure the references are relative to one another
or completely absolute on a server you maintain

If you need to have one schema only, you will have to transform teh XML first in a namespace less form
but that would mean you are altering the data
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now