XML : use namespace without url or uri .I'm confused

I'm new to using XML , I'm learning the first concepts . I'm confused on the use of namespaces . I prepared two simple files: one xml-schema and XML document . please let help to understand the mistakes , if I have made ​​, and try to explain how to use the schema-file on my PC and not on a site. I ask this because all the examples I have found using a url like namespaces or location file.xml . thank you.

P.S. sorry for my English
this is cdSchema.xsd

  <?xml version="1.0" encoding="UTF-8"?>  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"  elementFormDefault="qualified"  targetNamespace="CD"  xmlns="CD">  <xs:element name="artist" type="xs:string"/>  <xs:element name="length" type="xs:string"/>  <xs:element name="title" type="xs:string"/>  <xs:element name="year" type="xs:string"/>  <xs:element name="song">      <xs:complexType>          <xs:sequence>              <xs:element ref="artist">              <xs:element ref="length">              <xs:element ref="title">              <xs:element ref="year">          </xs:sequence>      </xs:complexType>  </xs:element>  </xs:schema>    

this is compactDisc.xml

  <?xml version="1.0" encoding="UTF-8"?>  <CD xmlns="CD"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:schemaLocation="CD cdSchema.xsd">        <song>          <artist>Santana</artist>          <title>African Song</title>          <length>4:42</length>          <year>1993</year>      </song>      <song>          <artist>Santana</artist>          <title>Corazon Espinado</title>          <length>4:36</length>          <year>1996</year>      </song>    </CD>    

thanks for everybody

No comments:

Post a Comment