This is a bit abstract, not easy to understand, and I have learned a little bit, but it is very remarkable. It brings us a lot of convenience in XML applications, the XML function has also been greatly improved, and I feel like it. Oh, there is something wrong with it. Don't laugh! Before entering the subject, we will reference an example: <Table> <Tr> <TD> apples </TD> <TD> bananas </TD> </Tr> </Table> In the above XML, it is a bit similar to the table function in HTML we have seen before. In fact, you can also think it is as simple as that; <Table> <Name> African coffee table </Name> <Width> 80 </width> <Long> 120 </length> </Table> In this XML, we describe the information of a table. In this way, if we put the two XML into an XML file, we will encounter a naming conflict, so there is name space. XML namespace-the solution to the above problems: I. Use a prefix to solve naming conflicts: The above two files are changed to the following: 1 -- <H: tr> <H: TD> apples <H: TD> bananas </H: tr> </H: Table> 2 -- <F: Table> <F: Name> African coffee table </F: Name> <F: width> 80 </F: width> <F: length> 120 </F: length> </F: Table> Can we clearly separate two different types of information? You can easily reference these two files through 2. Use namespaces to solve this problem: 1 -- <H: tr> <H: TD> apples <H: TD> bananas </H: tr> </H: Table> 2 --- <F: Table xmlns: F = "http://www.w3.org/TR/xsl"> <F: Name> African coffee table </F: Name> <F: width> 80 </F: width> <F: length> 120 </F: length> </F: Table> In the preceding example, in addition to the prefix, The xmlns attribute is used. xmlns is the abbreviation of XML name space. Namespace properties: typically the declaration where the element begins to mark, in the format of xmlns: namespace-Prefix = "namespace" such as: xmlns: F = "http://www.w3.org/TR/xsl" During the naming process, the URL-like stuff in the text does not actually make sense, but it is just a mark. well, today it's so much. How can we use it? It's still to be studied ..... |