relaxng.rnc 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # RELAX NG XML syntax expressed in RELAX NG Compact syntax.
  2. # Copyright (C) 2003-2004, 2007-2012 Free Software Foundation, Inc.
  3. # This file is part of GNU Emacs.
  4. # GNU Emacs is free software: you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation, either version 3 of the License, or
  7. # (at your option) any later version.
  8. # GNU Emacs is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. # You should have received a copy of the GNU General Public License
  13. # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  14. default namespace rng = "http://relaxng.org/ns/structure/1.0"
  15. namespace local = ""
  16. datatypes xsd = "http://www.w3.org/2001/XMLSchema-datatypes"
  17. start = pattern
  18. pattern =
  19. element element { (nameQName | nameClass), (common & pattern+) }
  20. | element attribute { (nameQName | nameClass), (common & pattern?) }
  21. | element group|interleave|choice|optional
  22. |zeroOrMore|oneOrMore|list|mixed { common & pattern+ }
  23. | element ref|parentRef { nameNCName, common }
  24. | element empty|notAllowed|text { common }
  25. | element data { type, param*, (common & exceptPattern?) }
  26. | element value { commonAttributes, type?, xsd:string }
  27. | element externalRef { href, common }
  28. | element grammar { common & grammarContent* }
  29. param = element param { commonAttributes, nameNCName, xsd:string }
  30. exceptPattern = element except { common & pattern+ }
  31. grammarContent =
  32. definition
  33. | element div { common & grammarContent* }
  34. | element include { href, (common & includeContent*) }
  35. includeContent =
  36. definition
  37. | element div { common & includeContent* }
  38. definition =
  39. element start { combine?, (common & pattern+) }
  40. | element define { nameNCName, combine?, (common & pattern+) }
  41. combine = attribute combine { "choice" | "interleave" }
  42. nameClass =
  43. element name { commonAttributes, xsd:QName }
  44. | element anyName { common & exceptNameClass? }
  45. | element nsName { common & exceptNameClass? }
  46. | element choice { common & nameClass+ }
  47. exceptNameClass = element except { common & nameClass+ }
  48. nameQName = attribute name { xsd:QName }
  49. nameNCName = attribute name { xsd:NCName }
  50. href = attribute href { xsd:anyURI }
  51. type = attribute type { xsd:NCName }
  52. common = commonAttributes, foreignElement*
  53. commonAttributes =
  54. attribute ns { xsd:string }?,
  55. attribute datatypeLibrary { xsd:anyURI }?,
  56. foreignAttribute*
  57. foreignElement = element * - rng:* { (anyAttribute | text | anyElement)* }
  58. foreignAttribute = attribute * - (rng:*|local:*) { text }
  59. anyElement = element * { (anyAttribute | text | anyElement)* }
  60. anyAttribute = attribute * { text }