advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the code for this article
Partners & Affiliates
advertisement
advertisement
Average Rating: 4.3/5 | Rate this item | 4 users have rated this item.
 Print Print
 
Practical XML for Java Programs
When dealing with XML, you need a convenient representation of the XML data in memory. This article offers Java programmers a solution to achieve this goal: an easy-to-use package for handling XML data in Java. 

advertisement
he true raison d'être for XML is to replace ASCII. The only difference is that with XML you work more with hierarchy and less with flat data, switching from this:

project=My First Project 
module.count=2 
module.1=Hammers 
module.1.file.count=3 
module.1.file.1=MyHammer.java 
module.1.file.2=MyMainHammer.java 
module.1.file.3=MyHammerHelper.java 
module.2=Nails 
module.2.file.count=2 
module.2.file.1=MyNail.java 
module.2.file.2=MyScrew.class 


to this:


<project id="My First Project"> 
 <module id="Hammers"> 
  <file id="ArmandHammer.java"/> 
  <file id="Hammer.java"/> 
  <file id="SledgeHammer.java"/> 
 </module> 
 <module id="Nails"> 
  <file id="RoofNail.java" type="source"/> 
  <file id="DeckNail.class" type="binary"/> 
 </module> 
</project> 

But, while anyone can read an ASCII file and even write a "Hello, World!", there is a learning curve between you and your first:


<?xml version="1.0"> ? <hello>Hello, World!</hello>

You will have to learn the meaning of entities, elements, attributes—probably the whole DOM (Document Object Model) concept. With ASCII, nobody remembers—or even cares—what the code for '&' is. It's not important; the ability to easily store data into a file and retrieve it is. The same should be true for XML.

When dealing with XML, you need a convenient representation of the XML data in memory. Such a representation will make finding nodes and their attributes by their "type" and "id" values and scanning or filtering the whole tree easy. This article offers Java programmers a solution to achieve this goal: an easy-to-use package for handling XML data in Java. First, it gives some practical advice on what is and isn't important in this data.

Page 1 of 4


advertisement
  Next Page: The Dos and Don'ts of XML
Page 1: IntroductionPage 3: Parsing XML Files
Page 2: The Dos and Don'ts of XMLPage 4: How the Package Works
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES