namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0"

graph = element graph { attlist.graph, x, y }
attlist.graph &=
  [ a:defaultValue = "vbar" ]
  attribute type { "vbar" | "hbar" | "line" | "pie" }?
attlist.graph &=
  [ a:defaultValue = "Unknown" ] attribute string { text }?
attlist.graph &=
  [ a:defaultValue = "#f5f5f5" ] attribute background { text }?
attlist.graph &= [ a:defaultValue = "blue" ] attribute color { text }?
attlist.graph &=
  [ a:defaultValue = "1" ] attribute legend { "0" | "1" }?
x = element x { attlist.x, field }
attlist.x &= empty
y = element y { attlist.y, field+ }
attlist.y &= empty
field = element field { attlist.field, empty }
attlist.field &= attribute name { text }
attlist.field &= attribute string { text }?
attlist.field &= attribute key { text }?
attlist.field &= attribute domain { text }?
attlist.field &= attribute fill { "0" | "1" }?
attlist.field &= attribute empty { "0" | "1" }?
attlist.field &= attribute color { text }?
attlist.field &= attribute widget { "float_time" }?
attlist.field &= attribute float_time { text }?
data = element data { attlist.data, xpath+ }
attlist.data &= empty
xpath = element xpath { attlist.xpath,
    (graph
    | x
    | y)*
  }
attlist.xpath &= attribute expr { text }
attlist.xpath &=
  [ a:defaultValue = "inside" ]
  attribute position { "inside" | "replace" | "replace_attributes" | "after" | "before" }?
start = data | graph
