The following score creates valid, but incorrect musicxml.
\score{
{ c1 | \repeat volta 2 { c1 | } }
\layout{}
}
In the xml, it puts the end-of-repeat-barline at the beginning of a new measure, not at
the end of the previous inserted measure.
If I where to hack at it myself, what place would be the wisest to start?