convert XSD to tree representation

F

Fu Bo Xia

anyone know a Java (or Java usable) package that converts XML Schema (XSD)
documents into a tree form?


thanks,
fu bo
 
R

Raymond DeCampo

Fu said:
anyone know a Java (or Java usable) package that converts XML Schema (XSD)
documents into a tree form?


thanks,
fu bo
Fu Bo,

First, remember that XML Schema must also be valid XML files. So
really, if you find an XML tool that does what you want, you are golden.
Are you looking for (open) source code you can build on a tool?

JEdit has an XML plugin that will put the XML into a tree.
(http://www.jedit.org).

Ray
 
G

Gregory Vaughan

We market a shareware product called DTDChart that displays a document
structure as a tree chart. You would have to convert the XSD into a DTD
first. Not sure if this is the kind of thing you are looking for.

More info at http://www.intsysr.com/dtdchart.htm
 
F

Fu Bo Xia

sorry let me clearify my question,

i'm looking for a java API that will convert a XML Schema (XSD) document
from a textual representation to a tree representation that's stored in a
tree structured object. for example if i have the following XSD:


<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.books.org"
xmlns="http://www.books.org"
elementFormDefault="qualified">
<xsd:element name="bookstore">
<xsd:complexType>
<xsd:squence>
<xsd:element ref="novel"/>
<xsd:element ref="journal"/>
</xsd:squence>
</xsd:complexType>
</xsd:element>
<xsd:element name="novel">
<xsd:complexType>
<xsd:squence>
<xsd:element ref="exemplar"/>
</xsd:squence>
</xsd:complexType>
</xsd:element>
<xsd:element name="journal">
<xsd:complexType>
<xsd:squence>
<xsd:element ref="exemplar"/>
</xsd:squence>
</xsd:complexType>
</xsd:element>
<xsd:element name="exemplar">
<xsd:complexType>
<xsd:squence>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="author" type="xsd:string"/>
</xsd:squence>
</xsd:complexType>
</xsd:element>
</xsd:schema>

this will convert to a tree similar to the one pictured here:
http://tinyurl.com/mt9t
of course there's no way to capture every detail of a XSD into a tree, but
that's not what i'm looking for.

alternatively, could you point to a some good Java XML parsing tutorials.


thanks,
fu bo
 
R

Raymond DeCampo

Fu said:
sorry let me clearify my question,

i'm looking for a java API that will convert a XML Schema (XSD) document
from a textual representation to a tree representation that's stored in a
tree structured object. for example if i have the following XSD:

Why don't you just parse it as XML using Xerces, for example? Then you
will have a standard DOM structure which is very tree-like.
this will convert to a tree similar to the one pictured here:
http://tinyurl.com/mt9t
of course there's no way to capture every detail of a XSD into a tree, but
that's not what i'm looking for.

alternatively, could you point to a some good Java XML parsing tutorials.

See the Xerces site on http://xml.apache.org.

Ray
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top