How is XML used in conjunction with Java?
Sun’s provides two different Java APIs that allow you to work with XML: • The DOM (Document Object Model) API makes it easy for you to create a tree representation of an XML document. After creating the tree, you can process it. It is also called the “random access” protocol, because you can visit any portion of the tree in any order. • SAX (Simple API for XML) provides an alternate way of processing an XML document. It processes the tree as it is being built. It is a faster technique for processing the document, but it requires more complex programming. Servlets and other server/network applications tend to favor this API because of its speed. A callback (event-handler) is registered with a parser so that when the parser encounters a certain tag, the callback is invoked. The event handler processes the data marked by the tag. This is also referred to as the “serial access” protocol for XML since the data in the XML document is processed serially. Objectives • Know the benefits and dra