Extract common elements to _opml layout page

Do code clean up including renaming demo1 to opmlDocument.
Rearrange the logic for editing.