CHAPTER 4 XPATH, XPOINTER, XINCLUDE, AND THE FUTURE 153 parser The parserattribute specifies how the included resource should be parsed. The possible values are xml and text. When omitted, the default value of xmlis used to parse the include. The value xmlindicates that the resource should be included as parsed XML and merged into the document. The value textindicates that the resource should be included as text content. When including text, escaping will be performed on the contents of the resource to ensure proper text content. For instance, if an XML document were included using text parsing, characters such as would be included using their escaped values, < and >. xpointer This attribute specifies an XPointer expression to be evaluated on the included document. This will allow the include to limit or specify portions of the external xml resource to include. The xpointer attribute is valid only when the parser attribute value is xml, either through omission or explicitly set. Using the xpointer attribute when the parser value is text will result in an error. When the xpointerattribute is omitted, the hrefattribute must be present. encoding The encoding attribute specifies the encoding of a text resource. It is applicable only when the parse attribute is set to text. When parsing XML, the encoding is handled through the normal XML encoding methods. There is no built-in mechanism to specify encoding on non-XML resources, so you can set an encoding name, as defined by the acceptable XML encoding names, as the value of this attribute for this purpose. accept The accept attribute is used for content negotiation while retrieving the resource. When fetching a resource through HTTP, the value of this attribute is added to the HTTP request as an Accept header. accept-language This attribute is also used for content negotiation. Similar to the accept attribute, the value of the accept-languageattribute is added to the HTTP request as an Accept-Language header. Using xi:include The xi:include element is easy to add to a document. Using the external file courses.xml in Listing 4-7, you can construct a document that can include the contents of that file just as if the remote document were contained within the base document: Processing the XInclude within this document results in the following output:
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Cheap Web Hosting services
No comments yet.
Sorry, the comment form is closed at this time.