Cheap Web Hosting for Developers

PHP, MySQL, Java, Unix Cheap Web Hosting

CHAPTER 4 XPATH, XPOINTER, XINCLUDE, AND THE

Filed under: PHP and XML — webmaster @ 11:35

CHAPTER 4 XPATH, XPOINTER, XINCLUDE, AND THE FUTURE 155 The function id() takes a string argument, which must be surrounded by quotes. This appears within an attribute whose value is enclosed in double quotes. For this reason, I used single quotes to encapsulate the string c1. When the attribute value is enclosed by single quotes, the string needs to be encapsulated by double quotes, like xpointer=’xpointer(id(”c1″))’. This returns the courseelement identified by the ID c1from the courses.xmldocument. When included, the resulting document looks like this: Introduction to Languages Including documents, text, and fragments is a straightforward and simple process. All that is required is the addition of an include element, which resides in the http://www.w3.org/ 2001/XInclude namespace, and the location of the resource to be included. Within this section you have come to know this as the xi:include element. XInclude also offers a form of error handling, which is covered next, in the event you encounter a problem with the xinclude. xi:fallback Sometimes an XInclude may fail. It could be because of a problem accessing the remote resource or a possibly invalid selection of data. Normally this would cause an error in processing. XInclude offers a way to handle this and use other functionality in the event of an error. You do this using the xi:fallback element. The fallback element is referenced here using xi:fallback. It falls under the same rules as the xi:includeelement in respect to the namespace. It must reside within the http://www.w3.org/ 2001/XIncludenamespace, which for this chapter has been associated with the xiprefix. This element lives as a child of the xi:includeelement and has no attributes. When an error occurs from the xi:includeelement, the contents of the xi:fallbackelement are used for replacement. Sometimes a network may be unavailable, or an Internet connection goes down. It is also possible that the filename of the remote resource was mistyped in the xi:xincludehref attribute. Each of these would cause the include to fail. Take the case of an invalid href: This href is pointing to coursesBAD.xml, which is a file that does not exist. Processing the xinclude will result in at a minimum a parser warning and possibly an unrecoverable parser

Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP MySQL Web Hosting services

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by Cheap Web Hosting