You can parse the XSD using a SAX / StaX parser and display it in a JSP page. Or, you can write a XSLT and apply that to the XSD, which can create a HTML page. The answer depends on the level of flexibility you desire and the requirement.
I analyzed in the following way
1) At first, I tried to convert xsd file to html using xslt.
But xslt is taking xsl or xml documents as an input but not the xsd files.
I got in one link the converted html code but I couldn’t found the source code
I tried using a java file having a method with 3 arguments which takes input of a xml, xsl and output as a html file
2) Again I tried to convert xsd to xsl and again to xhtml but it was also not possible.
3) Again I tried to read the xsd file and parse it to populate in the html.
I was not able to parse it because as it was an xsd ,I got suggestions to use JAXB and XSOM parser to parse it.
I was able to parse a xml file but not the xsd using the DOM parser.
Please provide me your suggestions regarding this issue.
Prathyusha Reddy wrote:What is the actual purpose of xsd other than validating an xml???
It has no other purpose. I am still not sure why you would want to convert the XSD to a HTML. There is no meaningful user data that you can publish, unless this tool is for developers or someone that understands XSD internals.
A plain vanilla XSLT with HTML output and a few elements can give what you want