Convert DTD to XSD with defined root (starting) element

amrelsaqqa

New Member
I have several large DTD files. I've used trang to convert them into XSD files, so I could easily use it from JAXB and other utilities. However, the generated XSD file has all declared elements at the top level. It means that any element could be root element of an input XML. I want to specify only a particular element.Having these multiple root elements causes a few problems, e.g. \[code\]xjc\[/code\] generates \[code\]@XmlRootElement\[/code\] for all classes, so I need to add more additional checks.As I understand, I need to rewrite the generated XSD, moving \[code\]<xs:element>\[/code\]s to \[code\]<xs:complexType>\[/code\]s, changing \[code\]element ref\[/code\]s into \[code\]element type\[/code\]s and so on, but this would be too much monkey work, with no way to verify if all done correctly.Is there a more efficient way to do this?
 
Back
Top