1#!/bin/sh
2
3gawk -v many="$1" '
4BEGIN{XMLLINT="xmllint --noout -";}
5function chkoutput(ra) {
6	if( ra=="" ) return;
7	if( close(XMLLINT) ) # we need gawk for this
8		print "xmllint reported error in RA:",ra;
9}
10many=="many" && /^[a-zA-Z][^:]*:[a-zA-Z0-9]+$/ {
11	chkoutput(ra);
12	ra=$0;
13	next;
14}
15{ print | XMLLINT }
16END{
17	if( many!="many" )
18		chkoutput("noname");
19}
20'
21