This article mainly introduces the processing commands in XML. the processing commands are not commonly used in XML. just a little bit of understanding. if you need them, you can refer to the next article to introduce the processing commands in XML, processing commands are not commonly used in XML. you just need to know about them. For more information, see
"Processing commands (PIs) allow documents to contain commands for applications. Commands are not part of the document character data, but must be passed through the application ".
Processing commands can be used to pass information to applications. Processing commands can appear outside the mark at any location in the document. It can appear in the preface, including the Document Type Definition (DTD), text content or after the document.
Processing commands, allowing documents to contain commands processed by applications. In XML documents, some data in non-XML format may be contained, which cannot be processed by the XML processor, so we can notify other applications to process the data through processing commands.
The syntax of the processing instruction (PI) is similar to that of the XML declaration, with <? Start with?> End. The following is a common command to process styles:
<?xml-styesheet herf=”hello.css” type=”text/css”?>
Mark at start <? The first string, xml-styesheet, is called the target for processing commands. it must identify the application to be used, note that other non-W3C-defined processing commands cannot start with strings XML and xml, and the rest are the character data passed to the application, the application obtains the target and data from the processing instruction and executes the required action.
The target for processing commands can be the name of the program to be used, or an identifier that can be identified by many programs such as xml-stylesheet. Different applications support different processing commands. for unknown processing commands, most applications ignore them. For custom processing commands, it is usually processed by a selected application. Because the processing command you defined is not recognizable to other applications, it will be ignored for processing.
Xml-stylesheet processing commands are always placed after the XML declaration and before the first element. Other processing commands can be placed anywhere before the internal marking and XML declaration.
Note that although the XML declaration and the syntax form of the processing instruction are similar, the XML declaration is not a processing instruction. the XML processing program uses different processing methods for the XML declaration and processing instruction.
Syntax
The syntax for processing commands is as follows:
Where:
Target-identifies the application to which the command points.
The instruction-character that describes the information to be processed by the application.
Processing commands with special End. When the processed content encounters a string?> End immediately.
Example
Processing commands are rarely used. It is mainly used to link an XML document to a style sheet. The following is an example:
Here, target is xml-stylesheet. Href = "tutorialpointstyle.css" and type = "text/css" are the instructions that the data or target application uses to process a given XML document.
In this case, the browser identifies the target, and XML should be converted between the display. the first attribute state indicates that the conversion type is XSL, and the second attribute points to its position.
Processing Command rules
Which of the following processing commands can contain?> Any data other than the combination is interpreted as a closed instruction. The following are two examples of valid processing commands:
The above is a detailed explanation of the code for processing commands in XML. For more information, see other related articles in the first PHP community!