Kurs XML - Zadanie 9.

Treść

Consider a toy variant of XHTML named ToyXHTML whose syntax may be described as follows:

  • The root element named doc contains a sequence of p and h1 elements.
  • An h1 element may contain character data but no subelements.
  • Each p element contains text (character data) that may be marked up with em and a elements.
  • Every a element has either a name attribute or an href attribute (not both!), and the value of the latter must be a URI.

Formalize the syntax of ToyXHTML using your favorite schema language.

Rozwiązanie

zadanie09.xml
datatypes xs = "http://www.w3.org/2001/XMLSchema-datatypes"
element doc {
  (
    element p {
      (
        text |
        element em { text } |
        element a {
          (attribute name { text } |
          attribute href { xs:anyURI }),
          text
        }
      )*
    } |
    element h1 { text }
  )*
}
 
kurs_xml/10.zadanie09.txt · ostatnio zmienione: 2010/03/30 17:56 przez d
 
Wszystkie treści w tym wiki, którym nie przyporządkowano licencji, podlegają licencji:MIT License
Recent changes RSS feed