In the foregoing example, the "content" of the first element (its value) simply identifies the kind of node it is.įirst-time users of a DOM are usually thrown by this fact. To provide the capacity for mixed content, DOM nodes are inherently very simple. It is the intermixing of text and elements that defines the mixed-content model. Note that the sentence element contains text, followed by a sub-element, followed by additional text. The hierarchy of DOM nodes would look something like this, where each line represents one node: For example, suppose you wanted to represent this structure: Mixed content occurs frequently in documents. That kind of structure is called mixed content in the DOM model. Text and elements can be freely intermixed in a DOM hierarchy. So we start by examining DOM's mixed-content model. However, the capacity for mixed content, more than anything else, accounts for the difference in how the standards define a node. It is the difference in what constitutes a "node" in the data hierarchy that primarily accounts for the differences in programming with these two models. The kind of node that exists in the hierarchy The major point of departure between the document model used in DOM and the data model used in JDOM or dom4j lies in: In this section, we will examine the differences between the models underlying those standards to help you choose the one that is most appropriate for your application. That fact, in addition to the distinction between documents and data, also helps to account for the ways in which processing a DOM differs from processing a JDOM or dom4j structure. Because it was designed for use with languages such as C and Perl, DOM does not take advantage of Java's object-oriented features. On the other hand, if you are dealing with simple data structures and if XML Schema is not a big part of your plans, then you may find that one of the more object-oriented standards, such as JDOM or dom4j, is better suited for your purpose.įrom the start, DOM was intended to be language-neutral. In addition, the JAXP 1.4.2 implementation supports XML Schema, something that can be an important consideration for any given application. The Document Object Model standard is, above all, designed for documents (for example, articles and books).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |