• Figure 4.13: Allowable nodes under the Document node. Figure 4.14: Allowable nodes under the Element node. Figure 4.15
  • Figure 4.16: Allowable nodes under the EntityReference node. Figure 4.17 : Allowable nodes under the DocumentType node. Figure 4.18
  • Figure 4.19: Allowable nodes under the Notation node. DOM Applications
  • Microsoft Word Applied xml a toolkit for Programmers Wiley doc




    Download 2,96 Mb.
    Pdf ko'rish
    bet101/131
    Sana14.05.2024
    Hajmi2,96 Mb.
    #232039
    1   ...   97   98   99   100   101   102   103   104   ...   131
    Bog'liq
    Ceponkus, Hoodbhoy - Applied XML - Toolkit for Programmers

    Figure 4.12:
    DOMifier view of “itemlist” XML snippet.
    The Big Picture
    These nodes somehow need to fit together in the DOM tree. All the different nodes have 
    restrictions as to which nodes can be their children. The parent-child relationships can be 
    easily shown using a tree diagram, which has been split up among Figures 4.13 through 
    4.19. Figure 4.13 starts with the Document node, and the remaining figures flow from 
    there. The property, such as childNodes, that is used to get access to a node is written in 
    the line between nodes. These properties are described in greater detail in 
    Chapter 5

    Nodes that reside under NodeList or NamedNodeMap collections don’t have a property 
    name because they are accessed with the item(x) method.


    - 109 -
    Figure 4.13:
    Allowable nodes under the Document node.
    Figure 4.14:
    Allowable nodes under the Element node.
    Figure 4.15:
    Allowable nodes under the Attribute node.


    - 110 -
    Figure 4.16:
    Allowable nodes under the EntityReference node.
    Figure 4.17
    : Allowable nodes under the DocumentType node.
    Figure 4.18:
    Allowable nodes under the Entity node.


    - 111 -
    Figure 4.19:
    Allowable nodes under the Notation node.
    DOM Applications
    You might be wondering why the DOM is needed to display an XML document in a 
    browser. In fact, the DOM doesn’t always need to be used when accessing XML data. A 
    Web page that simply wants to display the contents of an XML document can just point 
    the URL to that page. An XSL stylesheet can be associated with that XML document to 
    provide a certain view of the data. Also, CSS can be used to render the display of the 
    XML document. The DOM comes into play from a script when the XML document needs 
    to be modified or when the script needs access to some of this data. For example, a 
    script might need to calculate the tax on a given item at an online shopping site. Any 
    application that requires the manipulation of the data contained within an XML document 
    needs to use the DOM interfaces.
    On the server side, the DOM is used heavily to process XML documents. For example, 
    the online shopping application included with this book sends an XML document that 
    represents a client’s order down to the server. The object on the server uses the DOM to 
    view the contents of this document and then applies the necessary business logic to 
    complete the transaction.
    Another server-side application would be to provide a translation mechanism from legacy 
    databases to XML (see Figure 4.20). The DOM interfaces can be implemented on top of 
    this database to make it seem like an XML document to users of this data. In effect, the 
    users of this database don’t need to know that the data is not natively stored in XML.


    - 112 -

    Download 2,96 Mb.
    1   ...   97   98   99   100   101   102   103   104   ...   131




    Download 2,96 Mb.
    Pdf ko'rish

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Microsoft Word Applied xml a toolkit for Programmers Wiley doc

    Download 2,96 Mb.
    Pdf ko'rish