Skip to Main Content

Java SE (Java Platform, Standard Edition)


For appeals, questions and feedback about Oracle Forums, please email Please ask technical questions in the appropriate category. Thank you!


843805Feb 1 2007 — edited Feb 2 2007
Hi all

I am trying to make an XMLViewer. Easiest way to do that I figured would be to grab an XML parser, parse the xml into a DOM Document, and convert the Document into a TreeModel.

I found a lot of code for this on the internet. First, I downloaded the latest version of Xerces, the apache XML parser. Then I scanned the web some more and found the DOMTreeWalkerTreeModel code

voila. I've got a treemodel.

Now, my only problem is that I want the tree to look a little different.

My XML looks like
<xsd:schema xmlns:xsd="" xmlns:a="">
	<xsd:element name="a" type="b"/>
	<xsd:complexType name="c">
			<xsd:element name="d" type="e" minOccurs="1" maxOccurs="1"/>
		<xsd:attribute name="Org" type="xsd:string"/>
		<xsd:attribute name="sessionID" type="xsd:string"/>
		<xsd:attribute name="stack" type="xsd:string"/>
		<xsd:attribute name="Version" type="xsd:string" use="optional"/>
		<xsd:attribute name="ProductType" type="xsd:string" use="optional"/>
but when I install it in a JTree and view it I see branches like
[xsd:schema: null]
  [xsd:element: null]
I'd like to see the actual attributes in the nodes - the name and type fields at the very least.

Anyone know how I can get the TreeWalker to display these nodes differently?
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 2 2007
Added on Feb 1 2007