XInclude is a generic mechanism for merging XML documents, by writing inclusion tags in the "main" document to automatically include other documents or parts thereof.[1] The resulting document becomes a single composite XML Information Set. The XInclude mechanism can be used to incorporate content from either XML files or non-XML text files.

XInclude is not natively supported in Web browsers, but may be partially achieved by using some extra JavaScript code.[2]

Example

edit

For example, including the text file license.txt:

This document is published under GNU Free Documentation License

in an XHTML document:

<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude">
   <head>...</head>
   <body>
      ...
      <p><xi:include href="license.txt" parse="text"/></p>
   </body>
</html>

gives:

<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude">
   <head>...</head>
   <body>
      ...
      <p>This document is published under GNU Free Documentation License</p>
   </body>
</html>

The mechanism is similar to HTML's <object> tag (which is specific to the HTML markup language), but the XInclude mechanism works with any XML format, such as SVG and XHTML.

See also

edit

References

edit
  1. ^ J. Marsh; D. Orchard; Daniel Veillard. "XML Inclusions (XInclude) Version 1.0 (Second Edition), Appendix C: Examples (non-normative)". World Wide Web Consortium. Retrieved 2007-06-28.
  2. ^ Brettz9; et al. "XInclude". Mozilla Developer Network.
edit

📚 Artikel Terkait di Wikipedia

XML

Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for

Apache Xerces

parsing, validating, serializing and manipulating XML. The library implements a number of standard APIs for XML parsing, including DOM, SAX and SAX2. The implementation

XML schema

An XML Schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that

List of XML markup languages

This is a list of notable XML markup languages. Contents:  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z AdsML Markup language used for interchange

XML external entity attack

XML External Entity attack, or simply XXE attack, is a type of attack against an application that parses XML input. This attack occurs when XML input

XML-binary Optimized Packaging

into the XML Information Set. XOP allows the binary data part of an XML Infoset to be serialized without going through the XML serializer. The XML serialization

Web platform

colors, spacing) to Web documents. Scalable Vector Graphics (SVG) is an XML-based vector graphics format for defining two-dimensional graphics, having

Marshalling (computer science)

Java is that C# natively supports marshalling due to the inclusion of System.Xml.Serialization.XmlSerializer class. Java, on the other hand requires a non-native