def write_attributes(writer, node)
      if node.attributes.count > 0
        # stuff them into an array of strings
        attrs = []

        node.attributes.each do |attr|
          # special case:
          # example: <nav class="top-bar" data-topbar>
          if attr.value.nil?
            attrs << attr.name
          else
            attrs << attr.name + '="' + attr.value + '"'
          end
        end

        # separate them with a space
        attr_str = attrs.join(' ')

        # requires a leading space as well to separate from the element name.
        writer.write(' ' + attr_str)
      end

      nil
    end
def write_attributes(writer, node)
      if node.attributes.count > 0
        # stuff them into an array of strings
        attrs = []

        node.attributes.each do |attr|
          # special case:
          # example: <nav class="top-bar" data-topbar>
          if attr.value.nil?
            attrs << attr.name
          else
            attrs << attr.name + '="' + attr.value + '"'
          end
        end

        # separate them with a space
        attr_str = attrs.join(' ')

        # requires a leading space as well to separate from the element name.
        writer.write(' ' + attr_str)
      end

      nil
    end
Write the attribute collection for a node.
 void write_attributes(XmlTextWriter writer, XmlNode node)