// Walks through the documents elements and populates the buffer. func (self *Formatter) walk(node xml.Node) { for c := node.FirstChild(); c != nil; c = c.NextSibling() { self.walk(c) } if node.NodeType() == xml.XML_ELEMENT_NODE { self.handleNode(node) } }