• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

DOMTree  RSS feed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,
I am still trying to get my program to work. Does anyone know how to build a DOMTree from a DOM Document. Thank you, m pap
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you talking about bulding the in-memory tree representation of the XML document?
If you use a DOM Parser and parse the document, it returns you a Document object reference which *is* the DOMTree.
Document document = parser.parse(uri);

Then you can recursively traverse the Document object just like the way you traverse the nodes in a tree data structure.
If my explanation is not clear, I suggest you download the Xerces parser from xml.apache.org and check out the DOMWriter sample program.
Good luck,

------------------
Ajith Kallambella M.
Sun Certified Programmer for the Java�2 Platform.
IBM Certified Developer - XML and Related Technologies, V1.
 
m pap
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajith Kallambella,
Thank you for responding. Let me try to explain alittle better what I am trying to do.
I want to take an XML file be able to veiw it as a JTree edit it, then convert back to XML so that I can get an XSL.
What I have done so far is convert XML to DOM. I thought this would be the best way to edit the XML. However, was using JTreeOutputter to veiw my XML as a Tree but with DOM JTreeOutputter is not working because of incompatable types (org.jdom.Document and org.w3c.dom.Document conflict.)
Do you have any advice on an easier way, or how to finish this way off.
Thank you very much, m pap
 
Yes, my master! Here is the tiny ad you asked for:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!