What is uri actually used for namespace?

Do URIs in lines (5,6,7) point to something?

When I point them to the duff urls it still seems to work to validate my xml, so what's the point?

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="UploadXSD"
    targetNamespace="UploadXSD"
    elementFormDefault="qualified"
    xmlns="http://tempuri.org/UploadXSD.xsd"
    xmlns:mstns="http://tempuri.org/UploadXSD.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="Video">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="Title" minOccurs="1" type="xs:string"></xs:element>
        <xs:element name="Description" minOccurs="1" type="xs:string"></xs:element>
        <xs:element name="Contributor" minOccurs="1" type="xs:string"></xs:element>
        <xs:element name="Subject" minOccurs="1" type="xs:string"></xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
+3
source share
2 answers

The point of using URNs as a namespace is that they are unique. For example, you can use a GUID, but in this way they are more readable.

Of course, using URN gives you the opportunity to point them to an actual resource, such as an xsd file, but this is an additional bonus and is not required.

"Tempuri" - ( "temp" + "uri" ), URN, .

XMLSchema -, XML-.

XML- , , , , XML-Schema. XML .

+5

URI XML ( URL-) - . XML. , , , , .

DNS , , . , GUID ( URI).

:

, URI - ( ).

URI , .

, ,

+4

Source: https://habr.com/ru/post/1777482/


All Articles