          case .double:
             return [ampersandReplacement, doubleQuoteReplacement, lessThanReplacement]
          }
-      case .comment:
-         return []
       case .text:
          return [ampersandReplacement, lessThanReplacement]
       case .cdata:
+         return []
+      case .comment:
          return []
       case .processingInstruction:
          return []

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

   }
}

public enum EscapableContent: Equatable, CustomStringConvertible {
   fileprivate typealias Replacement = (unescaped: String, escaped: String)
   
   public enum Quotes: Equatable, CustomStringConvertible {
      case single
      case double
      
      public var description: String {
         switch self {
         case .single:
            return "Single quotes"
         case .double:
            return "Double quotes"
         }
      }
      
      private var quoteChar: String {
         switch self {
         case .single: return "'"
         case .double: return "\""
         }
      }
      
      fileprivate func quoted(attributeString string: String) -> String {
         return quoteChar + string.escaped(content: .attribute(quotes: self)) + quoteChar
      }
   }
   
   // See: https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents
   case attribute(quotes: Quotes)
   case text
   case cdata
   case comment
   case processingInstruction
   
   public var description: String {
      switch self {
      case .attribute(let quotes):
         return "Attribute enclosed in \(quotes)"
      case .text:
         return "Text"
      case .cdata:
         return "CDATA"
      case .comment:
         return "Comment"
      case .processingInstruction:
         return "Processing instruction"
      }
   }
   
   // See: https://en.wikipedia.org/wiki/XML#Escaping
   fileprivate var replacements: [Replacement] {
