refactor the document class

the global state of the document class is in the session object
the element specific state of the document class is in element objects

limitations

there can only be one element object, so all stream are away of each other
atm the prefix is not use for class name resolution
probably others