reading information from XML file
I am currently writing an address book type program. I am wanting to use an XML file to read and write data to. I have gone through some tutorials on DOM and JDOM. If i have an entry set up like below
Where the ... are more entry's
in my program i want to display one entry and have navigation buttons the user can press to move to the next entry. Would it be possibe to navigate the XML file in this way. I don't have any actual code yet for my program, I have done some tutorials on sun to get a basic understanding of this. Any help is greatly appreciated.
slap on your buttons for navigations, and JTextFields(or whatever) for displaying content
At form load time, populate a DOM tree from the XML using a DOMParser, take the resulting Document and set it as a member of your component(JFrame or whatever), get some kind of iterator from the Document, and initialize your fields from the first record (if there is one).
When next or previous buttons are clicked, you just use the iterator to move forward or backward over the document, repopulating the form's fields with the current record (if there is one).
Actual implementation is up to you, of course.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL