Foros del Web » Programación para mayores de 30 ;) » Programación General »

Dudas XML Schema

Estas en el tema de Dudas XML Schema en el foro de Programación General en Foros del Web. Hola a todos. Recientemente hice el XML de abajo con schema, está bien creo que no tiene ningún error, pero me surgen varias dudas, a ...
  #1 (permalink)  
Antiguo 26/10/2014, 13:29
 
Fecha de Ingreso: marzo-2008
Mensajes: 383
Antigüedad: 16 años, 1 mes
Puntos: 5
Exclamación Dudas XML Schema

Hola a todos. Recientemente hice el XML de abajo con schema, está bien creo que no tiene ningún error, pero me surgen varias dudas, a ver si me podéis ayudar.

Se trata de un schema para un sitemap de una web, para que los buscadores la indexen. Según como lo tengo escrito, el elemento raíz es urlset, cierto?

Hay 4 tipos simples: loc, lastmod, changefreq y priority. Pero a partir de qué tipo básico se puede forman? El obligatorio es loc, cierto?

Y qué elementos se pueden repetir?

Muchas gracias de antemano, no me aclaro con el schema del demonio!



Código XML:
Ver original
  1. <?xml version="1.0" encoding="UTF-8"?>
  2.  
  3. <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  4.  
  5. targetNamespace="http://www.sitemaps.org/schemas/sitemap/0.9"
  6.  
  7. xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  8.  
  9. elementFormDefault="qualified">
  10.  
  11.  <xsd:annotation>
  12.  
  13.  <xsd:documentation>
  14.  
  15.  XML Schema for Sitemap files.
  16.  
  17.  Last Modifed 2008-03-26
  18.  
  19.  </xsd:documentation>
  20.  
  21.  </xsd:annotation>
  22.  
  23.  <xsd:element name="urlset">
  24.  
  25.  <xsd:annotation>
  26.  
  27.  <xsd:documentation>
  28.  
  29.  Container for a set of up to 50,000 document elements.
  30.  
  31.  This is the root element of the XML file.
  32.  
  33. </xsd:documentation>
  34.  
  35.  </xsd:annotation>
  36.  
  37.  <xsd:complexType>
  38.  
  39.  <xsd:sequence>
  40.  
  41.  <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"
  42.  
  43. processContents="strict"/>
  44.  
  45.  <xsd:element name="url" type="tUrl" maxOccurs="unbounded"/>
  46.  
  47.  </xsd:sequence>
  48.  
  49.  </xsd:complexType>
  50.  
  51.  </xsd:element>
  52.  
  53.  <xsd:complexType name="tUrl">
  54.  
  55.  <xsd:annotation>
  56.  
  57.  <xsd:documentation>
  58.  
  59.  Container for the data needed to describe a document to crawl.
  60.  
  61.  </xsd:documentation>
  62.  
  63.  </xsd:annotation>
  64.  
  65.  <xsd:sequence>
  66.  
  67.  <xsd:element name="loc" type="tLoc"/>
  68.  
  69.  <xsd:element name="lastmod" type="tLastmod" minOccurs="0"/>
  70.  
  71.  <xsd:element name="changefreq" type="tChangeFreq" minOccurs="0"/>
  72.  
  73.  <xsd:element name="priority" type="tPriority" minOccurs="0"/>
  74.  
  75.  <xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"
  76.  
  77. processContents="strict"/>
  78.  
  79.  </xsd:sequence>
  80.  
  81.  </xsd:complexType>
  82.  
  83.  <xsd:simpleType name="tLoc">
  84.  
  85. <xsd:annotation>
  86.  
  87.  <xsd:documentation>
  88.  
  89.  REQUIRED: The location URI of a document.
  90.  
  91.  The URI must conform to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt).
  92.  
  93.  </xsd:documentation>
  94.  
  95.  </xsd:annotation>
  96.  
  97.  <xsd:restriction base="xsd:anyURI">
  98.  
  99.  <xsd:minLength value="12"/>
  100.  
  101.  <xsd:maxLength value="2048"/>
  102.  
  103.  </xsd:restriction>
  104.  
  105.  </xsd:simpleType>
  106.  
  107.  <xsd:simpleType name="tLastmod">
  108.  
  109.  <xsd:annotation>
  110.  
  111.  <xsd:documentation>
  112.  
  113.  OPTIONAL: The date the document was last modified. The date must conform
  114.  
  115.  to the W3C DATETIME format (http://www.w3.org/TR/NOTE-datetime).
  116.  
  117.  Example: 2005-05-10
  118.  
  119.  Lastmod may also contain a timestamp.
  120.  
  121.  Example: 2005-05-10T17:33:30+08:00
  122.  
  123.  </xsd:documentation>
  124.  
  125.  </xsd:annotation>
  126.  
  127.  <xsd:union>
  128.  
  129.  <xsd:simpleType>
  130.  
  131.  <xsd:restriction base="xsd:date"/>
  132.  
  133.  </xsd:simpleType>
  134.  
  135.  <xsd:simpleType>
  136. <xsd:restriction base="xsd:dateTime"/>
  137.  
  138.  </xsd:simpleType>
  139.  
  140.  </xsd:union>
  141.  
  142.  </xsd:simpleType>
  143.  
  144.  <xsd:simpleType name="tChangeFreq">
  145.  
  146.  <xsd:annotation>
  147.  
  148.  <xsd:documentation>
  149.  
  150.  OPTIONAL: Indicates how frequently the content at a particular URL is
  151.  
  152.  likely to change. The value "always" should be used to describe
  153.  
  154.  documents that change each time they are accessed. The value "never"
  155.  
  156.  should be used to describe archived URLs. Please note that web
  157.  
  158.  crawlers may not necessarily crawl pages marked "always" more often.
  159.  
  160.  Consider this element as a friendly suggestion and not a command.
  161.  
  162.  </xsd:documentation>
  163.  
  164.  </xsd:annotation>
  165.  
  166.  <xsd:restriction base="xsd:string">
  167.  
  168.  <xsd:enumeration value="always"/>
  169.  
  170.  <xsd:enumeration value="hourly"/>
  171.  
  172.  <xsd:enumeration value="daily"/>
  173.  
  174.  <xsd:enumeration value="weekly"/>
  175.  
  176.  <xsd:enumeration value="monthly"/>
  177.  
  178.  <xsd:enumeration value="yearly"/>
  179.  
  180.  <xsd:enumeration value="never"/>
  181.  
  182.  </xsd:restriction>
  183.  
  184. </xsd:simpleType>
  185.  
  186. <xsd:simpleType name="tPriority">
  187.  
  188.  <xsd:annotation>
  189.  
  190.  <xsd:documentation>
  191.  
  192.  OPTIONAL: The priority of a particular URL relative to other pages
  193.  
  194.  on the same site. The value for this element is a number between
  195.  
  196.  0.0 and 1.0 where 0.0 identifies the lowest priority page(s).
  197.  
  198.  The default priority of a page is 0.5. Priority is used to select
  199.  
  200.  between pages on your site. Setting a priority of 1.0 for all URLs
  201.  
  202.  will not help you, as the relative priority of pages on your site
  203.  
  204.  is what will be considered.
  205.  
  206.  </xsd:documentation>
  207.  
  208.  </xsd:annotation>
  209.  
  210.  <xsd:restriction base="xsd:decimal">
  211.  
  212.  <xsd:minInclusive value="0.0"/>
  213.  
  214.  <xsd:maxInclusive value="1.0"/>
  215.  
  216.  </xsd:restriction>
  217.  
  218.  </xsd:simpleType>
  219.  
  220. </xsd:schema>

Etiquetas: dudas, schema, xml
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:27.