• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

converting xsd to html

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

Can anyone help me how to convert xsd to html page, i am new to xsd,if possible sample code please.......


Thanks in advance

Prathyusha
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to javaranch Prathyusha. Before we can answer this question can you tell us why you are trying to convert a XSD document, which is a rule set for XMLs, to HTML ?
 
Prathyusha Reddy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have an xsd file i need to read the xsd and the values need to be populated in an html page..could you please tell methe ways to parse an xsd and reading the content in it..

Or any other way to convert an xsd to html page
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Prathyusha Reddy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 67754
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
An XSD file is an XML file so little of what you are saying makes sense.

Why are you doing this in the first place? It seems non-sensical at many levels. Perhaps posting your motivation will help us understand what you are really trying to accomplish.
 
Prathyusha Reddy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could you provide me any sample code please..
my sample xsd is as follows
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="maps">
<xs:complexType>
<xs:sequence>
<xs:element ref="class" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="class">
<xs:complexType>
<xs:sequence>
<xs:element ref="field" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="key" minOccurs="0" maxOccurs="unbounded"/>
<xs:element ref="stdlabels" minOccurs="0"/>
<xs:element ref="triggers" minOccurs="0"/>
</xs:sequence>
<xs:attributeGroup ref="classattributes"/>
</xs:complexType>
</xs:element>
<xs:element name="field">
<xs:complexType>
<xs:sequence>
<xs:element ref="label" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attributeGroup ref="fieldattributes"/>
</xs:complexType>
</xs:element>
<xs:element name="key">
<xs:complexType>
<xs:sequence>
<xs:element ref="keyfield" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attributeGroup ref="keyattributes"/>
</xs:complexType>
</xs:element>
<xs:element name="keyfield">
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="triggers">
<xs:complexType>
<xs:sequence>
<xs:element ref="trigger" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="trigger">
<xs:annotation>
<xs:documentation>Trigger listeners for this Class</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
<xs:element name="label">
<xs:complexType>
<xs:attribute name="value" type="xs:string" use="optional"/>
<xs:attribute name="locale" type="xs:string" use="optional"/>
</xs:complexType>
</xs:element>
<xs:element name="stdlabels">
<xs:complexType>
<xs:sequence>
<xs:element ref="stdlabel" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="stdlabel">
<xs:annotation>
<xs:documentation>The Standard Label override</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element ref="labels" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attributeGroup ref="stdlabelattributes"/>
</xs:complexType>
</xs:element>
<xs:element name="labels">
<xs:complexType>
<xs:attribute name="value" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>value of the label in the given locale</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="locale" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>value of the locale</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<!-- BEGIN STDLABEL ATTRIBUTES -->
<xs:attributeGroup name="stdlabelattributes">
<xs:attribute name="name" type="xs:string" use="required">
<xs:annotation>
<xs:documentation>Name of the field or attribute</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="value" use="required">
<xs:annotation>
<xs:documentation>Default English value of the Label</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value=".+"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
 
Prathyusha Reddy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the actual purpose of xsd other than validating an xml???
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Prathyusha Reddy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply, i have a doubt..will the xslt take the input as xsd?? As of my knowledge i think only it takes the xsl and xml right..
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A XSD is a XML. Yes it can take XSD as an input
 
Prathyusha Reddy
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply
reply
    Bookmark Topic Watch Topic
  • New Topic