Section 17.2.  Addressing multiple objects

Prev don't be afraid of buying books Next

17.2. Addressing multiple objects

A location path is capable of addressing multiple objects. For example, the expression in Example 17-1 addresses all caption elements within figure elements that are within chapter elements within book elements.

Example 17-1. Location path
 /book/chapter/figure/caption 

In the book whose structure is shown in Figure 17-2, the expression in Example 17-1 would address the first two caption elements, because they are children of figure elements. It would not address the third, which is the child of an example element.

Figure 17-2. Document structure




Example 17-2 shows the XML representation of the book.

Example 17-2. A short book in XML
 <?xml version="1.0"?> <book>   <chapter>     <par author="bd">First paragraph. <emph>Really.</emph></par>     <par author="cg">Second paragraph.</par>     <figure picfile="one.jpg">       <caption>The first figure's caption</caption>     </figure>     <par>Third paragraph.</par>     <figure picfile="two.jpg">       <caption>The second figure's caption.</caption>     </figure>   </chapter>   <chapter>     <par author="pp">Chapter 2, first paragraph.</par>     <example>       <caption>The first example.</caption>     </example>     <par>Chapter 2, second paragraph.</par>     <par author="bd">Chapter 2, third paragraph.</par>   </chapter> </book> 

Amazon


XML in Office 2003. Information Sharing with Desktop XML
XML in Office 2003: Information Sharing with Desktop XML
ISBN: 013142193X
EAN: 2147483647
Year: 2003
Pages: 176

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net