Xml
XML has a number of related technologies that combine these technologies to give full play to the powerful capabilities of XML. These technologies include: XLink and XPointer (hyperlinks to set XML), DOM (Document Object model: File objects models, accessing, manipulating the contents of files), namespaces (solving problems with different elements having the same name), XHTML (next-generation HTML), and so on.
XLink and XPointer
In the XML specification, we see that it does not specify a problem with the file link. In order for the XML file to have a function similar to HTML file hyperlinks, the XLink and Xpionter two specifications, where XLink is the specification of the link between XML files (similar to the outer links in HTML), XPointer is the specification of a link between different locations in an XML file (similar to an inline link in html).
The links set by 1.xlink:xlink are divided into simple link and extended link. Among them, the link function of simple link and HTML hyperlink basically is same, and extended link is beyond the function of HTML hyperlink, it link object can set multiple at a time, by multiple tags to work out the link together.
When you use the XLink element in an XML file, you must declare the element in the DTD. The complete sample of the declaration is as follows (this sample declares a xlink element of simple Link type named simple):
〈! ELEMENT Simple any〉
〈! Attlist Simple
Xml:link CDATA #FIXED "Simple"
href CDATA #REQUIRED
Role CDATA #IMPLIED
Title CDATA #IMPLIED
Inline (True|false) "true"
Content-role CDATA #IMPLIED
Content-title CDATA #IMPLIED
Show (Embed|replace|new) #IMPLIED
Actuate (Auto|user) #IMPLIED
Behavior CDATA #IMPLIED
As you can see, the XLink element has multiple properties, and you can create a variety of links by assigning values to those attributes. Here are some explanations for these attributes.
Edit Recommended Reading
CSS and XSL overview
Xml:link: Indicates whether the link type is simple link or extended link.
HREF: The address used to set the link, as with the href attribute in the a tag in HTML.
Role: Describes the link feature, which is provided to the application for reading.
Title: Describes the link feature, which is provided to the user for reading, similar to the ALT attribute of the a tag in HTML.
Inline: Has both "true" and "false" values, declares whether the established link is linked in embedded mode, and defaults to "true".
Content-role and Content-title: Similar to role, title, but they describe the point of content, not the content of the link.
Show: There are three values, replace means to replace the content of the link with the current content, new means to open the content of the link in a new window, embed means to add the content of the link to the current content.
Actuate: Sets how the link is activated. Auto indicates that the link is automatically activated when the XML file is interpreted. User said that the link must be manually activated by the user, that is, users must click on the link with the mouse.
Behavior: When the link is activated, some actions are automatically raised, and some instructions are available to set what the application will do after the link is activated.
When we declare the XLink element in the DTD, we can use this element in the XML file. For example:
〈simple href= "http://www.cbinews.com/xml.htm" title= "This is an article about XML."
role= "XML article" content-role= "good" cont-title= "a", "New" show= "user"
behavior= "Goto Zero"/〉
Another way to XLink links is extended link, which features multiple linked objects at a time. Similarly, you must declare this element in the DTD before using the XLink element of the extended link type. The declaration is similar to the xlink element of the simple link type, with a difference of two points, first, when declaring the Xml:link property, the statement becomes: Xml:link CDATA #FIXED "extended"; second, there are no HREF attributes and any target descriptions, To declare a xlink element of the extended link type, you must include a set of child elements that contain the href location. That is, after declaring the xlink element of the extended link type, you must also declare a child element with a Xml:link property value of locator. For example:
〈! ELEMENT AAA any〉
〈! Attlist AAA
Xml:link CDATA #FIXED "Extended"
Inline (True|false) "true"
Content-role CDATA #IMPLIED
Content-title CDATA #IMPLIED
〈! ELEMENT BBB any〉
〈! Attlist BBB
Xml:link CDATA #FIXED "Locator"
Role CDATA #IMPLIED
href CDATA #REAUIRED
Title CDATA #IMPLIED
Show (embed|replace|new) "Replace"
Actuate (auto|user) "User"
Behavior CDATA #IMPLIED
〉
In this way, we can use the xlink element of the defined extended link in the XML file. Such as:
〈aaa〉 article Information
〈BBB href= "http://www.cbinews.com/XML1.htm title= XML Primer"/〉
〈BBB href= "http://www.cbinews.com/XML2.htm title= XML Advanced"/〉
〈BBB href= "http://www.cbinews.com/XML3.htm title=" XML application/〉
〈/aaa〉
When we use CSS or XSL to display this XML file in the browser, the user clicks on the "article material" this extended link xlink links, will appear a menu, listing all the child elements in the title, and take the user to the appropriate location.
2.xpointer:xpointer is used to set links in different locations within the XML file, similar to the inner links in HTML, but XPointer provides 5 different ways to locate within an XML file, locating the address in the appropriate place, Features are more powerful than inner links in HTML.
Absolute positioning: root ()-locates the address in the location of the root element in the XML file.
Property name (x)--locates the address to a specific attribute position where the property value is x.
Relative positioning: Child (X)--locates the address at the X sub mark under the current address.
Child (X,y)-locates the address at the mark at the x tag named Y under the current address.
Child (X). Child (Y,z)-locates the address at the X mark at the current address, and then takes the token as the current address, and then finds the control tag named Z under the tag.
Range positioning: Span (XPOINTER1,XPOINTER2)--selects all the content between the beginning of the first xpointer and the end of the second xpointer. The Xpointer1 and Xpointer2 represent other positioning methods.
Property positioning: attr (x)--finds the first tag with an X attribute.
String positioning: Searches for a specific string, and then locates the address at a specific string.
Merge positioning: The above positioning method is combined to produce more functions. Various positioning methods are separated by the "." Symbol.
DOM (Document Object Model)
As early as in HTML, DOM has been applied. Dom can be viewed as an ActiveX object that encapsulates a subset of the file access APIs (application programming interfaces) that enable users to invoke DOM objects using scripting languages (VBScript, JavaScript, etc.) to access and manipulate the contents of the file. Previously in HTML, we used DOM to create dynamic Web pages, and in XML files we could also use DOM to create dynamic Web pages, and the DOM could be used to load XML files and parse, intercept, and manipulate the information in the XML file.
IE 5 supports the integration of XML and DOM applications, providing four kinds of DOM objects: XMLDOMDocument, XMLDOMNode, Xmldomnodelist, Xmldomnamenodemap. These DOM objects provide a number of methods and properties that are not different from normal ActiveX objects. Specific properties, methods can refer to Microsoft's Web site.
For example, 3.htm this HTML file uses the Xmldom object, creates a DOM object using JavaScript in this HTML file, and then calls the DOM object to read the examples of XML files and XSL files that we spoke about XSL in the previous installments. The XML file is then displayed in the browser in accordance with the XSL style sheet settings. Cases:
〈html〉
〈head〉
〈title〉dom Application Examples 〈/title〉
〈script language= "JavaScript" for= "window" event= "onload"