       switch (lhs, rhs) {
       case (.attribute(let lhsQuotes), .attribute(let rhsQuotes)):
          return lhsQuotes == rhsQuotes
-      case (.comment, .comment),
-           (.text, .text),
-           (.cdata, .cdata):
+      case (.text, .text),
+           (.cdata, .cdata),
+           (.comment, .comment):
          return true
       default:
          return false


public extension String {
    public init(xmlDocumentRoot root: Element, version: Version = Version(major: 1), encoding: DocumentEncoding = .utf8, options: SerializationOptions = []) {
      let versionAttribute = "version=\"" + version.versionString().escaped(content: .attribute(quotes: .double)) + "\""
      let encodingAttribute = "encoding=\"" + encoding.attributeValue.escaped(content: .attribute(quotes: .double)) + "\""
      self = "<?xml \(versionAttribute) \(encodingAttribute)?>"
         + options.lineSeparator
         + String(xml: root)
         + options.lineSeparator
   }
   
   public init(xml: Element, options: SerializationOptions = []) {
      let attributes = xml.attributes.isEmpty ? "" : " " + xml.attributes.map {
         $0.key + "=\"" + $0.value.escaped(content: .attribute(quotes: .double)) + "\""
      }.joined(separator: " ")
      let start = "<\(xml.name)\(attributes)"
      let end = "</\(xml.name)>"

      case .objects(let objs):
         self = start + ">"
            + options.lineSeparator
            + objs.map { String(xml: $0, options: options) }.joined()
            + end
      }
      self += options.lineSeparator
   }
}
