### The document model, and true parser and emitter follow
        
class DocNode:
    """A node in the Document."""

    def __init__(self, kind='', parent=None, content=None):
        self.children=[]
        self.parent = parent
        self.kind = kind
        self.content = content
        if not self.parent is None:
            self.parent.children.append(self)
