Markup Rules: Serial Processing

XML serial parsing is declared using the xmlserial profile:

program xmlserial, textpatterns;
parseXmlSerially ();
choose xmlElement ("doc") {
  println (".startdoc"); processChildren; println (".enddoc");
}
choose xmlElement ("p") :> processChildren;
choose xmlElement ("list") {
  println (".startlist"); processChildren; println (".endlist");
}
choose xmlElement ("item") {
  print (".item "); processChildren;
}
choose xmlText =
  println (*.data) unless *.data matches ([" \t\n"]* & -|);

The input and output for this example is the same as for the previous tree parsing example.

Beyond OmniMark Sam Wilmott
Slide 20 of 37 www.wilmott.ca