anchor.diff:          writeFunc info w value
           w.Write("</"); w.Write(name); w.Write('>')
   
  +    /// Write the inner attribute value while escaping double quotes
  +    let writeAttributeValue (writer : TextWriter) (value : string) =
  +        if value <> null && value.Length > 0 then
  +            let len = value.Length
  +            let chrs = value.ToCharArray()
  +            let mutable i = 0
  +            let mutable buffer = &&chrs.[0]
  +            while i < len do
  +                let chr = NativePtr.read buffer
  +                buffer <- NativePtr.add buffer 1
  +                match chr with
  +                | '"' -> writer.Write("&#x22;")
  +                | _   -> writer.Write(chr)
  +                i <- i + 1
  +
       /// XML tag writer function with an additional namespace attribute
       let writeTagNamespace (ns : string) (name : string) (info : NameInfo) (w : TextWriter) writeFunc (value : obj) =
  -        w.Write('<'); w.Write(name); w.Write(" xmlns=\""); w.Write(ns); w.Write("\">")
  +        w.Write('<'); w.Write(name); w.Write(" xmlns=\""); writeAttributeValue w ns; w.Write("\">")
           writeFunc info w value
           w.Write("</"); w.Write(name); w.Write('>')
   
  
positive.code:         if List.isEmpty attr then writeTag name info w writeFunc value
          else
              w.Write('<'); w.Write(name);
              attr |> List.iter (fun (k, v) -> w.Write(' '); w.Write(k); w.Write("=\""); w.Write(v); w.Write("\""))
              w.Write('>');
              writeFunc info w value
              w.Write("</"); w.Write(name); w.Write('>')
  
negative.code:                 let intVal = int chr
                  buffer <- NativePtr.add buffer 1
                  match chr with
                  | '<'  -> writer.Write("&lt;")
                  | '>'  -> writer.Write("&gt;")
                  | '&'  -> writer.Write("&amp;")
                  | '\'' -> writer.Write("&#x27;")
                  | '"'  -> writer.Write("&#x22;")
                  | _ when intVal <= 126 -> writer.Write(chr)
                  | _ -> unicodeWriter writer intVal
                  curr <- curr + 1
  