CHAPTER 13 CASE STUDY: USING PHP FOR AN XML APPLICATION 399 If users change the URL to http://localhost/weather/index.php?continent=7643, one of two things can happen. Either the value 7643 refers to a continent in the database, or the id is invalid. In the first case, the application can display the subnavigation for that continent, but in the second case, it needs to display an error message. The application uses the following XML document structure for this scenario: Error You appear to have selected an invalid continent Instead of an element, the document includes Error as the value of the element. It also includes an element with an error message that displays to the user. Scenario 3: Dealing with Subnavigation Items The most likely scenario is that the application displays subnavigation items. The structure of this type of XML document is similar to that shown in scenario 1. The difference is that the element contains multiple elements: WA
city Albany Bunbury Geraldton Perth Each element has an idthat corresponds to the idfield in the database. It also contains the name of the navigation item in this case, the name of the city. Now let s see how to build the XML document to cope with these different scenarios. Building the XML Document The mk_navxml.php document starts by including weather.php: xmlStandalone = false;
In case you need quality webspace to host and run your web applications, try our personal web hosting services.
This entry was posted
on Sunday, January 13th, 2008 at 11:17 pm and is filed under Tomcat.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.