Hand-migration to TypedXml interface.

Previous changes have applied mechanical refactorings, but this change
hand-migrates the remaining logic which was too complex to identify.

This change should have no behavior change; famous last words.

Bug: 171832118
Test: manual
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: Id9cf744fc28a66de6439bddb1344293f4ad96acf
19 files changed