
XML Syntaxes • 81
As we can see, <CATEGORY> is added as a sub-element to our XML structure. However, there is
another approach to handling this case. We can make category as an attribute of the one of the suitable
elements, for instance, that of the TITLE. This approach is illustrated in Figure 2.38.
<BOOK_DETAILS>
<TITLE category = “…”>
<MAIN_TITLE> </MAIN_TITLE>
<SUB_TITLE> </SUB_TITLE>
</TITLE>
<AUTHOR>
<FIRST_NAME> </FIRST_NAME>
<LAST_NAME> </LAST_NAME>
</AUTHOR>
<PUBLICATION>
<NAME> </NAME>
<WEB_URL> </WEB_URL>
</PUBLICATION>
<OTHER_INFO>
<PRICE> </PRICE>
<EDITION> </EDITION>
<BOOK_WEB_SITE> </BOOK_WEB_SITE>
</OTHER_INFO>
<SHORT_DESC> ...