XML Standardization (2)

zhaozj2021-02-16  53

XML Standardization (2)

The previous article introduced how to standardize XML files through an example, this article mainly tells some of the issues that the XML file subset is regulated. When we extract some of the content from an XML file, we generally separate a child node from its parent node. We call this child node as an orphan node, and the extracted file is called a document subset. If the namespace of the orphan node declares in its parent node, the original namespace context may be lost. Here is an example in an example.

Document 1

Suppose we only need to standardize the booking element of UnitChange = 50. In the first step, we extract the Booking child node of Unitcharge = "50", and the file 2 is the subset of documents extracted. In File 2, we don't know what the BS and HS prefix are because the extracted files lose their namespace declaration. Another point, in file 1, the property XML: LANG is applied to all child nodes, and the file 2 is also lost.

File 2

In view of the above reasons, two rules defined in the XML normalization rules to handle subdocument extraction: 1 The parent namespace declaration of the neglected in document subset is added to the document subset. 2 XML namespace properties also need to be added to the document subset. After using these two standardized rules, the extracted documents are shown in File 3. File 3

The package SOAP is an XML-based, simple protocol for exchanging structured and type information on the web, which defines the format of the XML data packaged in the envelope. Let's go back and look at the file 1, it will be packaged in the SOAP: Body element in SOAP: body element. Document 1 describes a simple packaging mechanism: The information passed is packaged in the SOAP: body element, the entire SOAP: body element is also packaged in the SOAP: envelope element. Let's take a look at a situation in which problems. A tourist wants to understand the details of the travel through the web service provided by the travel agency, so this visitors have sent an XML information to the travel agency. In the information, the location and time of his plan is planned, all the information is placed in a SOAP envelope. Of course, this XML information is generated by the client's program, which is not necessary to learn about XML and SOAP. After the travel agency receives this SOAP envelope, its web service extracts the tourist location and time information from the envelope, and then re-encapsulates this information, then sending this information to several different hotels and car rentals. Here, the travel agency's Web service needs to generate a new SOAP envelope. According to the same manner, after the travel agency receives the information returned by the hotel and the car rental company, it reinages these information and then sends back to the passenger. File 4 is a SOAP information such as a hotel to return to the travel agency.

Document 4 Travel agencies may also receive SOAP information from other hotels and car rentals, it needs to merge this information into an envelope, then return to passengers. Document 1 is the SOAP packet of the travel agency finally sent to the tourists, and the first booking element is the same as the booking element in the file 4. Now, we assume that the hotel wants to sign the booking elements of the file 4, so that travel agencies and visitors can verify that Booking is illegally tamper. The first step in the signature is to extract the booking element and then standardize the extracted document subset to obtain file 5.

Document 5 hotel received After the file 5, use it to generate information summary. After the hotel is verified, as mentioned earlier, all aspects of information merge, and then return to the customer. This process is shown in Figure 1.

As shown in Figure 1, passengers have received the SOAP envelope of the travel agency, and the guest's Web Services open the SOAP envelope, extract and verify information. First, extract the booking element from the file 1 as described above, the extracted document subset is file 3; then, the program generates a summary of the file 3 and compares it with the received information summary. Obviously, the result will be a failed verification. At this time, the passenger will consider that the information is illegally modified, but in fact, this information is not modified. Such a scenario is very common in a joint web service. In order to deal with these issues, W3C specializes in another standardized rule "Special XML Standardization Rule", which is only used when the standardized document is set.

转载请注明原文地址:https://www.9cbs.com/read-26524.html

New Post(0)